RFC: [PATCH] ELF: Don't require section header on ELF objects
H.J. Lu
hjl.tools@gmail.com
Sun Mar 8 18:06:33 GMT 2020
More information about the Binutils mailing list
Sun Mar 8 18:06:33 GMT 2020
- Previous message (by thread): RFC: [PATCH] ELF: Don't require section header on ELF objects
- Next message (by thread): RFC: [PATCH] ELF: Don't require section header on ELF objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Mar 8, 2020 at 10:59 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > Any comments? > > Kaylee, do you have copyright paper with FSF? > > H.J. > --- > Section header isn't mandatory on ELF executable nor shared library. > This patch adds a new linker option, -z nosectionheader, to omit ELF > section header when building an executable or shared library, adds > an objcopy and strip option, --remove-section-header, to remove ELF > section header from an executable or shared library. > > The PT_DYNAMIC segment contains DT_HASH/DT_GNU_HASH/DT_MIPS_XHASH, > DT_STRTAB, DT_SYMTAB, DT_STRSZ and DT_SYMENT, which can be used to > reconstruct dynamic symbol table when section header isn't available. > For DT_HASH, the number of dynamic symbol table entries equals the > number of chains. For DT_GNU_HASH/DT_MIPS_XHASH, only defined symbols > with non-STB_LOCAL indings are in hash table. Since in dynamic symbol > table, all symbols with STB_LOCAL binding are placed before symbols with > other bindings and all defined symbols are placed before undefined ones, It should read --- all symbols with STB_LOCAL binding are placed before symbols with other bindings and all undefined symbols are placed before defined ones, --- The complete patch set is on users/hjl/pr25617/master branch at https://gitlab.com/x86-binutils/binutils-gdb > the highest symbol index in DT_GNU_HASH/DT_MIPS_XHASH is the highest > dynamic symbol table index. > > bfd/ > > 2020-03-XX H.J. Lu <hongjiu.lu@intel.com> > Kaylee Blake <klkblake@gmail.com> > > PR ld/25617 > * bfd.c (BFD_NO_SECTION_HEADER): New. > (BFD_FLAGS_SAVED): Add BFD_NO_SECTION_HEADER. > (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. > * elfcode.h (elf_swap_ehdr_out): Omit section header on > non-relocatable output with BFD_NO_SECTION_HEADER. > (elf_write_shdrs_and_ehdr): Likewise. > * elfxx-target.h (TARGET_BIG_SYM): Add BFD_NO_SECTION_HEADER > to object_flags. > (TARGET_LITTLE_SYM): Likewise. > * bfd-in2.h: Regenerated. > > binutils/ > > 2020-03-XX H.J. Lu <hongjiu.lu@intel.com> > > PR ld/25617 > * NEWS: Mention --remove-section-header for objcopy and strip. > * doc/binutils.texi: Document --remove-section-header for objcopy > and strip. > * objcopy.c (remove_section_header): New. > (command_line_switch): Add OPTION_REMOVE_SECTION_HEADER. > (strip_options): Add --remove-section-header. > (copy_options): Likewise. > (copy_usage): Add --remove-section-header. > (strip_usage): Likewise. > (copy_object): Renamed to ... > (copy_object_1): This. Issue a warning for > --remove-section-header on non-ELF targets. > (copy_object): New. > (strip_main): Handle OPTION_REMOVE_SECTION_HEADER. > (copy_main): Likewise. > -- H.J.
- Previous message (by thread): RFC: [PATCH] ELF: Don't require section header on ELF objects
- Next message (by thread): RFC: [PATCH] ELF: Don't require section header on ELF objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list