Ld/testsuite: Add comprehensive PE COFF weak external tests
Adds a comprehensive test suite for PE COFF weak externals to cover various interactions between weak and strong symbols.
This patch adds a comprehensive test suite for PE COFF weak externals, covering the matrix of interactions between weak and strong symbols. The tests are based on existing testcases by Martin Storsjo. These tests aim to ensure correct linker behavior when dealing with weak symbols in PE COFF objects.
- proposer
Adds tests for PE COFF weak externals covering normal, weak-undef, weak-defined, weak-decl-weak-def, weak-use, weak-override, weak-duplicate, weak-def-override, and weak-def-use scenarios.
“Add tests covering the full matrix of weak/strong symbol interactions for PE COFF weak externals, based on testcases by Martin Storsjo.”
In Details
Adds ld-pe/pe-compile.exp which compiles source files, links via gcc, and runs the linked binary natively (if possible). Adds new testcases to ld-pe to increase test coverage of weak symbols.
For Context
This patch adds tests for the linker (ld) when handling PE COFF files, a common format for executables and object code on Windows. The tests focus on 'weak symbols,' which are optional symbol definitions that the linker may or may not include in the final executable. These tests ensure that the linker correctly handles different scenarios involving weak symbols, such as when a weak symbol is defined, undefined, or overridden by a strong symbol. These tests prevent unexpected behavior or errors when linking code that uses weak symbols in PE COFF format.