[llvm-bugs] [Bug 35929] lld unable to link compiler-rt on aarch64 (hwasan)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 22 19:43:53 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=35929

Fangrui Song <i at maskray.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |i at maskray.me
         Resolution|---                         |WORKSFORME
             Status|CONFIRMED                   |RESOLVED

--- Comment #5 from Fangrui Song <i at maskray.me> ---
https://bugs.llvm.org/show_bug.cgi?id=35931 has been fixed.

With -shared,
neither ld.bfd nor gold allows R_X86_64_PC32 (not link-time constant, not
dynamic relocation) against the preemptable symbol 'func'. So is it obsoleted?

x86_64:
% clang -fuse-ld=bfd a.c --shared -fPIE -ffunction-sections -Wl,-znotext        
/usr/bin/ld.bfd: /tmp/a-ce6897.o: relocation R_X86_64_PC32 against symbol
`func' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld.bfd: final link failed: Bad value
clang-9: error: linker command failed with exit code 1 (use -v to see
invocation)

aarch64:
% ld.lld -shared a.o -o a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against
symbol func; recompile with -fPIC
>>> defined in a.o
>>> referenced by a.c
>>>               a.o:(func2)

ld.lld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC
against symbol: func in readonly segment; recompile object files with -fPIC or
pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in a.o
>>> referenced by a.c
>>>               a.o:(func2)

% ./ld-new -shared a.o -o a                                 
./ld-new: a.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `func'
which may bind externally can not be used when making a shared object;
recompile with -fPIC
a.o: in function `func2':
a.c:(.text.func2+0x0): dangerous relocation: unsupported relocation

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190523/18031766/attachment.html>


More information about the llvm-bugs mailing list