Darwin test suite now tolerates undefined symbols in pr97172-2.
GCC's test suite for Darwin now allows undefined symbols in the pr97172-2 test case to prevent spurious failures caused by the linker's default behavior.
The GCC test suite for Darwin has been updated to address a specific issue with the pr97172-2 test case. Darwin’s linker, by default, reports errors for undefined symbols, which was causing this particular test to fail incorrectly. The change modifies the test to allow undefined symbols, treating them as dynamically looked-up and resolving the spurious test failure without affecting the underlying correctness being tested.
In Details
This commit addresses a test suite issue on Darwin platforms within gcc.dg/pr97172-2.c. Darwin's ld linker defaults to a strict mode where undefined symbols are considered errors, which was causing an irrelevant test failure. The fix modifies the test case to explicitly permit undefined symbols at link-time. This effectively signals to the linker that these symbols are expected to be resolved dynamically at runtime, bypassing the spurious link error and allowing the test to correctly assess the compiler feature it targets.
For Context
When you compile a program, the compiler translates your source code into machine code. Then, a program called a 'linker' brings together all the different pieces of your code, along with any libraries it needs, to create a final executable. Sometimes, a program might refer to symbols (like function names or variable names) that aren't defined within its own code but are expected to be provided by other libraries at runtime. On some operating systems, like Darwin (macOS), the linker is very strict and will flag these 'undefined symbols' as errors by default, even if they are meant to be resolved later. This change fixes a specific test case within the GCC compiler's own testing suite that was failing on Darwin not because of a bug in GCC, but because the linker was being too strict. The fix tells the linker to be more lenient for this particular test, allowing it to complete successfully and accurately verify GCC's functionality.