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

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 3 15:24:01 PDT 2017


            Bug ID: 34058
           Summary: missing error on reference to undefined weak symbol
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: llvm-bugs at lists.llvm.org

bfd ld with -shared will produce an error on

leaq    foo(%rip), %rax
.weak foo
.hidden foo

That is reasonable. The value of foo is zero, and we will not be able to
compute that a runtime. The intention of the leaq was probably to check the
value of foo in the first place.

The problem is that it should *not* produce an error if the leaq is replaced
with a call. The logic being that the call will be guarded:

if (foo)

Unfortunately, on x86_64 at least, both constructs produce the same relocation.
It just seems too fuzzy to have the linker parse the instruction using the

I am reporting the bug in case someone has a better idea on how to implement
this or if some other architecture does have different relocations.

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/20170803/a3da573f/attachment.html>

More information about the llvm-bugs mailing list