[binutils-gdb] gold: Force a PC-relative reference to .LC0

H.J. Lu hjl@sourceware.org
Wed Aug 28 12:53:41 GMT 2024


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

commit a2776c438c644e50454b0e4ec91d142d7748589b
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Aug 23 16:02:29 2024 -0700

    gold: Force a PC-relative reference to .LC0
    
    Force a PC-relative reference to .LC0 with:
    
    __asm__ (".dc.a .LC0 - .");
    
    for all targets.
    
    Tested on x86, powerpc64le and aarch64.
    
            * testsuite/discard_locals_relocatable_test.c: Force a PC-relative
            reference to .LC0.
    
    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 gold/testsuite/discard_locals_relocatable_test.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/gold/testsuite/discard_locals_relocatable_test.c b/gold/testsuite/discard_locals_relocatable_test.c
index 0b36069a1d9..98691e9680a 100644
--- a/gold/testsuite/discard_locals_relocatable_test.c
+++ b/gold/testsuite/discard_locals_relocatable_test.c
@@ -31,14 +31,8 @@
    in the output object file. */
 __asm__ (".Lshould_be_discarded:");
 
-#ifdef __powerpc__
 /* Test wants to keep one local.  Satisfy it.  */
-#ifdef __powerpc64__
-__asm__ (".reloc 0,R_PPC64_NONE,.LC0");
-#else
-__asm__ (".reloc 0,R_PPC_NONE,.LC0");
-#endif
-#endif
+__asm__ (".dc.a .LC0 - .");
 
 extern void print_func (const char* s);


More information about the Binutils-cvs mailing list