https://sourceware.org/bugzilla/show_bug.cgi?id=24218
            Bug ID: 24218
           Summary: [2.32 Regression] ld.bfd fails to link shared library
                    built by clang (x86_64)
           Product: binutils
           Version: 2.32
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: doko at debian dot org
  Target Milestone: ---

seen when using ld.bfd 2.32 with clang 7 or 8, works with GCC:

# Segfault https://bugs.llvm.org/show_bug.cgi?id=26580
echo '
extern int a;
extern void bar (void);
int main() {
  bar ();
  if (a != 30)
    __builtin_abort();
  return 0;
}' > x.c

echo 'int a;
__attribute__((visibility("protected"))) int a;
void bar () {
  a = 30;
}
' > bar.c

# reported in https://bugs.llvm.org/show_bug.cgi?id=26580#c18
if [ $DEB_HOST_ARCH != "i386" ]; then
    clang-$VERSION -O3 -c -o x.o x.c
    clang-$VERSION -O3 -fpic -c -o bar.o bar.c
    clang-$VERSION -fuse-ld=bfd -shared -o libfoo.so bar.o
    clang-$VERSION -fuse-ld=bfd -o y x.o libfoo.so -Wl,-R,.
    # Still failing, commenting
    ./y || true
fi
/usr/bin/ld.bfd: bar.o: relocation R_X86_64_PC32 against protected symbol `a'
can not be used when making a shared object
/usr/bin/ld.bfd: final link failed: nonrepresentable section on output
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The failing command is:
    clang-$VERSION -fuse-ld=bfd -shared -o libfoo.so bar.o

-- 
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

Reply via email to