https://sourceware.org/bugzilla/show_bug.cgi?id=19327
Bug ID: 19327 Summary: [AArch64] ld should issue an error if a shared library is built from a non-PIC object Product: binutils Version: 2.27 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: ikudrin.dev at gmail dot com Target Milestone: --- On host (Ubuntu 15.10, x86_64): $ cat d.c int d = 5; int f() { return d; } $ cat m.c #include <stdio.h> int d = 42; int f(); int main() { printf("%d\n", f()); return 0; } $ aarch64-linux-gnu-gcc -c d.c -o d.nopic.o $ ld.git -shared d.nopic.o -o d.ld.nopic.so $ aarch64-linux-gnu-gcc m.c ./d.ld.nopic.so -o r.ld.nopic $ aarch64-linux-gnu-gcc -c d.c -o d.pic.o -fPIC $ ld.git -shared d.pic.o -o d.ld.pic.so $ aarch64-linux-gnu-gcc m.c ./d.ld.pic.so -o r.ld.pic Note: ld.git is just built from git sources. On VM with AArch64 Debian: $ ./r.ld.nopic 5 $ ./r.ld.pic 42 Expected bahavior: should report an error similar to other targets: $ gcc -c d.c -o d.nopic.o $ ld -shared d.nopic.o -o d.nopic.so ld: d.nopic.o: relocation R_X86_64_PC32 against symbol `d' can not be used when making a shared object; recompile with -fPIC -- 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