bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

binutils as sparc/setx issue


From: Dullfire
Subject: binutils as sparc/setx issue
Date: Wed, 18 May 2022 05:24:45 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0


It appears that binutils as for sparc(64) is emitting incorrect relocations for 
some case of 'setx'
for example
```


 % echo 'setx _data, %g7, %g4' | sparc64-misc-linux-gnu-as -KPIC -o 
/tmp/test-sparc64.o

 % sparc64-misc-linux-gnu-objdump -rD /tmp/test-sparc64.o



/tmp/test-sparc64.o:     file format elf64-sparc





Disassembly of section .text:



0000000000000000 <.text>:

   0:   0f 00 00 00     sethi  %hi(0), %g7

                        0: R_SPARC_HH22 _data

   4:   09 00 00 00     sethi  %hi(0), %g4

                        4: R_SPARC_LM22 _data

   8:   8e 11 e0 00     mov  %g7, %g7

                        8: R_SPARC_HM10 _data

   c:   88 11 20 00     mov  %g4, %g4

                        c: R_SPARC_GOT10        _data

  10:   8f 29 f0 20     sllx  %g7, 0x20, %g7

  14:   88 11 00 07     or  %g4, %g7, %g4


```
This relocation set will give bits [63:10] of the symbol address, and bits[9:0] 
of the got entry. Which is probably never the desired result.
I have observed this on both 2.37 and 
master(85aaf32e610e01ccde008e5bbfd6df95558dbeae).


Thanks,

Jonathan Currier


reply via email to

[Prev in Thread] Current Thread [Next in Thread]