bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/28841] New: ld: Customize output section type


From: i at maskray dot me
Subject: [Bug ld/28841] New: ld: Customize output section type
Date: Sat, 29 Jan 2022 08:12:59 +0000

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

            Bug ID: 28841
           Summary: ld: Customize output section type
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: i at maskray dot me
  Target Milestone: ---

On ELF platforms, an output section is SHT_PROGBITS by default.
https://sourceware.org/binutils/docs/ld/Output-Section-Type.html#Output-Section-Type
allows one to create a SHT_NOBITS type section.
It's useful to support an arbitrary type.
Then the user can create an output section with just data commands.

Currently there is some magic (bfd/elf.c special_sections_n recognizes `.note*`
as SHT_NOTE) which goes against the ELF spirit that attributes should be
identified as well known integers, not magic names.

% cat a.lds
SECTIONS
{
  .noload (NOLOAD) : { BYTE(0) }
  .info (INFO) : { BYTE(0) }
  .note.package (SHT_NOTE) : { BYTE(0) }   /* or .note.package (0x7) : {
BYTE(0) } */
  .init_array (SHT_INIT_ARRAY) : { ... }
}
INSERT AFTER .note.gnu.build-id;

% as /dev/null -o a.o
% ld.bfd -T a.lds --build-id a.o -o a


It may be useful to customize sh_flags as well.

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