Bug 17458 - Symbol that normally exported from a binary reported as PREVAILING_DEF_IRONLY to a plugin
Summary: Symbol that normally exported from a binary reported as PREVAILING_DEF_IRONLY...
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-06 14:09 UTC by Rafael Ávila de Espíndola
Modified: 2014-10-06 14:09 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
testcase (489 bytes, application/x-tar)
2014-10-06 14:09 UTC, Rafael Ávila de Espíndola
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Ávila de Espíndola 2014-10-06 14:09:51 UTC
Created attachment 7814 [details]
testcase

The attached testcase has a run.sh script. Running it on my machine prints

     9: 0000000000400508     0 FUNC    GLOBAL DEFAULT   11 _init
    11: 00000000004006d4     0 FUNC    GLOBAL DEFAULT   14 _fini

     6: 000000000040064d     6 FUNC    GLOBAL DEFAULT   13 bar
     9: 0000000000400508     0 FUNC    GLOBAL DEFAULT   11 _init
    11: 00000000004006d4     0 FUNC    GLOBAL DEFAULT   14 _fini

The first run is using lto and the symbol bar is reported as PREVAILING_DEF_IRONLY which causes the plugin to drop it.

On the second run -flto is not used and the linker keeps it in the main binary. When the program is executed, that is the symbol the dynamic linker will use.

The testcase is sensitive to the versions used. If the commented line in the script is removed, the main binary symbol will have the same version as the one in the shared library and it is kept.

It looks like all symbols of a given name are kept in the symbol table even if one with a preferred version is found. It is not clear if this is a bug or if the bug is telling the plugin the symbol is IRONLY.

This is a reduced testcase from trying to override operator delete in the main binary.

The same issue is present with gnu ld.