[llvm-bugs] [Bug 34058] missing error on reference to undefined weak symbol

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 22 20:19:07 PDT 2019


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

Fangrui Song <i at maskray.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |i at maskray.me
             Status|NEW                         |RESOLVED

--- Comment #1 from Fangrui Song <i at maskray.me> ---
leaq    foo(%rip), %rax # R_X86_64_PC32
movabsq $foo-., %rax    # R_X86_64_PC64
.weak foo
.hidden foo

The idea was implemented in D19844/r268350. Note, ld.bfd/gold error on
R_X86_64_PC32:

% ld.bfd a.o -shared -o a
ld.bfd: a.o: relocation R_X86_64_PC32 against undefined hidden symbol `foo' can
not be used when making a shared object
ld.bfd: final link failed: Bad value
% gold a.o -shared -o a
gold: error: a.o: requires dynamic R_X86_64_PC32 reloc against 'foo' which may
overflow at runtime; recompile with -fPIC

The error is bogus as this should be fine if the link-time address is smaller
than 0x80000000.

% ld.lld a.o -shared -o a
% ld.lld a.o -shared -o a -Ttext=0x80000000
ld.lld: error: a.o:(.text+0x3): relocation R_X86_64_PC32 out of range:
-2147483655 is not in [-2147483648, 2147483647]

-- 
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/55463fb4/attachment.html>


More information about the llvm-bugs mailing list