[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/16963] New: SEARCH_DIR missing for some targets without sysroot

From: hp at sourceware dot org
Subject: [Bug ld/16963] New: SEARCH_DIR missing for some targets without sysroot since genscript.sh cleanup (0f70b6b)
Date: Mon, 19 May 2014 22:06:15 +0000


            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:

warning: librt.so.1, needed by ./libnsec.so, not found (try using -rpath or
./libnsec.so: undefined reference to address@hidden'
collect2: error: ld returned 1 exit status
make: *** [prog] Error 1

using this code:

#include <stdio.h>
extern int nsec(void);
int main(void)
  printf ("Time runs: %d\n", nsec());

#include <time.h>
#include <unistd.h>
#error "Sorry, wrong system"
int nsec (void)
  struct timespec ts;
  if (clock_gettime (CLOCK_MONOTONIC, &ts) != 0)
    return -1;
  return ts.tv_nsec;

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

        -rm *.o *.so prog

You are receiving this mail because:
You are on the CC list for the bug.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]