mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
fbc95f1e11
We added PT_RISCV_ATTRIBUTES to program header to make .riscv.attribute easier to find in dynamic loader or kernel. Ref: https://github.com/riscv/riscv-elf-psabi-doc/pull/71 ChangeLog: bfd/ * elfnn-riscv.c(RISCV_ATTRIBUTES_SECTION_NAME): New. (riscv_elf_additional_program_headers): Ditto. (riscv_elf_modify_segment_map): Ditto. (elf_backend_additional_program_headers): Ditto. (elf_backend_modify_segment_map): Ditto. (elf_backend_obj_attrs_section): Use RISCV_ATTRIBUTES_SECTION_NAME rather than string literal. binutils/ * readelf.c(get_riscv_segment_type): New. (get_segment_type): Handle EM_RISCV. include/ * elf/riscv.h (PT_RISCV_ATTRIBUTES): New. * testsuite/ld-elf/orphan-region.ld: Discard .riscv.attributes section for simplify testcase. * testsuite/ld-riscv-elf/attr-phdr.d: New. * testsuite/ld-riscv-elf/attr-phdr.s: Ditto. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Add attr-phdr to testcase.
20 lines
459 B
Makefile
20 lines
459 B
Makefile
#name: PT_RISCV_ATTRIBUTES check
|
|
#source: attr-phdr.s
|
|
#as: -march=rv32ic
|
|
#ld: -m[riscv_choose_ilp32_emul]
|
|
#readelf: -l
|
|
|
|
Elf file type is EXEC \(Executable file\)
|
|
Entry point .*
|
|
There are .* program headers, starting at offset .*
|
|
|
|
Program Headers:
|
|
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
|
RISCV_ATTRIBUT .*
|
|
LOAD .*
|
|
|
|
Section to Segment mapping:
|
|
Segment Sections...
|
|
00 .riscv.attributes
|
|
01 .text
|