x86-64: correct CODE_5 relocs

Message ID 180a41de-760c-4f7c-918d-1633ae388696@suse.com
State New
Headers
Series x86-64: correct CODE_5 relocs |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Jan Beulich Dec. 16, 2024, 8:49 a.m. UTC
  Two of them had their numbers swapped; luckily they aren't really in use
just yet. Correct indentation as well while at it.
  

Comments

H.J. Lu Dec. 16, 2024, 9:29 p.m. UTC | #1
On Mon, Dec 16, 2024 at 4:49 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> Two of them had their numbers swapped; luckily they aren't really in use
> just yet. Correct indentation as well while at it.
>
> --- a/include/elf/x86-64.h
> +++ b/include/elf/x86-64.h
> @@ -96,18 +96,18 @@ START_RELOC_NUMBERS (elf_x86_64_reloc_ty
>         instruction starts at 5 bytes before the relocation offset,
>         relaxable.  */
>       RELOC_NUMBER (R_X86_64_CODE_5_GOTPCRELX, 46)
> +     /* PC relative offset to IE GOT entry if the instruction starts at
> +        5 bytes before the relocation offset.  */
> +     RELOC_NUMBER (R_X86_64_CODE_5_GOTTPOFF, 47)
>       /* 32 bit signed pc relative offset to TLS descriptor in the GOT if
>         instruction starts at 5 bytes before the relocation offset.  */
> -     RELOC_NUMBER (R_X86_64_CODE_5_GOTPC32_TLSDESC, 47)
> -    /* PC relative offset to IE GOT entry if the instruction starts at
> -       5 bytes before the relocation offset.  */
> -     RELOC_NUMBER (R_X86_64_CODE_5_GOTTPOFF, 48)
> +     RELOC_NUMBER (R_X86_64_CODE_5_GOTPC32_TLSDESC, 48)
>       /* Load from 32 bit signed pc relative offset to GOT entry if the
>         instruction starts at 6 bytes before the relocation offset,
>         relaxable.  */
>       RELOC_NUMBER (R_X86_64_CODE_6_GOTPCRELX, 49)
> -    /* PC relative offset to IE GOT entry if the instruction starts at
> -       6 bytes before the relocation offset.  */
> +     /* PC relative offset to IE GOT entry if the instruction starts at
> +        6 bytes before the relocation offset.  */
>       RELOC_NUMBER (R_X86_64_CODE_6_GOTTPOFF, 50)
>       /* 32 bit signed pc relative offset to TLS descriptor in the GOT if
>         instruction starts at 6 bytes before the relocation offset.  */

Should it be backported to release branches?

Thanks.
  
Jan Beulich Dec. 17, 2024, 8:03 a.m. UTC | #2
On 16.12.2024 22:29, H.J. Lu wrote:
> On Mon, Dec 16, 2024 at 4:49 PM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> Two of them had their numbers swapped; luckily they aren't really in use
>> just yet. Correct indentation as well while at it.
>>
>> --- a/include/elf/x86-64.h
>> +++ b/include/elf/x86-64.h
>> @@ -96,18 +96,18 @@ START_RELOC_NUMBERS (elf_x86_64_reloc_ty
>>         instruction starts at 5 bytes before the relocation offset,
>>         relaxable.  */
>>       RELOC_NUMBER (R_X86_64_CODE_5_GOTPCRELX, 46)
>> +     /* PC relative offset to IE GOT entry if the instruction starts at
>> +        5 bytes before the relocation offset.  */
>> +     RELOC_NUMBER (R_X86_64_CODE_5_GOTTPOFF, 47)
>>       /* 32 bit signed pc relative offset to TLS descriptor in the GOT if
>>         instruction starts at 5 bytes before the relocation offset.  */
>> -     RELOC_NUMBER (R_X86_64_CODE_5_GOTPC32_TLSDESC, 47)
>> -    /* PC relative offset to IE GOT entry if the instruction starts at
>> -       5 bytes before the relocation offset.  */
>> -     RELOC_NUMBER (R_X86_64_CODE_5_GOTTPOFF, 48)
>> +     RELOC_NUMBER (R_X86_64_CODE_5_GOTPC32_TLSDESC, 48)
>>       /* Load from 32 bit signed pc relative offset to GOT entry if the
>>         instruction starts at 6 bytes before the relocation offset,
>>         relaxable.  */
>>       RELOC_NUMBER (R_X86_64_CODE_6_GOTPCRELX, 49)
>> -    /* PC relative offset to IE GOT entry if the instruction starts at
>> -       6 bytes before the relocation offset.  */
>> +     /* PC relative offset to IE GOT entry if the instruction starts at
>> +        6 bytes before the relocation offset.  */
>>       RELOC_NUMBER (R_X86_64_CODE_6_GOTTPOFF, 50)
>>       /* 32 bit signed pc relative offset to TLS descriptor in the GOT if
>>         instruction starts at 6 bytes before the relocation offset.  */
> 
> Should it be backported to release branches?

Don't know. The only place they can be used in right now is in .reloc, aiui.
Not sure how many people even know of .reloc.

Jan
  
H.J. Lu Dec. 17, 2024, 8:44 a.m. UTC | #3
On Tue, Dec 17, 2024 at 4:03 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 16.12.2024 22:29, H.J. Lu wrote:
> > On Mon, Dec 16, 2024 at 4:49 PM Jan Beulich <jbeulich@suse.com> wrote:
> >>
> >> Two of them had their numbers swapped; luckily they aren't really in use
> >> just yet. Correct indentation as well while at it.
> >>
> >> --- a/include/elf/x86-64.h
> >> +++ b/include/elf/x86-64.h
> >> @@ -96,18 +96,18 @@ START_RELOC_NUMBERS (elf_x86_64_reloc_ty
> >>         instruction starts at 5 bytes before the relocation offset,
> >>         relaxable.  */
> >>       RELOC_NUMBER (R_X86_64_CODE_5_GOTPCRELX, 46)
> >> +     /* PC relative offset to IE GOT entry if the instruction starts at
> >> +        5 bytes before the relocation offset.  */
> >> +     RELOC_NUMBER (R_X86_64_CODE_5_GOTTPOFF, 47)
> >>       /* 32 bit signed pc relative offset to TLS descriptor in the GOT if
> >>         instruction starts at 5 bytes before the relocation offset.  */
> >> -     RELOC_NUMBER (R_X86_64_CODE_5_GOTPC32_TLSDESC, 47)
> >> -    /* PC relative offset to IE GOT entry if the instruction starts at
> >> -       5 bytes before the relocation offset.  */
> >> -     RELOC_NUMBER (R_X86_64_CODE_5_GOTTPOFF, 48)
> >> +     RELOC_NUMBER (R_X86_64_CODE_5_GOTPC32_TLSDESC, 48)
> >>       /* Load from 32 bit signed pc relative offset to GOT entry if the
> >>         instruction starts at 6 bytes before the relocation offset,
> >>         relaxable.  */
> >>       RELOC_NUMBER (R_X86_64_CODE_6_GOTPCRELX, 49)
> >> -    /* PC relative offset to IE GOT entry if the instruction starts at
> >> -       6 bytes before the relocation offset.  */
> >> +     /* PC relative offset to IE GOT entry if the instruction starts at
> >> +        6 bytes before the relocation offset.  */
> >>       RELOC_NUMBER (R_X86_64_CODE_6_GOTTPOFF, 50)
> >>       /* 32 bit signed pc relative offset to TLS descriptor in the GOT if
> >>         instruction starts at 6 bytes before the relocation offset.  */
> >
> > Should it be backported to release branches?
>
> Don't know. The only place they can be used in right now is in .reloc, aiui.
> Not sure how many people even know of .reloc.
>

I think it should be backported.  Otherwise, master and release
branches aren't consistent.

Thanks.
  

Patch

--- a/include/elf/x86-64.h
+++ b/include/elf/x86-64.h
@@ -96,18 +96,18 @@  START_RELOC_NUMBERS (elf_x86_64_reloc_ty
 	instruction starts at 5 bytes before the relocation offset,
 	relaxable.  */
      RELOC_NUMBER (R_X86_64_CODE_5_GOTPCRELX, 46)
+     /* PC relative offset to IE GOT entry if the instruction starts at
+        5 bytes before the relocation offset.  */
+     RELOC_NUMBER (R_X86_64_CODE_5_GOTTPOFF, 47)
      /* 32 bit signed pc relative offset to TLS descriptor in the GOT if
 	instruction starts at 5 bytes before the relocation offset.  */
-     RELOC_NUMBER (R_X86_64_CODE_5_GOTPC32_TLSDESC, 47)
-    /* PC relative offset to IE GOT entry if the instruction starts at
-       5 bytes before the relocation offset.  */
-     RELOC_NUMBER (R_X86_64_CODE_5_GOTTPOFF, 48)
+     RELOC_NUMBER (R_X86_64_CODE_5_GOTPC32_TLSDESC, 48)
      /* Load from 32 bit signed pc relative offset to GOT entry if the
 	instruction starts at 6 bytes before the relocation offset,
 	relaxable.  */
      RELOC_NUMBER (R_X86_64_CODE_6_GOTPCRELX, 49)
-    /* PC relative offset to IE GOT entry if the instruction starts at
-       6 bytes before the relocation offset.  */
+     /* PC relative offset to IE GOT entry if the instruction starts at
+        6 bytes before the relocation offset.  */
      RELOC_NUMBER (R_X86_64_CODE_6_GOTTPOFF, 50)
      /* 32 bit signed pc relative offset to TLS descriptor in the GOT if
 	instruction starts at 6 bytes before the relocation offset.  */