binutils-gdb/include/elf
H.J. Lu 0a59decbb8 elf: Add PT_GNU_PROPERTY segment type
Linkers group input note sections with the same name into one output
note section with the same name.  One output note section is placed in
one PT_NOTE segment.  New linkers merge all input .note.gnu.property
sections into one output .note.gnu.property section with a single
NT_GNU_PROPERTY_TYPE_0 note in a single PT_NOTE segment.  Since older
linkers treat input .note.gnu.property section as a generic note section
and just concatenate all input .note.gnu.property sections into one
output .note.gnu.property section without merging them, we may
see one or more NT_GNU_PROPERTY_TYPE_0 notes in PT_NOTE segment, which
are invalid.

GNU_PROPERTY_X86_UINT32_VALID was defined to address this issue such
that linker sets the bit for non-relocatable outputs.  But it isn't
sufficient:

1. It doesn't cover generic properties.
2. When -mx86-used-note=yes is passed to x86 assembler, the
GNU_PROPERTY_X86_UINT32_VALID bit is set in GNU_PROPERTY_X86_ISA_1_USED
property in object file and older linkers generate invalid
NT_GNU_PROPERTY_TYPE_0 notes with the GNU_PROPERTY_X86_UINT32_VALID bit
set.

I am proposing the following changes:

1. Add PT_GNU_PROPERTY segment type:

 # define PT_GNU_PROPERTY (PT_LOOS + 0x474e553)

which covers .note.gnu.property section.
2. Remove GNU_PROPERTY_X86_UINT32_VALID.

bfd/

	PR ld/23900
	* elf.c (get_program_header_size): Add a PT_GNU_PROPERTY
	segment for NOTE_GNU_PROPERTY_SECTION_NAME.
	(_bfd_elf_map_sections_to_segments): Create a PT_GNU_PROPERTY
	segment for NOTE_GNU_PROPERTY_SECTION_NAME.
	* elfxx-x86.c (_bfd_elf_link_setup_gnu_properties): Don't set
	GNU_PROPERTY_X86_UINT32_VALID.

binutils/

	PR ld/23900
	* readelf.c (get_segment_type): Support PT_GNU_PROPERTY.
	(decode_x86_isa): Don't check GNU_PROPERTY_X86_UINT32_VALID.
	(decode_x86_feature_1): Likewise.
	(decode_x86_feature_2): Likewise.
	(print_gnu_property_note): Remove GNU_PROPERTY_X86_UINT32_VALID
	check.
	* testsuite/binutils-all/i386/empty.d: Updated.
	* testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/empty.d: Likewise.
	* testsuite/binutils-all/i386/pr21231b.s: Change
	GNU_PROPERTY_X86_ISA_1_USED bits to 0x7fffffff.
	* testsuite/binutils-all/x86-64/pr21231b.s: Likewise.

gas/

	PR ld/23900
	* config/tc-i386.c (x86_cleanup): Don't set
	GNU_PROPERTY_X86_UINT32_VALID.
	* testsuite/gas/i386/property-1.s: Change
	GNU_PROPERTY_X86_ISA_1_USED bits to 0.

include/

	PR ld/23900
	* elf/common.h (PT_GNU_PROPERTY): New.
	(GNU_PROPERTY_X86_UINT32_VALID): Removed.

ld/

	PR ld/23900
	* testsuite/ld-elf/elf.exp: Run PR ld/23900 test.
	* testsuite/ld-elf/pr23900-1-32.rd: New file.
	* testsuite/ld-elf/pr23900-1-64.rd: Likewise.
	* testsuite/ld-elf/pr23900-1.d: Likewise.
	* testsuite/ld-elf/pr23900-1.s: Likewise.
	* testsuite/ld-elf/pr23900-2.s: Likewise.
	* testsuite/ld-elf/pr23900-2a.d: Likewise.
	* testsuite/ld-elf/pr23900-2b.d: Likewise.
	* testsuite/ld-i386/ibt-plt-1.d: Adjusted.
	* testsuite/ld-i386/ibt-plt-2c.d: Likewise.
	* testsuite/ld-i386/ibt-plt-2d.d: Likewise.
	* testsuite/ld-i386/ibt-plt-3d.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-1.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3d.d: Likewise.
	* testsuite/ld-i386/pr23372c.d: Expect <None>
	for GNU_PROPERTY_X86_ISA_1_USED.
	* testsuite/ld-x86-64/pr23372c-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372c.d: Likewise.
	* testsuite/ld-x86-64/pr23372d-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372d.d: Likewise.
	* testsuite/ld-x86-64/property-x86-5a.s: Change
	GNU_PROPERTY_X86_ISA_1_USED bits to 0.
	* testsuite/ld-x86-64/property-x86-5b.s: Likewise.
2018-12-14 04:55:34 -08:00
..
ChangeLog-0415 binutils ChangeLog rotation 2016-01-01 22:59:17 +10:30
ChangeLog-9103 Add copyright notices 2012-12-10 12:48:03 +00:00
aarch64.h [1/2][GAS][AARCH64]Add BFD_RELOC_AARCH64_TLSLE_LDST8/16/32/64_TPREL_LO12 support in GAS. 2018-03-28 18:03:55 +01:00
alpha.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
arc-cpu.def Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
arc-reloc.def [ARC] Fixed issue with DTSOFF relocs. 2018-10-01 12:42:11 +01:00
arc.h [ARC] Add Tag_ARC_ATR_version. 2018-08-06 16:41:32 +03:00
arm.h arm - Add some comments about the versions of ARM ELF that define various e_flags values 2018-08-09 16:51:09 +01:00
avr.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
bfin.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
common.h elf: Add PT_GNU_PROPERTY segment type 2018-12-14 04:55:34 -08:00
cr16.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
cr16c.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
cris.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
crx.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
csky.h Add support for the C_SKY series of processors. 2018-07-30 12:24:14 +01:00
d10v.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
d30v.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
dlx.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
dwarf.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
epiphany.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
external.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
fr30.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
frv.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ft32.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
h8.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
hppa.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
i370.h Reinstate readelf decoding of i860, i960 and i370 relocs 2018-04-17 10:48:58 +09:30
i386.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
i860.h Reinstate readelf decoding of i860, i960 and i370 relocs 2018-04-17 10:48:58 +09:30
i960.h Reinstate readelf decoding of i860, i960 and i370 relocs 2018-04-17 10:48:58 +09:30
ia64.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
internal.h ELF: Don't include zero size sections at start of PT_NOTE segment 2018-09-21 04:08:01 -07:00
ip2k.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
iq2000.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
lm32.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
m32c.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
m32r.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
m68hc11.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
m68k.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
mcore.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
mep.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
metag.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
microblaze.h [MicroBlaze] PIC data text relative 2018-04-17 14:47:13 -07:00
mips.h [MIPS] Add Loongson 2K1000 proccessor support. 2018-08-29 20:55:25 +08:00
mmix.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
mn10200.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
mn10300.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
moxie.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
msp430.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
mt.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
nds32.h Andes Technology has good news for you, we plan to update the nds32 port of binutils on upstream! 2018-09-20 13:32:58 +01:00
nfp.h This patch adds support to objdump for disassembly of NFP (Netronome Flow Processor) ELF files (.nffw) as well as some basic readelf support. 2018-04-30 17:02:59 +01:00
nios2.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
or1k.h or1k: Add the l.adrp insn and supporting relocations 2018-10-05 11:41:41 +09:00
pj.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ppc.h PowerPC inline PLT call support 2018-04-09 17:25:20 +09:30
ppc64.h PowerPC64 higher REL16 relocations 2018-08-31 22:15:05 +09:30
pru.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
reloc-macros.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
riscv.h RISC-V: Add RV32E support. 2018-05-18 14:03:18 -07:00
rl78.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
rx.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
s12z.h S12Z: New 32 bit Reloc. 2018-10-23 16:09:30 +02:00
s390.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
score.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
sh.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
sparc.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
spu.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
tic6x-attrs.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
tic6x.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
tilegx.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
tilepro.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
v850.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
vax.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
visium.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
vxworks.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
wasm32.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
x86-64.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
xc16x.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
xgate.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
xstormy16.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
xtensa.h xtensa: use property tables for correct disassembly 2018-06-04 10:38:55 -07:00