ld: Add tests for PR ld/32690

Without

commit 230a788eb2
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Feb 18 08:54:06 2025 +1030

    PR32690, assertion failure in lang_size_relro_segment

this test triggers the linker error:

.../ld: internal error .../ld/ldlang.c 6618
collect2: error: ld returned 1 exit status

with GCC 10 or above on x86-64.

	PR ld/32690
	* testsuite/ld-elf/elf.exp: Run PR ld/32690 tests.
	* testsuite/ld-elf/pr32690.h: New file.
	* testsuite/ld-elf/pr32690a.c: Likewise.
	* testsuite/ld-elf/pr32690b.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
This commit is contained in:
H.J. Lu
2025-02-18 12:19:12 +08:00
parent 3bb7d3ea81
commit 1256b9860f
4 changed files with 3456 additions and 0 deletions

View File

@@ -497,6 +497,17 @@ if { [istarget *-*-linux*]
]
}
run_cc_link_tests [list \
[list \
"Build pr32690.so" \
"-shared" \
"-O2 -fPIC" \
{ pr32690b.c } \
{} \
"pr32690.so" \
] \
]
run_ld_link_exec_tests [list \
[list \
"Run mbind2a" \
@@ -516,6 +527,18 @@ if { [istarget *-*-linux*]
"pass.out" \
"-O2 -I../bfd" \
] \
[list \
"Run pr32690" \
"-pie -Wl,-z,now" \
"" \
{ pr32690a.c } \
"pr32690" \
"pass.out" \
"-O2 -fPIE" \
"C" \
{} \
"-Wl,-R,tmpdir tmpdir/pr32690.so" \
] \
]
}

View File

@@ -0,0 +1,17 @@
struct data1
{
char c[0x1000];
} __attribute__ ((aligned (128)));
struct data2
{
char c[872];
};
extern const struct data1 d1[];
extern const struct data2 d2;
extern const char c1[];
extern const int var0;
extern const int var1;
extern const int var2;

View File

File diff suppressed because it is too large Load Diff

View File

File diff suppressed because it is too large Load Diff