1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[yaml2obj] Support PT_GNU_STACK and PT_GNU_RELRO

PT_GNU_STACK is used in an llvm-objcopy test.

I plan to use PT_GNU_RELRO in a patch to improve nested segment
processing in llvm-objcopy (PR42963).

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D67146

llvm-svn: 370857
This commit is contained in:
Fangrui Song 2019-09-04 09:19:31 +00:00
parent 786f32fbda
commit 48da72d50b
3 changed files with 15 additions and 1 deletions

View File

@ -52,6 +52,8 @@ void ScalarEnumerationTraits<ELFYAML::ELF_PT>::enumeration(
ECase(PT_PHDR);
ECase(PT_TLS);
ECase(PT_GNU_EH_FRAME);
ECase(PT_GNU_STACK);
ECase(PT_GNU_RELRO);
#undef ECase
IO.enumFallback<Hex32>(Value);
}

View File

@ -43,7 +43,7 @@ ProgramHeaders:
Align: 0x1000
Sections:
- Section: .data
- Type: 0x6474e551 # GNU_STACK
- Type: PT_GNU_STACK
Flags: [ PF_R, PF_W ]
VAddr: 0x0000
PAddr: 0x0000

View File

@ -37,6 +37,9 @@ ProgramHeaders:
PAddr: 0xFFFF2000
Sections:
- Section: .data
- Type: PT_GNU_EH_FRAME
- Type: PT_GNU_STACK
- Type: PT_GNU_RELRO
#CHECK: ProgramHeaders [
#CHECK-NEXT: ProgramHeader {
@ -64,6 +67,15 @@ ProgramHeaders:
#CHECK-NEXT: ]
#CHECK-NEXT: Alignment: 4096
#CHECK-NEXT: }
#CHECK-NEXT: ProgramHeader {
#CHECK-NEXT: Type: PT_GNU_EH_FRAME (0x6474E550)
#CHECK: }
#CHECK-NEXT: ProgramHeader {
#CHECK-NEXT: Type: PT_GNU_STACK (0x6474E551)
#CHECK: }
#CHECK-NEXT: ProgramHeader {
#CHECK-NEXT: Type: PT_GNU_RELRO (0x6474E552)
#CHECK: }
#CHECK-NEXT:]
## Check we do not allow referencing sections that do not exist.