svn commit: r303988 - head/lib/libc/gen
Bryan Drewery
bdrewery at FreeBSD.org
Thu Aug 25 23:52:55 UTC 2016
On 8/25/2016 1:55 PM, Ed Schouten wrote:
> Hi Bryan,
>
> 2016-08-25 19:43 GMT+02:00 Bryan Drewery <bdrewery at freebsd.org>:
>>>> readelf -a /lib/libc.so.7|grep basename
>>> 2149: 0000000000076200 231 FUNC GLOBAL DEFAULT 11
>>> basename@@FBSD_1.0 (2)
>>> 2514: 0000000000076140 184 FUNC GLOBAL DEFAULT 11
>>> basename_r@@FBSD_1.2 (4)
>
> I think the reason for this is that I haven't made any changes to the
> underlying basename() function (yet); only to dirname(). So there is
> no basename at FBSD_1.0. Only basename@@FBSD_1.0 (to indicate it's the
> latest version against we should link).
>
It only happens with static builds which lack the 1.0 symbol:
> # readelf -a /usr/lib/libc.a|grep basename
> File: /usr/lib/libc.a(basename.o)
> 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS /root/git/freebsd/lib/libc/gen/basename.c
> 2: 0000000000000000 8 OBJECT LOCAL DEFAULT 5 basename.bname
> 6: 00000000000000c0 231 FUNC GLOBAL DEFAULT 2 basename
> 7: 0000000000000000 184 FUNC GLOBAL DEFAULT 2 basename_r
With dynamic it is fine:
> # readelf -a /lib/libc.so.7|grep basename
> 2149: 0000000000078280 231 FUNC GLOBAL DEFAULT 11 basename@@FBSD_1.0 (2)
> 2514: 00000000000781c0 184 FUNC GLOBAL DEFAULT 11 basename_r@@FBSD_1.2 (4)
> What happens if you s/__sym_compat/__sym_default the basename() line?
>
>
Libc wouldn't build, it complained quite loudly with a lot of these:
> fatal error: error in backend: A @@ version cannot be undefined
With this it built:
> diff --git lib/libc/gen/basename.c lib/libc/gen/basename.c
> index 7e21ca4..5f35613 100644
> --- lib/libc/gen/basename.c
> +++ lib/libc/gen/basename.c
> @@ -66,7 +66,7 @@ basename_r(const char *path, char *bname)
> }
>
> char *
> -basename(char *path)
> +(basename_impl)(char *path)
> {
> static char *bname = NULL;
>
> @@ -77,3 +77,4 @@ basename(char *path)
> }
> return (basename_r(path, bname));
> }
> +__sym_default(basename, basename_impl, FBSD_1.0);
Perhaps there is a better way, but it worked...
Then I get:
> # readelf -a /lib/libc.so.7|grep basename
> 2145: 0000000000078280 231 FUNC GLOBAL DEFAULT 11 basename@@FBSD_1.0 (2)
> 2514: 00000000000781c0 184 FUNC GLOBAL DEFAULT 11 basename_r@@FBSD_1.2 (4)
> # readelf -a /usr/lib/libc.a|grep basename
> File: /usr/lib/libc.a(basename.o)
> 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS /root/git/freebsd/lib/libc/gen/basename.c
> 2: 0000000000000000 8 OBJECT LOCAL DEFAULT 5 basename_impl.bname
> 6: 00000000000000c0 231 FUNC GLOBAL DEFAULT 2 basename@@FBSD_1.0
> 7: 00000000000000c0 231 FUNC GLOBAL DEFAULT 2 basename_impl
> 8: 0000000000000000 184 FUNC GLOBAL DEFAULT 2 basename_r
And xinstall builds with dynamic and static and runs fine.
--
Regards,
Bryan Drewery
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20160825/02008e0c/attachment.sig>
More information about the svn-src-head
mailing list