bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/31216] New: On aarch64 several sections are unnecessarily mapped


From: marcin.godlewski at onet dot pl
Subject: [Bug ld/31216] New: On aarch64 several sections are unnecessarily mapped to segment with executable rights
Date: Fri, 05 Jan 2024 22:18:00 +0000

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

            Bug ID: 31216
           Summary: On aarch64 several sections are unnecessarily mapped
                    to segment with executable rights
           Product: binutils
           Version: 2.38
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: marcin.godlewski at onet dot pl
  Target Milestone: ---

On Ubuntu 22.04 LTS, with GNU ld 2.38 for aarch64 (either native on Ubuntu
arm64 or cross-toolchain on Ubuntu amd64), building a classic 'Hello World"
program produces a binary with the following section to segment mappings:

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz
  Flg Align
  PHDR           0x000040 0x0000000000000040 0x0000000000000040 0x0001f8
0x0001f8 R   0x8
  INTERP         0x000238 0x0000000000000238 0x0000000000000238 0x00001b
0x00001b R   0x1
      [Requesting program interpreter: /lib/ld-linux-aarch64.so.1]
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x000884
0x000884 R E 0x10000
  LOAD           0x000d90 0x0000000000010d90 0x0000000000010d90 0x000280
0x000288 RW  0x10000
  DYNAMIC        0x000da0 0x0000000000010da0 0x0000000000010da0 0x0001f0
0x0001f0 RW  0x8
  NOTE           0x000254 0x0000000000000254 0x0000000000000254 0x000044
0x000044 R   0x4
  GNU_EH_FRAME   0x000798 0x0000000000000798 0x0000000000000798 0x00003c
0x00003c R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW  0x10
  GNU_RELRO      0x000d90 0x0000000000010d90 0x0000000000010d90 0x000270
0x000270 R   0x1

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

The sections: .rodata .interp .note.gnu.build-id .note.ABI-tag .gnu.hash
.dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt seem to be
unnecessarily mapped to executable LOAD segment. Instead, there may be a
separate read-only LOAD segment dedicated for these sections. This is the way
GNU ld behaves on  x86-64 architecture. Also LLVM lld on aarch64 produces
dedicated separate segment for the sections in question. Hello World built with
gcc -fuse-ld=lld option produces the desired mapping:

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz
  Flg Align
  PHDR           0x000040 0x0000000000000040 0x0000000000000040 0x000268
0x000268 R   0x8
  INTERP         0x0002a8 0x00000000000002a8 0x00000000000002a8 0x00001b
0x00001b R   0x1
      [Requesting program interpreter: /lib/ld-linux-aarch64.so.1]
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x000704
0x000704 R   0x10000
  LOAD           0x000740 0x0000000000010740 0x0000000000010740 0x0001d0
0x0001d0 R E 0x10000
  LOAD           0x000910 0x0000000000020910 0x0000000000020910 0x000228
0x000228 RW  0x10000
  LOAD           0x000b38 0x0000000000030b38 0x0000000000030b38 0x000010
0x000011 RW  0x10000
  DYNAMIC        0x000920 0x0000000000020920 0x0000000000020920 0x0001b0
0x0001b0 RW  0x8
  GNU_RELRO      0x000910 0x0000000000020910 0x0000000000020910 0x000228
0x0006f0 R   0x1
  GNU_EH_FRAME   0x0005f8 0x00000000000005f8 0x00000000000005f8 0x00003c
0x00003c R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW  0
  NOTE           0x0002c4 0x00000000000002c4 0x00000000000002c4 0x000038
0x000038 R   0x4

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

-- 
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]