https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85801

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think this is valid from an ELF perspective.  But ca you really expect
char *progname to resolve to the library copy?  In fact the linker resolution
here is

1
t2.o 4
207 b42c927210240321 PREVAILING_DEF main
349 b42c927210240321 PREVAILING_DEF_IRONLY_EXP progname
351 b42c927210240321 RESOLVED_DYN stderr
347 b42c927210240321 UNDEF my_name

and thus it correctly(?) resolves to a non-exported local copy
(GNU ld 2.30 branch).  Note that without --as-needed I get

1
t2.o 4
207 226c604d5f4407d9 PREVAILING_DEF main
349 226c604d5f4407d9 RESOLVED_DYN progname
351 226c604d5f4407d9 RESOLVED_DYN stderr
347 226c604d5f4407d9 RESOLVED_DYN my_name

so I think this points to a GNU ld bug (and gold behaves the same).

HJ?  I think for the purpose of generating the resolution we have to
ignore --as-needed?

Reply via email to