]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
ld: Add an LTO test for common symbol override
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 14 Aug 2024 15:29:15 +0000 (08:29 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 22 Aug 2024 13:54:58 +0000 (06:54 -0700)
commitd16a1893c44f1b270c8298361dacbb768d3bfbfb
tree69f1e6b4e44eb8293b77d1d78bb81a15e2020e85
parent5824c288c9c37aafc0e9b946e507429b1e8b3fef
ld: Add an LTO test for common symbol override

Linker checks if a symbol in an archive member is a real definition, not
common, before including the archive member in the link output so that
only a real definition in archive will override the common symbol in
object file.  Add an LTO test to verify that a real definition in archive
overrides the common symbol in object file.

* testsuite/ld-plugin/common-1.c: New file.
* testsuite/ld-plugin/definition-1.c: Likewise.
* testsuite/ld-plugin/lto.exp: Run common tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 8be33827cdc57fd7c31e84966f3c445b986be4ff)
ld/testsuite/ld-plugin/common-1.c [new file with mode: 0644]
ld/testsuite/ld-plugin/definition-1.c [new file with mode: 0644]
ld/testsuite/ld-plugin/lto.exp