Index: test/tools/llvm-readobj/program-headers.test =================================================================== --- test/tools/llvm-readobj/program-headers.test +++ test/tools/llvm-readobj/program-headers.test @@ -6,6 +6,8 @@ RUN: | FileCheck %s -check-prefix ELF-MIPS RUN: llvm-readobj -program-headers %p/../../Object/Inputs/program-headers.mips64 \ RUN: | FileCheck %s -check-prefix ELF-MIPS64 +RUN: llvm-readobj -program-headers %p/../../Object/Inputs/openbsd-phdrs.elf-x86-64 \ +RUN: | FileCheck %s -check-prefix OPENBSD-X86-64 ELF-I386: ProgramHeaders [ ELF-I386-NEXT: ProgramHeader { @@ -140,3 +142,29 @@ ELF-MIPS64-NEXT: Alignment: 65536 ELF-MIPS64-NEXT: } ELF-MIPS64-NEXT: ] + +OPENBSD-X86-64: ProgramHeaders [ +OPENBSD-X86-64: ProgramHeader { +OPENBSD-X86-64: Type: PT_OPENBSD_RANDOMIZE +OPENBSD-X86-64-NEXT: Offset: 0xB4 +OPENBSD-X86-64-NEXT: VirtualAddress: 0xB4 +OPENBSD-X86-64-NEXT: PhysicalAddress: 0xB4 +OPENBSD-X86-64-NEXT: FileSize: 8 +OPENBSD-X86-64-NEXT: MemSize: 8 +OPENBSD-X86-64-NEXT: Flags [ (0x4) +OPENBSD-X86-64-NEXT: PF_R (0x4) +OPENBSD-X86-64-NEXT: ] +OPENBSD-X86-64-NEXT: Alignment: 1 +OPENBSD-X86-64-NEXT: } +OPENBSD-X86-64-NEXT: ProgramHeader { +OPENBSD-X86-64-NEXT: Type: PT_OPENBSD_WXNEEDED +OPENBSD-X86-64-NEXT: Offset: 0x0 +OPENBSD-X86-64-NEXT: VirtualAddress: 0x0 +OPENBSD-X86-64-NEXT: PhysicalAddress: 0x0 +OPENBSD-X86-64-NEXT: FileSize: 0 +OPENBSD-X86-64-NEXT: MemSize: 0 +OPENBSD-X86-64-NEXT: Flags [ (0x4) +OPENBSD-X86-64-NEXT: PF_R (0x4) +OPENBSD-X86-64-NEXT: ] +OPENBSD-X86-64-NEXT: Alignment: 0 +OPENBSD-X86-64-NEXT: } Index: tools/llvm-readobj/ELFDumper.cpp =================================================================== --- tools/llvm-readobj/ELFDumper.cpp +++ tools/llvm-readobj/ELFDumper.cpp @@ -1154,6 +1154,10 @@ LLVM_READOBJ_ENUM_CASE(ELF, PT_GNU_STACK); LLVM_READOBJ_ENUM_CASE(ELF, PT_GNU_RELRO); + + LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_RANDOMIZE); + LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_WXNEEDED); + default: return ""; } }