[llvm-bugs] [Bug 40770] New: lld error message for undefined symbol lacks information about visibility

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 18 21:41:35 PST 2019


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

            Bug ID: 40770
           Summary: lld error message for undefined symbol lacks
                    information about visibility
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mh+llvm at glandium.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

```
$ cat foo.c
__attribute__((visibility("hidden"))) void* getdate(char*);

void* foo(char* s) {
    return getdate(s);
}
$ clang -fuse-ld=lld -shared -fPIC foo.c -o foo.so 
ld.lld: error: undefined symbol: getdate
>>> referenced by foo.c
>>>               /tmp/foo-717a38.o:(foo)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

GNU ld.bfd and gold both report the fact the symbol is hidden in their error
message:
```
$ clang-7 -fuse-ld=ld -shared -fPIC foo.c -o foo.so 
/usr/bin/ld: /tmp/foo-8f3391.o: in function `foo':
foo.c:(.text+0x11): undefined reference to `getdate'
/usr/bin/ld: foo.so: hidden symbol `getdate' isn't defined
/usr/bin/ld: final link failed: bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ LANG=C clang-7 -fuse-ld=gold -shared -fPIC foo.c -o foo.so 
/usr/bin/ld.gold: error: hidden symbol 'getdate' is not defined locally
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

-- 
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/20190219/773d0723/attachment.html>


More information about the llvm-bugs mailing list