Hi the linker script /usr/lib/libc.so fails when you are using the --sysroot options because it contains absolute paths. Does anyone know if there is a way to add the sysroot to the script? currently teh on ein our sysroot looks like: $ cat /usr/build/buildroot/tools/x86_FBSD1X_gcc4.2.4/usr/lib/libc.so /* $FreeBSD$ */ GROUP ( /lib/libc.so.7 /usr/lib/libc_nonshared.a /usr/lib/libssp_nonshared.a ) but I'd like to do something like: GROUP ( ${sysroot}/lib/libc.so.7 ${sysroot}/usr/lib/libc_nonshared.a ${sysroot}/usr/lib/libssp_nonshared.a ) but don't think I can do that from what I see below however it shouldn't be needed. Is this a bug in our version of ld? or am I misreading it? I quote from one such source : https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/simple-commands.html ===============================================INPUT(file, file, ?), INPUT(file file ?) The INPUT command directs the linker to include the named files in the link, as though they were named on the command line. For example, if you always want to include subr.o any time you do a link, but you can't be bothered to put it on every link command line, then you can put INPUT (subr.o) in your linker script. In fact, if you like, you can list all of your input files in the linker script, and then invoke the linker with nothing but a -T option. In case a /sysroot prefix/ is configured, and the filename starts with the / character, and the script being processed was located inside the /sysroot prefix/, the filename will be looked for in the /sysroot prefix/. Otherwise, the linker will try to open the file in the current directory. If it is not found, the linker will search through the archive library search path. See the description of -L in Section 3.1 /Command Line Options/ <https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/invocation.html#OPTIONS>. If you use INPUT (-lfile), ld will transform the name to libfile.a, as with the command line argument -l. When you use the INPUT command in an implicit linker script, the files will be included in the link at the point at which the linker script file is included. This can affect archive searching. GROUP(file, file, ?), GROUP(file file ?) The GROUP command is like INPUT, except that the named files should all be archives, and they are searched repeatedly until no new undefined references are created. =========================================
Julian Elischer
2017-Jan-29 17:36 UTC
[IGNORE] ldd linker script /usr/lib/libc.so fail [IGNORE]
Tracked this down to a rogue copy of libc.so in an unexpected place which was being found earlier than the real one. On 30/1/17 1:13 am, Julian Elischer wrote:> Hi > > the linker script /usr/lib/libc.so fails when you are using the > --sysroot options because it > > contains absolute paths. > > > Does anyone know if there is a way to add the sysroot to the script? > > currently teh on ein our sysroot looks like: > > $ cat /usr/build/buildroot/tools/x86_FBSD1X_gcc4.2.4/usr/lib/libc.so > /* $FreeBSD$ */ > GROUP ( /lib/libc.so.7 /usr/lib/libc_nonshared.a > /usr/lib/libssp_nonshared.a ) > > but I'd like to do something like: > > GROUP ( ${sysroot}/lib/libc.so.7 ${sysroot}/usr/lib/libc_nonshared.a > ${sysroot}/usr/lib/libssp_nonshared.a ) > > but don't think I can do that > > from what I see below however it shouldn't be needed. > > Is this a bug in our version of ld? or am I misreading it? > > > I quote from one such source : > > https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/simple-commands.html > > > ===============================================> INPUT(file, file, ?), INPUT(file file ?) > > The INPUT command directs the linker to include the named files in > the link, as though they were named on the command line. > > For example, if you always want to include subr.o any time you do > a link, but you can't be bothered to put it on every link command > line, then you can put INPUT (subr.o) in your linker script. > > In fact, if you like, you can list all of your input files in the > linker script, and then invoke the linker with nothing but a -T > option. > > In case a /sysroot prefix/ is configured, and the filename starts > with the / character, and the script being processed was located > inside the /sysroot prefix/, the filename will be looked for in > the /sysroot prefix/. Otherwise, the linker will try to open the > file in the current directory. If it is not found, the linker will > search through the archive library search path. See the > description of -L in Section 3.1 /Command Line Options/ > <https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/invocation.html#OPTIONS>. > > > If you use INPUT (-lfile), ld will transform the name to > libfile.a, as with the command line argument -l. > > When you use the INPUT command in an implicit linker script, the > files will be included in the link at the point at which the > linker script file is included. This can affect archive searching. > > GROUP(file, file, ?), GROUP(file file ?) > > The GROUP command is like INPUT, except that the named files > should all be archives, and they are searched repeatedly until no > new undefined references are created. > > ========================================> > > _______________________________________________ > freebsd-current at freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to > "freebsd-current-unsubscribe at freebsd.org" > >