https://sourceware.org/bugzilla/show_bug.cgi?id=27708

            Bug ID: 27708
           Summary: strip mishandles padding between notes
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Created attachment 13355
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13355&action=edit
gcore-tls-pie.gz

[ Spinoff of PR gdb/27689. ]

Consider exec gcore-tls-pie.

It contains a NOTE segment:
...
Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  ...
  NOTE           0x00000000000002c4 0x00000000000002c4 0x00000000000002c4
                 0x0000000000000078 0x0000000000000078  R      0x4
...
which contains the following sections:
...
   06     .note.ABI-tag .note.gnu.property .note.gnu.build-id 
...

After strip, the MemSiz has changed to 0x74:
...
  NOTE           0x00000000000002c4 0x00000000000002c4 0x00000000000002c4
                 0x0000000000000078 0x0000000000000074  R      0x4
... 
and consequently there's no room anymore for a full .note.gnu.build-id:
...
   06     .note.ABI-tag .note.gnu.property 
...

It looks like the size (0x74) is just computed using the combined sizes
(0x20+0x30+0x24):
...

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  ...
  [ 2] .note.ABI-tag     NOTE             00000000000002c4  000002c4
       0000000000000020  0000000000000000   A       0     0     4
  [ 3] .note.gnu.pr[...] NOTE             00000000000002e8  000002e8
       0000000000000030  0000000000000000   A       0     0     8
  [ 4] .note.gnu.bu[...] NOTE             0000000000000318  00000318
       0000000000000024  0000000000000000   A       0     0     4
  [ 5] .dynsym           DYNSYM           0000000000000340  00000340
...
without taking into account the padding between note.ABI-tag and
.note.gnu.property.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to