s390: Add linker tests for references in discarded sections
Author withdraws a patch to add s390 linker tests, as the issue it addresses is being fixed by a new patch that ports a general fix from x86.
Jens Remus explains that a patch intended to add linker tests for references in discarded sections on s390 is being withdrawn. He initially created the tests to document an assertion failure related to PIE and discarded sections. However, he discovered that the underlying issue is not specific to DT_RELR or s390 but is a general problem also seen on x86 and RISC-V. A new patch, which ports the x86-64 fix for this issue to s390, has been submitted.
- proposer
Explains that a patch adding s390 linker tests for discarded sections is being withdrawn because a more general fix is being submitted.
“Meanwhile I realized that I should have done better research: This started out as porting the aarch64 relr-discard-* tests for my WIP s390 support for DT_RELR, where the PIE test ran into the assertion. ... The tests from this patch are now part of my new patch that ports the x86-64 fix, that I just sent for review:”
- reviewer
Provided feedback on the patch, suggesting minor improvements to the test cases.
“Just two minor nits. Feel free to ignore: - discard-pie.d doesn't seem to include the expected output. So it would not turn into an XPASS automatically in case the problem goes away, right? - Should we, in discard-shared.d, document that the outcome is not what we want but rather what it is today?”
Technical Tradeoffs
- The original patch added specific tests, but a more general fix for the underlying issue is being applied, making the original tests redundant. This is a tradeoff between specific bug reproduction and implementing a robust, general solution.
In Details
The original patch aimed to add linker test cases for s390 concerning references to symbols within discarded sections, particularly when linking position-independent executables (PIE). An assertion in finish_dynamic_symbol was triggered due to GOT entries being allocated but not initialized when sections were discarded. This follow-up clarifies that the tests are being superseded by a patch that implements a more general fix, ported from x86-64, which also addresses the assertion by correctly handling symbol dynamic-ness.
- s390
- IBM's mainframe processor architecture.
- linker
- A program that combines various object files and libraries into a single executable or library. It resolves symbol references and assigns addresses.
- discarded sections
- Sections of an object file that the linker decides to omit from the final executable, typically because they are empty or contain data/code not required for execution.
- PIE
- Position-Independent Executable. An executable program that can be loaded and run at any memory address. This is important for security features like Address Space Layout Randomization (ASLR).
- GOT
- Global Offset Table. A table used in position-independent code to store addresses of global variables and functions, allowing indirect access.
- Assertion
- A statement in a program that must be true at a certain point. If the assertion fails, the program typically terminates, indicating a bug.