[llvm] r370857 - [yaml2obj] Support PT_GNU_STACK and PT_GNU_RELRO
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 02:19:32 PDT 2019
Author: maskray
Date: Wed Sep 4 02:19:31 2019
New Revision: 370857
URL: http://llvm.org/viewvc/llvm-project?rev=370857&view=rev
Log:
[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
Modified:
llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
llvm/trunk/test/tools/llvm-objcopy/ELF/marker-segment.test
llvm/trunk/test/tools/yaml2obj/program-header.yaml
Modified: llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/ELFYAML.cpp?rev=370857&r1=370856&r2=370857&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/ELFYAML.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/ELFYAML.cpp Wed Sep 4 02:19:31 2019
@@ -52,6 +52,8 @@ void ScalarEnumerationTraits<ELFYAML::EL
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);
}
Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/marker-segment.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/marker-segment.test?rev=370857&r1=370856&r2=370857&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/marker-segment.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/marker-segment.test Wed Sep 4 02:19:31 2019
@@ -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
Modified: llvm/trunk/test/tools/yaml2obj/program-header.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/program-header.yaml?rev=370857&r1=370856&r2=370857&view=diff
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/program-header.yaml (original)
+++ llvm/trunk/test/tools/yaml2obj/program-header.yaml Wed Sep 4 02:19:31 2019
@@ -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.
More information about the llvm-commits
mailing list