mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
PR30592 objcopy: allow --set-section-flags to add or remove SHF_X86_64_LARGE
For example, objcopy --set-section-flags .data=alloc,large will add
SHF_X86_64_LARGE to the .data section. Omitting "large" will drop the
SHF_X86_64_LARGE flag.
The bfd_section flag is named generically, SEC_ELF_LARGE, in case other
processors want to follow SHF_X86_64_LARGE. SEC_ELF_LARGE has the same
value as SEC_TIC54X_BLOCK used by coff.
bfd/
* section.c: Define SEC_ELF_LARGE.
* bfd-in2.h: Regenerate.
* elf64-x86-64.c (elf_x86_64_section_flags, elf_x86_64_fake_sections,
elf_x86_64_copy_private_section_data): New.
binutils/
* NEWS: Mention the new feature for objcopy.
* doc/binutils.texi: Mention "large".
* objcopy.c (parse_flags): Parse "large".
(check_new_section_flags): Error if "large" is used with a
non-x86-64 ELF target.
* testsuite/binutils-all/x86-64/large-sections.d: New.
* testsuite/binutils-all/x86-64/large-sections.s: New.
* testsuite/binutils-all/x86-64/large-sections-i386.d: New.
* testsuite/binutils-all/x86-64/large-sections-2.d: New.
* testsuite/binutils-all/x86-64/large-sections-2-x32.d: New.
This commit is contained in:
committed by
Fangrui Song
parent
4fb2abb59d
commit
5e24da908d
@@ -0,0 +1,15 @@
|
||||
#source: large-sections.s
|
||||
#PROG: objcopy
|
||||
#as: --x32
|
||||
#objcopy: --set-section-flags .ldata=alloc
|
||||
#readelf: -S -W
|
||||
|
||||
#...
|
||||
\[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AX[ \t]+.*
|
||||
#...
|
||||
\[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WA[ \t]+.*
|
||||
#...
|
||||
\[[ 0-9]+\] \.ltext.*[ \t]+PROGBITS[ \t0-9a-f]+AXl[ \t]+.*
|
||||
#...
|
||||
\[[ 0-9]+\] \.ldata.*[ \t]+PROGBITS[ \t0-9a-f]+WA[ \t]+.*
|
||||
#pass
|
||||
15
binutils/testsuite/binutils-all/x86-64/large-sections-2.d
Normal file
15
binutils/testsuite/binutils-all/x86-64/large-sections-2.d
Normal file
@@ -0,0 +1,15 @@
|
||||
#source: large-sections.s
|
||||
#PROG: objcopy
|
||||
#as: --64
|
||||
#objcopy: --set-section-flags .ldata=alloc
|
||||
#readelf: -S -W
|
||||
|
||||
#...
|
||||
\[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AX[ \t]+.*
|
||||
#...
|
||||
\[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WA[ \t]+.*
|
||||
#...
|
||||
\[[ 0-9]+\] \.ltext.*[ \t]+PROGBITS[ \t0-9a-f]+AXl[ \t]+.*
|
||||
#...
|
||||
\[[ 0-9]+\] \.ldata.*[ \t]+PROGBITS[ \t0-9a-f]+WA[ \t]+.*
|
||||
#pass
|
||||
@@ -0,0 +1,6 @@
|
||||
#source: large-sections.s
|
||||
#PROG: objcopy
|
||||
#as: --64
|
||||
#objcopy: -O elf32-i386 --set-section-flags .data=alloc,large
|
||||
#target: x86_64-*-linux*
|
||||
#error: \A[^[]*\[.data\]: 'large' flag is ELF x86-64 specific
|
||||
14
binutils/testsuite/binutils-all/x86-64/large-sections.d
Normal file
14
binutils/testsuite/binutils-all/x86-64/large-sections.d
Normal file
@@ -0,0 +1,14 @@
|
||||
#PROG: objcopy
|
||||
#as: --64
|
||||
#objcopy: --set-section-flags .text=alloc,readonly,code,large --set-section-flags .data=alloc,large
|
||||
#readelf: -S -W
|
||||
|
||||
#...
|
||||
\[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXl[ \t]+.*
|
||||
#...
|
||||
\[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAl[ \t]+.*
|
||||
#...
|
||||
\[[ 0-9]+\] \.ltext.*[ \t]+PROGBITS[ \t0-9a-f]+AXl[ \t]+.*
|
||||
#...
|
||||
\[[ 0-9]+\] \.ldata.*[ \t]+PROGBITS[ \t0-9a-f]+WAl[ \t]+.*
|
||||
#pass
|
||||
8
binutils/testsuite/binutils-all/x86-64/large-sections.s
Normal file
8
binutils/testsuite/binutils-all/x86-64/large-sections.s
Normal file
@@ -0,0 +1,8 @@
|
||||
.section .text, "ax"
|
||||
nop
|
||||
.section .data, "aw"
|
||||
.byte 1
|
||||
.section .ltext, "axl"
|
||||
nop
|
||||
.section .ldata, "awl"
|
||||
.byte 1
|
||||
Reference in New Issue
Block a user