[Top][All Lists]

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

[Bug gold/28494] New: gold combines different aligned/padded SHT_NOTE se

From: mark at klomp dot org
Subject: [Bug gold/28494] New: gold combines different aligned/padded SHT_NOTE sections in the same PT_NOTE segment
Date: Mon, 25 Oct 2021 12:04:43 +0000


            Bug ID: 28494
           Summary: gold combines different aligned/padded SHT_NOTE
                    sections in the same PT_NOTE segment
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: mark at klomp dot org
                CC: ian at airs dot com, mliska at suse dot cz
  Target Milestone: ---

Minimal reproducer:

$ echo 'main() { return 0; }' | gcc -x c - -fuse-ld=gold && ./elflint --gnu-ld
<stdin>:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
phdr[6]: unknown object file note type 32 with owner name '' at offset 48
phdr[6]: extra 72 bytes after last note

$ ld.gold --version
GNU gold (GNU Binutils; openSUSE Tumbleweed 2.37.20210803-1) 1.16

$ eu-readelf -l a.out
Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz
  Flg Align
  PHDR           0x000040 0x0000000000400040 0x0000000000400040 0x000230
0x000230 R   0x8
  INTERP         0x000270 0x0000000000400270 0x0000000000400270 0x00001c
0x00001c R   0x1
        [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  LOAD           0x000000 0x0000000000400000 0x0000000000400000 0x000688
0x000688 R E 0x1000
  LOAD           0x000e08 0x0000000000401e08 0x0000000000401e08 0x000208
0x000209 RW  0x1000
  DYNAMIC        0x000e18 0x0000000000401e18 0x0000000000401e18 0x0001b0
0x0001b0 RW  0x8
  NOTE           0x0002b0 0x00000000004002b0 0x00000000004002b0 0x000030
0x000030 R   0x8
  NOTE           0x00028c 0x000000000040028c 0x000000000040028c 0x000078
0x000078 R   0x4
  GNU_EH_FRAME   0x000664 0x0000000000400664 0x0000000000400664 0x000024
0x000024 R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW  0x10
  GNU_RELRO      0x000e08 0x0000000000401e08 0x0000000000401e08 0x0001f8
0x0001f8 RW  0x8

 Section to Segment mapping:
  Segment Sections...
   01      [RO: .interp]
   02      [RO: .interp .note.ABI-tag .note.gnu.property .note.gnu.build-id
.dynsym .dynstr .gnu.hash .hash .gnu.version .gnu.version_r .rela.dyn .init
.text .fini .rodata .eh_frame .eh_frame_hdr]
   03      [RELRO: .fini_array .init_array .dynamic .got .got.plt] .data .bss
   04      [RELRO: .dynamic]
   05      [RO: .note.gnu.property]
   06      [RO: .note.ABI-tag .note.gnu.property .note.gnu.build-id]
   07      [RO: .eh_frame_hdr]
   09      [RELRO: .fini_array .init_array .dynamic .got .got.plt]


  05      [RO: .note.gnu.property]
  06      [RO: .note.ABI-tag .note.gnu.property .note.gnu.build-id]

Both segment 05 and segment 06 cover .note.gnu.property, and segment 06 mixes
notes using alignment 8 (causing different padding) and alignment 4
(.note.gnu.property is sandwiched between .note.ABI-tag and

This makes it impossible to properly parse the second PT_NOTE segment.

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

reply via email to

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