[PATCH] elf: Don't set version info on unversioned symbols

H.J. Lu hjl.tools@gmail.com
Sat Sep 18 23:08:34 GMT 2021


On Sat, Sep 18, 2021 at 11:04 AM Fangrui Song <i@maskray.me> wrote:
>
> On 2021-09-18, H.J. Lu via Binutils wrote:
> >Don't set version info on unversioned symbols when seeing a hidden
> >versioned symbol after an unversioned definition and the default
> >versioned symbol.
> >
> >bfd/
> >
> >       PR ld/28348
> >       * elflink.c (elf_link_add_object_symbols): Don't set version info
> >       on unversioned symbols.
> >
> >ld/
> >
> >       PR ld/28348
> >       * testsuite/ld-elf/pr28348.rd: New file.
> >       * testsuite/ld-elf/pr28348.t: Likewise.
> >       * testsuite/ld-elf/pr28348a.c: Likewise.
> >       * testsuite/ld-elf/pr28348b.c: Likewise.
> >       * testsuite/ld-elf/pr28348c.c: Likewise.
> >       * testsuite/ld-elf/shared.exp: Run PR ld/28348 test.
>
> I don't find <corrupt> in readelf --dyn-syms output by linking pr28348c.o libpr28348a.so libpr28348b.so with old ld.

Did you apply my patch to run the test? It failed for me without my fix.

> Does the test case reflect the bug?

Yes.  Here is the v2 patch to build tmpdir/pr28348 as executable instead of
shared library,

> BTW, does libpr28348a.so intend to use a version script?

Yes.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v2-0001-elf-Don-t-set-version-info-on-unversioned-symbols.patch
Type: text/x-patch
Size: 4508 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20210918/6a359663/attachment-0001.bin>


More information about the Binutils mailing list