This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gold: Properly align the NT_GNU_PROPERTY_TYPE_0 note


On Thu, Aug 16, 2018 at 11:49 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 08/16/2018 07:46 PM, H.J. Lu wrote:
>>
>> +  // The NT_GNU_PROPERTY_TYPE_0 note conforms to gABI.
>> +  const int align_size
>> +    = ((note_type == elfcpp::NT_GNU_PROPERTY_TYPE_0)
>> +       ? parameters->target().get_size()
>> +       : size);
>
>
> Shouldn't the segment alignment be the same as the section alignment?

It should.  But gold doesn't do that.  If you pass --build-id to gold,
it will put
2 note sections with different alignments into the same NOTE segment:

[hjl@gnu-cfl-1 gold]$ ./ld-new x.o --build-id
[hjl@gnu-cfl-1 gold]$ readelf -l a.out

Elf file type is EXEC (Executable file)
Entry point 0x400174
There are 4 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x00000000000001b8 0x00000000000001b8  R E    0x1000
  LOAD           0x0000000000001000 0x0000000000401000 0x0000000000401000
                 0x0000000000000000 0x0000000000000000  RW     0x1000
  NOTE           0x0000000000000120 0x0000000000400120 0x0000000000400120
                 0x0000000000000054 0x0000000000000054  R      0x8
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10

 Section to Segment mapping:
  Segment Sections...
   00     .note.gnu.property .note.gnu.build-id .text .eh_frame
   01     .data .bss
   02     .note.gnu.property .note.gnu.build-id
   03
[hjl@gnu-cfl-1 gold]$


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]