https://sourceware.org/bugzilla/show_bug.cgi?id=16963
Bug ID: 16963 Summary: SEARCH_DIR missing for some targets without sysroot since genscript.sh cleanup (0f70b6b) Product: binutils Version: 2.25 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: hp at sourceware dot org Commit 0f70b6b was not intended to change the "tdir" for targets without sysroot. However, it removed the default setting when passed as empty to genscript.sh. Unfortunately, many genscript.sh invocations in ld/Makefile accidentally were using a typo'd or plainly wrong tdir-variable (e.g. "$(tdir_cris)" instead of "$(tdir_crislinux)" for the crislinux emulation or "$(tdir_armelf_linux_abi)" instead of "$(tdir_armelf_linux_eabi)", for the armelf_linux_eabi emulation), causing it to be passed as empty. For configurations without --with-sysroot, after commit 0f70b6b this means the corresponding SEARCH_DIR in the linker-script is gone. That this effect was unintended can be seen in the conversation at <http://sourceware.org/ml/binutils/2013-09/msg00009.html>. One effect for targets with dynamic linking and libraries in the intended directory, depending solely on the now missing SEARCH_DIR (no --rpath-link or other pointers to that directory) is that linking with libraries depending on DSOs in this directory causes linker errors. This is a regression since the binutils 2.24 release. For example, for a glibc-based toolchain installation with binutils after commit 0f70b6b, "make prog" shows this error when requiring dynamic linking against the rt library in that directory: /path/to/r101/lib/gcc/crisv32-axis-linux-gnu/4.7.2/../../../../crisv32-axis-linux-gnu/bin/ld: warning: librt.so.1, needed by ./libnsec.so, not found (try using -rpath or -rpath-link) ./libnsec.so: undefined reference to `clock_gettime@GLIBC_2.2' collect2: error: ld returned 1 exit status make: *** [prog] Error 1 using this code: prog.c: #include <stdio.h> extern int nsec(void); int main(void) { printf ("Time runs: %d\n", nsec()); } lib.c: #include <time.h> #include <unistd.h> #if !(defined CLOCK_MONOTONIC && defined _POSIX_MONOTONIC_CLOCK) #error "Sorry, wrong system" #endif int nsec (void) { struct timespec ts; if (clock_gettime (CLOCK_MONOTONIC, &ts) != 0) return -1; return ts.tv_nsec; } Makefile: all: prog libnsec.so prog: prog.c libnsec.so $(CC) -o prog prog.c -lnsec -L. libnsec.so: lib.c $(CC) -fPIC -shared -o libnsec.so lib.c -lrt clean: -rm *.o *.so prog -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils