lkml.org 
[lkml]   [2022]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 3/5] x86/alternative: record .altinstructions section entity size
From
On 05/04/2022 21.24, Thomas Gleixner wrote:
> On Sun, Mar 13 2022 at 21:05, Alexey Dobriyan wrote:

> That does not matter. M merges any duplications in sections with the
> same [section] name, entity size and flags.
>
> .pushsection .bar "aM" @progbits, 4
> .byte 0x01, 0x02, 0x03, 0x04
> .popsection
>
> .pushsection .bar "aM" @progbits, 4
> .byte 0x01, 0x02, 0x03, 0x04
> .popsection
>
> Will create a section .bar with lenght 4 and the content:
> 0x1,0x2,0x3,0x4
>
> What saves you here is the fact that the altinstruction entries are
> guaranteed to be unique, but that wants a big fat comment.

Actually, I think what saves this is that the linker at least currently
ignores the merge flag for sections with relocations; from binutils
bfd/merge.c:

if ((sec->flags & SEC_RELOC) != 0)
{
/* We aren't prepared to handle relocations in merged sections. */
return true;
}

I do think it is theoretically possible for two altinstruction entries
to end up being identical after relocations have been applied (same
relative offsets to both the .text section and their replacement
instructions).

Rasmus

\
 
 \ /
  Last update: 2022-04-06 13:47    [W:0.071 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site