Bug 25135 - Cannot link because of ".dynsym local symbol at index"
Summary: Cannot link because of ".dynsym local symbol at index"
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.33
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-26 14:12 UTC by Benjamin
Modified: 2019-10-28 00:55 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin 2019-10-26 14:12:22 UTC
After migrating from Ubuntu 19.04 to 19.10 I encounter the following errors when trying to link against `libQt5WebKit.so` or `libQt5WebKitWidgets.so` (from official qt.io release package):

> /usr/bin/ld: /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKitWidgets.so: .dynsym local symbol at index 2 (>= sh_info of 2)
> /usr/bin/ld: /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKitWidgets.so: .dynsym local symbol at index 3 (>= sh_info of 2)
> /usr/bin/ld: /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKitWidgets.so: .dynsym local symbol at index 4 (>= sh_info of 2)
> /usr/bin/ld: /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKit.so: .dynsym local symbol at index 2 (>= sh_info of 2)
> /usr/bin/ld: /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKit.so: .dynsym local symbol at index 3 (>= sh_info of 2)
> /usr/bin/ld: /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKit.so: .dynsym local symbol at index 4 (>= sh_info of 2)

Using the gold linker (-fuse-ld=gold) works fine without error or warning.
Using the lld linker (-fuse-ld=lld) works, but gives warnings: 

> ld.lld: warning: found local symbol '__bss_start' in global part of symbol table in file /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKitWidgets.so
> ld.lld: warning: found local symbol '_end' in global part of symbol table in file /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKitWidgets.so
> ld.lld: warning: found local symbol '_edata' in global part of symbol table in file /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKitWidgets.so
> ld.lld: warning: found local symbol '_end' in global part of symbol table in file /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKit.so
> ld.lld: warning: found local symbol '__bss_start' in global part of symbol table in file /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKit.so
> ld.lld: warning: found local symbol '_edata' in global part of symbol table in file /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5WebKit.so

The error is generated in `elflink.c`: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elflink.c;h=9d7f69afda52472bfc63b783d60053cecb386452;hb=HEAD#l4494

Since these libraries were working with previous versions of binutils and are working with either gold and lld, I would expect to be able to link against them using ld.
Comment 1 Alan Modra 2019-10-26 23:07:06 UTC
This has already been fixed on the 2.33 branch.

*** This bug has been marked as a duplicate of bug 24857 ***
Comment 2 Benjamin 2019-10-27 07:59:16 UTC
The commit that fixes bug 24857 if from July: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0231a51ef7ff49336d3a2f0e4eec09cd17b23c95

Tags binutils-2_33 and binutils-2_33_1 both contain this commit.

I tested with versions binutils 2.33 (from eoan) and binutils 2.33.1 (from devel).
I still have the issue with both versions.
Comment 3 Alan Modra 2019-10-27 12:34:19 UTC
I fail to see what you're complaining about then.  The message doesn't say "warning", but that is what it is when reported for a shared library.  Linking should complete successfully despite the warning unless you pass --fatal-warnings to the linker.
Comment 4 Benjamin 2019-10-27 13:17:48 UTC
(In reply to Alan Modra from comment #3)
> I fail to see what you're complaining about then.  The message doesn't say
> "warning", but that is what it is when reported for a shared library. 
> Linking should complete successfully despite the warning unless you pass
> --fatal-warnings to the linker.

After further inspection the linking does complete and g++ output status is 0.

For some reason it is the tools that I am using (IDE and others) that understand this as an error (not warning) and report a build failure...

Thank you for your time.
Comment 5 Benjamin 2019-10-27 13:39:03 UTC
Would it be possible to add "warning:" to the error message? Pretty much like what is done with the lld messages.

Looking at your code base it seems that it is what is usually done and it would allow external tools to detect it as warnings, not errors.
Comment 6 Alan Modra 2019-10-28 00:55:53 UTC
There are many warnings that don't contain the word "warning".  There are even errors that contain the word "warning".  If you would like to correct this, please audit the source for this sort of problem and submit patches to binutils@sourceware.org.  A patch just fixing this one warning isn't very useful.