[binutils-gdb] ld: Use 0x10000 as absolute symbol value in PR ld/25754 tests

H.J. Lu hjl@sourceware.org
Thu Jun 18 23:22:25 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7d89a51645d8592b065bbd47ebd4d032c9196708

commit 7d89a51645d8592b065bbd47ebd4d032c9196708
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jun 18 19:57:20 2026 +0800

    ld: Use 0x10000 as absolute symbol value in PR ld/25754 tests
    
    PR ld/25754 tests verify that relocations against absolute symbol are
    properly handled, using 42 as the absolute symbol value.  But GCC 17
    treats 42 as the impossible symbol address, which is the absolute symbol
    value and optimize out the symbol address check:
    
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125869
    
    Use 0x10000, instead of 42, as absolute symbol value to work with GCC 17.
    
            PR ld/34298
            * testsuite/ld-elf/pr25754-1a.c (main): Check against 0x10000
            instead of 42.
            * testsuite/ld-elf/pr25754-1b.s (bar): Replace 42 with 0x10000.
    
    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 ld/testsuite/ld-elf/pr25754-1a.c | 2 +-
 ld/testsuite/ld-elf/pr25754-1b.s | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ld/testsuite/ld-elf/pr25754-1a.c b/ld/testsuite/ld-elf/pr25754-1a.c
index bc65c174d05..30b7195cbb3 100644
--- a/ld/testsuite/ld-elf/pr25754-1a.c
+++ b/ld/testsuite/ld-elf/pr25754-1a.c
@@ -13,7 +13,7 @@ get_bar (void)
 int
 main ()
 {
-  if ((uintptr_t) get_bar () == 42)
+  if ((uintptr_t) get_bar () == 0x10000)
     printf ("PASS\n");
   return 0;
 }
diff --git a/ld/testsuite/ld-elf/pr25754-1b.s b/ld/testsuite/ld-elf/pr25754-1b.s
index 99d585d6b5f..1babb39d49c 100644
--- a/ld/testsuite/ld-elf/pr25754-1b.s
+++ b/ld/testsuite/ld-elf/pr25754-1b.s
@@ -1,3 +1,3 @@
 	.data
 	.global bar
-	bar = 42
+	bar = 0x10000


More information about the Binutils-cvs mailing list