Index: llvm/test/tools/llvm-readobj/ELF/amdgpu-elf-definitions.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/amdgpu-elf-definitions.test +++ llvm/test/tools/llvm-readobj/ELF/amdgpu-elf-definitions.test @@ -1,11 +1,11 @@ -RUN: llvm-readobj --file-headers -l -S --symbols %p/Inputs/trivial.obj.elf-amdhsa-gfx803 | FileCheck %s +# RUN: llvm-readobj --file-headers -l -S --symbols %p/Inputs/trivial.obj.elf-amdhsa-gfx803 | FileCheck %s -CHECK: Format: elf64-amdgpu -CHECK: Arch: unknown -CHECK: ElfHeader { -CHECK: Ident { -CHECK: OS/ABI: AMDGPU_HSA (0x40) -CHECK: ABIVersion: 0 -CHECK: } -CHECK: Machine: EM_AMDGPU (0xE0) -CHECK: } +# CHECK: Format: elf64-amdgpu +# CHECK: Arch: unknown +# CHECK: ElfHeader { +# CHECK: Ident { +# CHECK: OS/ABI: AMDGPU_HSA (0x40) +# CHECK: ABIVersion: 0 +# CHECK: } +# CHECK: Machine: EM_AMDGPU (0xE0) +# CHECK: } Index: llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test +++ llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test @@ -50,7 +50,7 @@ - Section: .dynamic ## Show we print a warning for an invalid relocation table size stored in a DT_RELASZ entry. -# RUN: yaml2obj --docnum=2 %s -o %t2 +# RUN: yaml2obj --docnum=2 -DRELTYPE=RELA -DTAG1=DT_RELASZ -DTAG1VAL=0xFF -DTAG2=DT_RELAENT %s -o %t2 # RUN: llvm-readobj --dyn-relocations %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=INVALID-DT-RELASZ # RUN: llvm-readelf --dyn-relocations %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=INVALID-DT-RELASZ @@ -63,277 +63,73 @@ Type: ET_DYN Machine: EM_X86_64 Sections: - - Name: .rela.dyn - Type: SHT_RELA - Relocations: - - Type: R_X86_64_NONE + - Name: .relx.dyn + Type: SHT_[[RELTYPE]] - Name: .dynamic Type: SHT_DYNAMIC Entries: - - Tag: DT_RELA + - Tag: DT_[[RELTYPE]] Value: 0x0 - - Tag: DT_RELASZ - Value: 0xFF - - Tag: DT_RELAENT - Value: 0x18 + - Tag: [[TAG1]] + Value: [[TAG1VAL=0x18]] + - Tag: [[TAG2]] + Value: [[TAG2VAL=0x18]] - Tag: DT_NULL Value: 0x0 DynamicSymbols: [] ProgramHeaders: - Type: PT_LOAD Sections: - - Section: .rela.dyn + - Section: .relx.dyn - Section: .dynamic ## Show we print a warning for an invalid relocation table entry size stored in a DT_RELAENT entry. -# RUN: yaml2obj --docnum=3 %s -o %t3 +# RUN: yaml2obj --docnum=2 -DRELTYPE=RELA -DTAG1=DT_RELASZ -DTAG2=DT_RELAENT -DTAG2VAL=0xFF %s -o %t3 # RUN: llvm-readobj --dyn-relocations %t3 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=INVALID-DT-RELAENT # RUN: llvm-readelf --dyn-relocations %t3 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=INVALID-DT-RELAENT ## INVALID-DT-RELAENT: warning: '[[FILE]]': invalid DT_RELASZ value (0x18) or DT_RELAENT value (0xff) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -Sections: - - Name: .rela.dyn - Type: SHT_RELA - Relocations: - - Type: R_X86_64_NONE - - Name: .dynamic - Type: SHT_DYNAMIC - Entries: - - Tag: DT_RELA - Value: 0x0 - - Tag: DT_RELASZ - Value: 0x18 - - Tag: DT_RELAENT - Value: 0xFF - - Tag: DT_NULL - Value: 0x0 -DynamicSymbols: [] -ProgramHeaders: - - Type: PT_LOAD - Sections: - - Section: .rela.dyn - - Section: .dynamic - ## Show we print a warning for an invalid relocation table size stored in a DT_RELSZ entry. -# RUN: yaml2obj --docnum=4 %s -o %t4 +# RUN: yaml2obj --docnum=2 -DRELTYPE=REL -DTAG1=DT_RELSZ -DTAG1VAL=0xFF -DTAG2=DT_RELENT %s -o %t4 # RUN: llvm-readobj --dyn-relocations %t4 2>&1 | FileCheck %s -DFILE=%t4 --check-prefix=INVALID-DT-RELSZ # RUN: llvm-readelf --dyn-relocations %t4 2>&1 | FileCheck %s -DFILE=%t4 --check-prefix=INVALID-DT-RELSZ ## INVALID-DT-RELSZ: warning: '[[FILE]]': invalid DT_RELSZ value (0xff) or DT_RELENT value (0x18) ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_386 -Sections: - - Name: .rela.dyn - Type: SHT_REL - Relocations: - - Type: R_386_NONE - - Name: .dynamic - Type: SHT_DYNAMIC - Entries: - - Tag: DT_REL - Value: 0x0 - - Tag: DT_RELSZ - Value: 0xFF - - Tag: DT_RELENT - Value: 0x18 - - Tag: DT_NULL - Value: 0x0 -DynamicSymbols: [] -ProgramHeaders: - - Type: PT_LOAD - Sections: - - Section: .rela.dyn - - Section: .dynamic - ## Show we print a warning for an invalid relocation table entry size stored in a DT_RELENT entry. -# RUN: yaml2obj --docnum=5 %s -o %t5 +# RUN: yaml2obj --docnum=2 -DRELTYPE=REL -DTAG1=DT_RELSZ -DTAG2=DT_RELENT -DTAG2VAL=0xFF %s -o %t5 # RUN: llvm-readobj --dyn-relocations %t5 2>&1 | FileCheck %s -DFILE=%t5 --check-prefix=INVALID-DT-RELENT # RUN: llvm-readelf --dyn-relocations %t5 2>&1 | FileCheck %s -DFILE=%t5 --check-prefix=INVALID-DT-RELENT ## INVALID-DT-RELENT: warning: '[[FILE]]': invalid DT_RELSZ value (0x18) or DT_RELENT value (0xff) ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_386 -Sections: - - Name: .rela.dyn - Type: SHT_REL - Relocations: - - Type: R_386_NONE - - Name: .dynamic - Type: SHT_DYNAMIC - Entries: - - Tag: DT_REL - Value: 0x0 - - Tag: DT_RELSZ - Value: 0x18 - - Tag: DT_RELENT - Value: 0xFF - - Tag: DT_NULL - Value: 0x0 -DynamicSymbols: [] -ProgramHeaders: - - Type: PT_LOAD - Sections: - - Section: .rela.dyn - - Section: .dynamic - ## Show we print a warning for an invalid relocation table size stored in a DT_RELRSZ/DT_ANDROID_RELRSZ entry. -# RUN: yaml2obj --docnum=6 %s -o %t6 +# RUN: yaml2obj --docnum=2 -DRELTYPE=RELR -DTAG1=DT_RELRSZ -DTAG1VAL=0xFF -DTAG2=DT_RELRENT %s -o %t6 # RUN: llvm-readobj --dyn-relocations %t6 2>&1 | FileCheck %s -DFILE=%t6 --check-prefix=INVALID-DT-RELRSZ # RUN: llvm-readelf --dyn-relocations %t6 2>&1 | FileCheck %s -DFILE=%t6 --check-prefix=INVALID-DT-RELRSZ -# RUN: yaml2obj --docnum=7 %s -o %t7 + +# RUN: yaml2obj --docnum=2 -DRELTYPE=RELR -DTAG1=DT_ANDROID_RELRSZ -DTAG1VAL=0xFF -DTAG2=DT_ANDROID_RELRENT %s -o %t7 # RUN: llvm-readobj --dyn-relocations %t7 2>&1 | FileCheck %s -DFILE=%t7 --check-prefix=INVALID-DT-ANDROID-RELRSZ # RUN: llvm-readelf --dyn-relocations %t7 2>&1 | FileCheck %s -DFILE=%t7 --check-prefix=INVALID-DT-ANDROID-RELRSZ ## INVALID-DT-RELRSZ: warning: '[[FILE]]': invalid DT_RELRSZ value (0xff) or DT_RELRENT value (0x18) ## INVALID-DT-ANDROID-RELRSZ: warning: '[[FILE]]': invalid DT_ANDROID_RELRSZ value (0xff) or DT_ANDROID_RELRENT value (0x18) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -Sections: - - Name: .relr.dyn - Type: SHT_RELR - Flags: [ SHF_ALLOC ] - Content: "" - - Name: .dynamic - Type: SHT_DYNAMIC - Entries: - - Tag: DT_RELR - Value: 0x0 - - Tag: DT_RELRSZ - Value: 0xFF - - Tag: DT_RELRENT - Value: 0x18 - - Tag: DT_NULL - Value: 0x0 -DynamicSymbols: [] -ProgramHeaders: - - Type: PT_LOAD - Sections: - - Section: .relr.dyn - - Section: .dynamic - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -Sections: - - Name: .relr.dyn - Type: SHT_RELR - Flags: [ SHF_ALLOC ] - Content: "" - - Name: .dynamic - Type: SHT_DYNAMIC - Entries: - - Tag: DT_RELR - Value: 0x0 - - Tag: DT_ANDROID_RELRSZ - Value: 0xFF - - Tag: DT_ANDROID_RELRENT - Value: 0x18 - - Tag: DT_NULL - Value: 0x0 -DynamicSymbols: [] -ProgramHeaders: - - Type: PT_LOAD - Sections: - - Section: .relr.dyn - - Section: .dynamic - ## Show we print a warning for an invalid relocation table entry size stored in a DT_RELRENT/DT_ANDROID_RELRENT entry. -# RUN: yaml2obj --docnum=8 %s -o %t8 +# RUN: yaml2obj --docnum=2 -DRELTYPE=RELR -DTAG1=DT_RELRSZ -DTAG2=DT_RELRENT -DTAG2VAL=0xFF %s -o %t8 # RUN: llvm-readobj --dyn-relocations %t8 2>&1 | FileCheck %s -DFILE=%t8 --check-prefix=INVALID-DT-RELRENT # RUN: llvm-readelf --dyn-relocations %t8 2>&1 | FileCheck %s -DFILE=%t8 --check-prefix=INVALID-DT-RELRENT -# RUN: yaml2obj --docnum=9 %s -o %t9 +# RUN: yaml2obj --docnum=2 -DRELTYPE=RELR -DTAG1=DT_ANDROID_RELRSZ -DTAG2=DT_ANDROID_RELRENT -DTAG2VAL=0xFF %s -o %t9 # RUN: llvm-readobj --dyn-relocations %t9 2>&1 | FileCheck %s -DFILE=%t9 --check-prefix=INVALID-DT-ANDROID-RELRENT # RUN: llvm-readelf --dyn-relocations %t9 2>&1 | FileCheck %s -DFILE=%t9 --check-prefix=INVALID-DT-ANDROID-RELRENT ## INVALID-DT-RELRENT: invalid DT_RELRSZ value (0x18) or DT_RELRENT value (0xff) ## INVALID-DT-ANDROID-RELRENT: invalid DT_ANDROID_RELRSZ value (0x18) or DT_ANDROID_RELRENT value (0xff) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -Sections: - - Name: .relr.dyn - Type: SHT_RELR - Flags: [ SHF_ALLOC ] - Content: "" - - Name: .dynamic - Type: SHT_DYNAMIC - Entries: - - Tag: DT_RELR - Value: 0x0 - - Tag: DT_RELRSZ - Value: 0x18 - - Tag: DT_RELRENT - Value: 0xFF - - Tag: DT_NULL - Value: 0x0 -DynamicSymbols: [] -ProgramHeaders: - - Type: PT_LOAD - Sections: - - Section: .relr.dyn - - Section: .dynamic - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -Sections: - - Name: .relr.dyn - Type: SHT_RELR - Flags: [ SHF_ALLOC ] - Content: "" - - Name: .dynamic - Type: SHT_DYNAMIC - Entries: - - Tag: DT_RELR - Value: 0x0 - - Tag: DT_ANDROID_RELRSZ - Value: 0x18 - - Tag: DT_ANDROID_RELRENT - Value: 0xFF - - Tag: DT_NULL - Value: 0x0 -DynamicSymbols: [] -ProgramHeaders: - - Type: PT_LOAD - Sections: - - Section: .relr.dyn - - Section: .dynamic - ## Show we print a warning for an invalid value of DT_PLTRELSZ, which describes the total size ## of the relocation entries associated with the procedure linkage table. -# RUN: yaml2obj --docnum=10 %s -o %t10 +# RUN: yaml2obj --docnum=3 %s -o %t10 # RUN: llvm-readobj --dyn-relocations %t10 2>&1 | FileCheck %s -DFILE=%t10 --check-prefix=INVALID-DT-PLTRELSZ # RUN: llvm-readelf --dyn-relocations %t10 2>&1 | FileCheck %s -DFILE=%t10 --check-prefix=INVALID-DT-PLTRELSZ @@ -369,7 +165,7 @@ - Section: .dynamic ## Show we print a warning when dumping dynamic relocations if there is no dynamic symbol table. -# RUN: yaml2obj --docnum=11 %s -o %t11 +# RUN: yaml2obj --docnum=4 %s -o %t11 # RUN: llvm-readobj --dyn-relocations %t11 2>&1 | FileCheck %s -DFILE=%t11 --check-prefix=LLVM-NO-DYNSYM # RUN: llvm-readelf --dyn-relocations %t11 2>&1 | FileCheck %s -DFILE=%t11 --check-prefix=GNU-NO-DYNSYM @@ -419,7 +215,7 @@ ## Show we print a warning when the symbol index of a dynamic relocation is too ## large (goes past the end of the dynamic symbol table). -# RUN: yaml2obj --docnum=12 %s -o %t12 +# RUN: yaml2obj --docnum=5 %s -o %t12 # RUN: llvm-readobj --dyn-relocations %t12 2>&1 | FileCheck %s -DFILE=%t12 --check-prefix=LLVM-INVALID-DYNSYM # RUN: llvm-readelf --dyn-relocations %t12 2>&1 | FileCheck %s -DFILE=%t12 --check-prefix=GNU-INVALID-DYNSYM @@ -465,7 +261,7 @@ - Section: .dynamic ## Show that when we have both REL and RELA relocations, we dump both sets. -# RUN: yaml2obj --docnum=13 %s -o %t13 +# RUN: yaml2obj --docnum=6 %s -o %t13 # RUN: llvm-readobj --dyn-relocations %t13 2>&1 | FileCheck %s -DFILE=%t13 --check-prefix=BOTH-RELA-REL-LLVM # RUN: llvm-readelf --dyn-relocations %t13 2>&1 | FileCheck %s -DFILE=%t13 --check-prefix=BOTH-RELA-REL-GNU Index: llvm/test/tools/llvm-readobj/ELF/broken-dynsym-link.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/broken-dynsym-link.test +++ llvm/test/tools/llvm-readobj/ELF/broken-dynsym-link.test @@ -2,7 +2,7 @@ ## .dynsym section's sh_link field is broken. ## Case 1: sh_link is set to 0. -# RUN: yaml2obj --docnum=1 %s -o %t1 +# RUN: yaml2obj --docnum=1 -DLINK=0 %s -o %t1 # RUN: llvm-readobj -S %t1 2>&1 | FileCheck %s -DFILE=%t1 --check-prefixes=LLVM,ERR # RUN: llvm-readelf -S %t1 2>&1 | FileCheck %s -DFILE=%t1 --check-prefixes=GNU,ERR @@ -32,25 +32,15 @@ Sections: - Name: .dynsym Type: SHT_DYNSYM + Link: [[LINK]] ## Case 2: sh_link is set to 255, which is larger than the number of the sections. -# RUN: yaml2obj --docnum=2 %s -o %t2 +# RUN: yaml2obj --docnum=1 -DLINK=255 %s -o %t2 # RUN: llvm-readobj -S %t2 2>&1 | FileCheck -DFILE=%t2 %s --check-prefixes=LLVM2,ERR2 # RUN: llvm-readelf -S %t2 2>&1 | FileCheck -DFILE=%t2 %s --check-prefixes=GNU2,ERR2 -# ERR2: warning: '[[FILE]]': invalid section index - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -Sections: - - Name: .dynsym - Type: SHT_DYNSYM - Link: 255 +# ERR2: warning: '[[FILE]]': invalid section index: 255 # LLVM2: Name: .dynsym # LLVM2-NEXT: Type: SHT_DYNSYM Index: llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test +++ llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test @@ -37,8 +37,7 @@ - From: bar To: foo Weight: 98 -## 0x10 is the normal entry size for the SHT_LLVM_CALL_GRAPH_PROFILE section. - EntSize: [[ENTSIZE=0x10]] + EntSize: [[ENTSIZE=]] Symbols: - Name: foo - Name: bar Index: llvm/test/tools/llvm-readobj/ELF/dependent-libraries.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/dependent-libraries.test +++ llvm/test/tools/llvm-readobj/ELF/dependent-libraries.test @@ -30,8 +30,18 @@ Sections: - Name: .deplibs Type: SHT_LLVM_DEPENDENT_LIBRARIES + ShType: [[TYPE=]] Libraries: [ foo, bar, foo ] +## Show the output when there are no dependent library sections. Check that we are +## locating dependent library sections by type. To do this we change the type to an arbitrary one. +# RUN: yaml2obj --docnum=1 -DTYPE=SHT_PROGBITS %s -o %t3 +# RUN: llvm-readobj --dependent-libraries %t3 2>&1 | FileCheck %s --check-prefix=NONE +# RUN: llvm-readelf --dependent-libraries %t3 2>&1 | FileCheck %s --allow-empty --implicit-check-not={{.}} + +# NONE: DependentLibs [ +# NONE-NEXT: ] + ## Now, check how we dump a mix of valid, empty and invalid SHT_LLVM_DEPENDENT_LIBRARIES sections. # RUN: yaml2obj --docnum=2 %s -o %t2 @@ -98,18 +108,3 @@ - ShName: 0x10000 Type: SHT_LLVM_DEPENDENT_LIBRARIES Libraries: [ baz ] - -## Show the output when there are no dependent library sections. -# RUN: yaml2obj --docnum=3 %s -o %t3 -# RUN: llvm-readobj --dependent-libraries %t3 2>&1 | FileCheck %s --check-prefix=NONE -# RUN: llvm-readelf --dependent-libraries %t3 2>&1 | FileCheck %s --allow-empty --implicit-check-not={{.}} - -# NONE: DependentLibs [ -# NONE-NEXT: ] - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 Index: llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test +++ llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test @@ -134,41 +134,24 @@ Value: 0xffff1234 - Tag: DT_NULL Value: 0 + - Name: .dynsym + Type: SHT_DYNSYM + ShName: [[DYNSYMNAME=]] DynamicSymbols: - Name: foo ## Case 3.2: the same as 3.1, but the sh_name field of the SHT_DYNSYM section is invalid. ## Check we are still able to dump symbols. -# RUN: yaml2obj --docnum=3 %s -o %t2.broken.name +# RUN: yaml2obj --docnum=2 -DDYNSYMNAME=0xffffffff %s -o %t2.broken.name # RUN: llvm-readobj %t2.broken.name --dyn-symbols 2>&1 | \ # RUN: FileCheck %s -DFILE=%t2.broken.name --check-prefix=NOPHDRS-LLVM --implicit-check-not=warning: # RUN: llvm-readelf %t2.broken.name --dyn-symbols 2>&1 | \ # RUN: FileCheck %s -DFILE=%t2.broken.name -DNAME="" \ # RUN: --check-prefixes=NOPHDRS-GNU,NOPHDRS-NAMEWARN --implicit-check-not=warning: ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -Sections: - - Name: .dynamic - Type: SHT_DYNAMIC - Entries: - - Tag: DT_SYMTAB - Value: 0xffff1234 - - Tag: DT_NULL - Value: 0 - - Name: .dynsym - Type: SHT_DYNSYM - ShName: 0xffffffff -DynamicSymbols: - - Name: foo - ## Case 4: Check we report a warning when there is no SHT_DYNSYM section and we can't map the DT_SYMTAB value ## to an address because of the absence of a corresponding PT_LOAD program header. -# RUN: yaml2obj --docnum=4 %s -o %t3.so +# RUN: yaml2obj --docnum=3 %s -o %t3.so # RUN: llvm-readobj %t3.so --dyn-symbols 2>&1 | FileCheck %s -DFILE=%t3.so --check-prefixes=NOSHT-DYNSYM,NOSHT-DYNSYM-LLVM # RUN: llvm-readelf %t3.so --dyn-symbols 2>&1 | FileCheck %s -DFILE=%t3.so --check-prefix=NOSHT-DYNSYM @@ -197,7 +180,7 @@ ## Case 5: Check that when we can't map the value of the DT_SYMTAB tag to an address, we report a warning and ## use the information in the section header table to locate the dynamic symbol table. -# RUN: yaml2obj --docnum=5 %s -o %t4.so +# RUN: yaml2obj --docnum=4 %s -o %t4.so # RUN: llvm-readobj %t4.so --dyn-symbols 2>&1 | FileCheck -DFILE=%t4.so %s --check-prefixes=BROKEN-DTSYMTAB,BROKEN-DTSYMTAB-LLVM # RUN: llvm-readelf %t4.so --dyn-symbols 2>&1 | FileCheck -DFILE=%t4.so %s --check-prefixes=BROKEN-DTSYMTAB,BROKEN-DTSYMTAB-GNU @@ -229,7 +212,7 @@ ## Case 6: Check that if we can get the location of the dynamic symbol table using both the DT_SYMTAB value ## and the section headers table then we prefer the former and report a warning. -# RUN: yaml2obj --docnum=6 %s -o %t5.so +# RUN: yaml2obj --docnum=5 %s -o %t5.so # RUN: llvm-readobj %t5.so --dyn-symbols 2>&1 | FileCheck -DFILE=%t5.so %s --check-prefixes=PREFER-DTSYMTAB,PREFER-DTSYMTAB-LLVM # RUN: llvm-readelf %t5.so --dyn-symbols 2>&1 | FileCheck -DFILE=%t5.so %s --check-prefixes=PREFER-DTSYMTAB,PREFER-DTSYMTAB-GNU @@ -267,7 +250,7 @@ ## Case 7: Check how we dump versioned symbols. Use both -V and --dyn-symbols ## to check that printed version is consistent. -# RUN: yaml2obj %s --docnum=7 -o %t6 +# RUN: yaml2obj %s --docnum=6 -o %t6 # RUN: llvm-readobj -V --dyn-symbols %t6 | FileCheck %s --check-prefix=VERSIONED-LLVM # RUN: llvm-readelf -V --dyn-symbols %t6 | FileCheck %s --check-prefix=VERSIONED-GNU @@ -350,15 +333,15 @@ ## Case 8: Check what we print when: ## a) The dynamic symbol table does not exist. -# RUN: yaml2obj %s --docnum=8 -o %t7 +# RUN: yaml2obj %s --docnum=7 -o %t7 # RUN: llvm-readobj --dyn-symbols %t7 | FileCheck %s --check-prefix=NO-DYNSYM-LLVM # RUN: llvm-readelf --dyn-symbols %t7 | count 0 ## b) The dynamic symbol table has a size of 0. -# RUN: yaml2obj %s --docnum=9 -o %t8 +# RUN: yaml2obj %s --docnum=8 -o %t8 # RUN: llvm-readobj --dyn-symbols %t8 | FileCheck %s --check-prefix=NO-DYNSYM-LLVM # RUN: llvm-readelf --dyn-symbols %t8 | count 0 ## c) The dynamic symbol table only contains the null symbol. -# RUN: yaml2obj %s --docnum=10 -o %t9 +# RUN: yaml2obj %s --docnum=9 -o %t9 # RUN: llvm-readobj --dyn-symbols %t9 | FileCheck %s --check-prefix=DYNSYM-EMPTY-LLVM # RUN: llvm-readelf --dyn-symbols %t9 | FileCheck %s --check-prefix=DYNSYM-EMPTY-GNU @@ -409,7 +392,7 @@ ## Case 9: Check what we print when: ## a) The size of the dynamic symbol table is not a multiple of its entry size. -# RUN: yaml2obj %s --docnum=11 -o %t10 +# RUN: yaml2obj %s --docnum=10 -o %t10 # RUN: llvm-readobj --dyn-symbols %t10 2>&1 | FileCheck %s -DFILE=%t10 --check-prefix=DYNSYM-SIZE-INVALID1 # RUN: llvm-readelf --dyn-symbols %t10 2>&1 | FileCheck %s -DFILE=%t10 --check-prefix=DYNSYM-SIZE-INVALID1 @@ -419,7 +402,7 @@ ## information about a location and an entity size of the dynamic symbol table from the section header. ## The code uses sizeof(Elf_Sym) for an entity size, so it can't be incorrect and ## the message printed is a bit shorter. -# RUN: yaml2obj %s --docnum=12 -o %t11 +# RUN: yaml2obj %s --docnum=11 -o %t11 # RUN: llvm-readobj --dyn-symbols %t11 2>&1 | FileCheck %s -DFILE=%t11 --check-prefix=DYNSYM-SIZE-INVALID2 # RUN: llvm-readelf --dyn-symbols %t11 2>&1 | FileCheck %s -DFILE=%t11 --check-prefix=DYNSYM-SIZE-INVALID2 @@ -427,10 +410,10 @@ ## c) In the case when the DT_SYMENT tag is present, we report when it's value does not match the # value of the symbol size for the platform. -# RUN: yaml2obj %s -D BITS=32 --docnum=13 -o %t12 +# RUN: yaml2obj %s -D BITS=32 --docnum=12 -o %t12 # RUN: llvm-readobj --dyn-symbols %t12 2>&1 | FileCheck %s -DFILE=%t12 --check-prefix=DYNSYM-SIZE-INVALID3 # RUN: llvm-readelf --dyn-symbols %t12 2>&1 | FileCheck %s -DFILE=%t12 --check-prefix=DYNSYM-SIZE-INVALID3 -# RUN: yaml2obj %s -D BITS=64 --docnum=13 -o %t13 +# RUN: yaml2obj %s -D BITS=64 --docnum=12 -o %t13 # RUN: llvm-readobj --dyn-symbols %t13 2>&1 | FileCheck %s -DFILE=%t13 --check-prefix=DYNSYM-SIZE-INVALID4 # RUN: llvm-readelf --dyn-symbols %t13 2>&1 | FileCheck %s -DFILE=%t13 --check-prefix=DYNSYM-SIZE-INVALID4 @@ -490,7 +473,7 @@ ## Check we report a warning when the DT_STRSZ value is broken so that the dynamic string ## table goes past the end of the file. Document we stop dumping symbols and report an error. -# RUN: yaml2obj %s --docnum=14 -o %t14 +# RUN: yaml2obj %s --docnum=13 -o %t14 # RUN: llvm-readobj --dyn-symbols %t14 2>&1 | \ # RUN: FileCheck %s -DFILE=%t14 --check-prefix=DYNSTR-INVALID-LLVM # RUN: llvm-readelf --dyn-symbols %t14 2>&1 | \ @@ -570,7 +553,7 @@ - Section: .dynamic ## Check we report a warning when the entry size of the dynamic symbol table is zero. -# RUN: yaml2obj %s --docnum=15 -o %t15 +# RUN: yaml2obj %s --docnum=14 -o %t15 # RUN: llvm-readobj --dyn-symbols %t15 2>&1 | FileCheck %s -DFILE=%t15 --check-prefix=DYNSYM-ZERO-ENTSIZE-LLVM # RUN: llvm-readelf --dyn-symbols %t15 2>&1 | \ # RUN: FileCheck %s -DFILE=%t15 --check-prefix=DYNSYM-ZERO-ENTSIZE-GNU --implicit-check-not="Symbol table" Index: llvm/test/tools/llvm-readobj/ELF/dynamic-reloc-no-section-headers.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/dynamic-reloc-no-section-headers.test +++ llvm/test/tools/llvm-readobj/ELF/dynamic-reloc-no-section-headers.test @@ -21,10 +21,6 @@ Data: ELFDATA2LSB Type: ET_DYN Machine: EM_X86_64 -## We simulate no section header table by -## overriding the ELF header properties. - EShOff: 0x0 - EShNum: 0x0 Sections: - Name: .rela.dyn Type: SHT_RELA @@ -66,3 +62,5 @@ - Type: PT_DYNAMIC Sections: - Section: .dynamic +SectionHeaderTable: + NoHeaders: true Index: llvm/test/tools/llvm-readobj/ELF/dynamic-table-dtnull.s =================================================================== --- llvm/test/tools/llvm-readobj/ELF/dynamic-table-dtnull.s +++ llvm/test/tools/llvm-readobj/ELF/dynamic-table-dtnull.s @@ -15,26 +15,21 @@ --- !ELF FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 Sections: - - Name: .dynamic - Type: SHT_DYNAMIC - Address: 0x0000000000001010 - AddressAlign: 0x0000000000000010 - EntSize: 0x0000000000000010 + - Name: .dynamic + Type: SHT_DYNAMIC Entries: - - Tag: DT_DEBUG - Value: 0x0000000000000000 + - Tag: DT_DEBUG + Value: 0x0000000000000000 ProgramHeaders: - Type: PT_LOAD - VAddr: 0x1000 Sections: - Section: .dynamic - Type: PT_DYNAMIC - VAddr: 0x1010 Sections: - Section: .dynamic @@ -59,29 +54,24 @@ --- !ELF FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 Sections: - - Name: .dynamic - Type: SHT_DYNAMIC - Address: 0x0000000000001010 - AddressAlign: 0x0000000000000010 - EntSize: 0x0000000000000010 + - Name: .dynamic + Type: SHT_DYNAMIC Entries: - - Tag: DT_DEBUG - Value: 0x0000000000000000 - - Tag: DT_NULL - Value: 0x0000000000000000 - - Tag: DT_NULL - Value: 0x0000000000000000 + - Tag: DT_DEBUG + Value: 0x0000000000000000 + - Tag: DT_NULL + Value: 0x0000000000000000 + - Tag: DT_NULL + Value: 0x0000000000000000 ProgramHeaders: - Type: PT_LOAD - VAddr: 0x1000 Sections: - Section: .dynamic - Type: PT_DYNAMIC - VAddr: 0x1010 Sections: - Section: .dynamic Index: llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test +++ llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test @@ -140,11 +140,11 @@ --- !ELF FileHeader: - Class: ELFCLASS64 + Class: ELFCLASS[[BITS=64]] Data: ELFDATA2LSB Type: ET_EXEC - Machine: EM_X86_64 - EPhEntSize: [[PHENTSIZE=56]] + Machine: EM_NONE + EPhEntSize: [[PHENTSIZE=]] Sections: - Name: .dynstr Type: SHT_STRTAB @@ -186,7 +186,7 @@ - Tag: DT_RPATH Value: 0x5 - Tag: DT_SYMBOLIC - Value: 0x1234567890abcdef + Value: [[SYMBOLIC=0x1234567890abcdef]] - Tag: DT_REL Value: 0x1000 - Tag: DT_RELSZ @@ -196,13 +196,13 @@ - Tag: DT_PLTREL Value: 0x7 - Tag: DT_DEBUG - Value: 0xfedcba0987654321 + Value: [[DEBUG=0xfedcba0987654321]] - Tag: DT_TEXTREL - Value: 0x1122334455667788 + Value: [[TEXTREL=0x1122334455667788]] - Tag: DT_JMPREL Value: 0x1000 - Tag: DT_BIND_NOW - Value: 0x8877665544332211 + Value: [[BINDNOW=0x8877665544332211]] - Tag: DT_INIT_ARRAY Value: 0x1000 - Tag: DT_FINI_ARRAY @@ -214,7 +214,7 @@ - Tag: DT_RUNPATH Value: 0x7 - Tag: DT_FLAGS - Value: 0xffffffffffffffff + Value: [[FLAGS=0xffffffffffffffff]] - Tag: DT_PREINIT_ARRAY Value: 0x1000 - Tag: DT_PREINIT_ARRAYSZ @@ -252,7 +252,7 @@ - Tag: DT_RELCOUNT Value: 0x0 - Tag: DT_FLAGS_1 - Value: 0xffffffffffffffff + Value: [[FLAGS=0xffffffffffffffff]] - Tag: DT_VERSYM Value: 0x1000 - Tag: DT_VERDEF @@ -272,13 +272,13 @@ ## Show behaviour for unknown values in special and un-marked ranges. ## An arbitrary unknown value outside of the special ranges. - Tag: 0x12345678 - Value: 0x8765432187654321 + Value: [[UNKNOWN=0x8765432187654321]] ## An OS specific tag. - Tag: 0x6abcdef0 - Value: 0x9988776655443322 + Value: [[OSSPEC=0x9988776655443322]] ## A processor specific tags. - Tag: 0x76543210 - Value: 0x5555666677778888 + Value: [[PROCSPEC=0x5555666677778888]] - Tag: DT_NULL Value: 0x0 ProgramHeaders: @@ -292,7 +292,9 @@ Sections: - Section: .dynamic -# RUN: yaml2obj %s --docnum=2 -o %t2 +# RUN: yaml2obj %s --docnum=1 -DBITS=32 -DSYMBOLIC=0x12345678 -DDEBUG=0xfedcba09 \ +# RUN: -DTEXTREL=0x11223344 -DBINDNOW=0x88776655 -DFLAGS=0xffffffff \ +# RUN: -DUNKNOWN=0x87654321 -DOSSPEC=0x99887766 -DPROCSPEC=0x55556666 -o %t2 # RUN: llvm-readobj --dynamic-table %t2 \ # RUN: | FileCheck %s --check-prefix=LLVM32 --strict-whitespace --match-full-lines # RUN: llvm-readobj -d %t2 | FileCheck %s --check-prefix=LLVM32 --strict-whitespace --match-full-lines @@ -429,169 +431,16 @@ # GNU32-NEXT: 0x76543210 (0x76543210) 0x55556666 # GNU32-NEXT: 0x00000000 (NULL) 0x0 ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_386 -Sections: - - Name: .dynstr - Type: SHT_STRTAB - Address: 0x1000 - Size: 0x10 - Content: "004400550066007700" - - Name: .dynamic - Type: SHT_DYNAMIC - Address: 0x1010 - Entries: - - Tag: DT_NEEDED - Value: 0x1 - - Tag: DT_PLTRELSZ - Value: 0x10 - - Tag: DT_PLTGOT - Value: 0x1000 - - Tag: DT_HASH - Value: 0x1000 - - Tag: DT_STRTAB - Value: 0x1000 - - Tag: DT_SYMTAB - Value: 0x1000 - - Tag: DT_RELA - Value: 0x1000 - - Tag: DT_RELASZ - Value: 0x10 - - Tag: DT_RELAENT - Value: 0x789 - - Tag: DT_STRSZ - Value: 0x10 - - Tag: DT_SYMENT - Value: 0x987 - - Tag: DT_INIT - Value: 0x1000 - - Tag: DT_FINI - Value: 0x1000 - - Tag: DT_SONAME - Value: 0x3 - - Tag: DT_RPATH - Value: 0x5 - - Tag: DT_SYMBOLIC - Value: 0x12345678 - - Tag: DT_REL - Value: 0x1000 - - Tag: DT_RELSZ - Value: 0x10 - - Tag: DT_RELENT - Value: 0x123 - - Tag: DT_PLTREL - Value: 0x7 - - Tag: DT_DEBUG - Value: 0xfedcba09 - - Tag: DT_TEXTREL - Value: 0x11223344 - - Tag: DT_JMPREL - Value: 0x1000 - - Tag: DT_BIND_NOW - Value: 0x88776655 - - Tag: DT_INIT_ARRAY - Value: 0x1000 - - Tag: DT_FINI_ARRAY - Value: 0x1000 - - Tag: DT_INIT_ARRAYSZ - Value: 0x10 - - Tag: DT_FINI_ARRAYSZ - Value: 0x10 - - Tag: DT_RUNPATH - Value: 0x7 - - Tag: DT_FLAGS - Value: 0xffffffff - - Tag: DT_PREINIT_ARRAY - Value: 0x1000 - - Tag: DT_PREINIT_ARRAYSZ - Value: 0x10 - - Tag: DT_SYMTAB_SHNDX - Value: 0x1000 - - Tag: DT_RELRSZ - Value: 0x10 - - Tag: DT_RELR - Value: 0x1000 - - Tag: DT_RELRENT - Value: 0x4321 - - Tag: DT_ANDROID_REL - Value: 0x1000 - - Tag: DT_ANDROID_RELSZ - Value: 0x10 - - Tag: DT_ANDROID_RELA - Value: 0x1000 - - Tag: DT_ANDROID_RELASZ - Value: 0x10 - - Tag: DT_ANDROID_RELR - Value: 0x1000 - - Tag: DT_ANDROID_RELRSZ - Value: 0x10 - - Tag: DT_ANDROID_RELRENT - Value: 0x1234 - - Tag: DT_GNU_HASH - Value: 0x1000 - - Tag: DT_TLSDESC_PLT - Value: 0x1000 - - Tag: DT_TLSDESC_GOT - Value: 0x1000 - - Tag: DT_RELACOUNT - Value: 0x0 - - Tag: DT_RELCOUNT - Value: 0x0 - - Tag: DT_FLAGS_1 - Value: 0xffffffff - - Tag: DT_VERSYM - Value: 0x1000 - - Tag: DT_VERDEF - Value: 0x1000 - - Tag: DT_VERDEFNUM - Value: 0x0 - - Tag: DT_VERNEED - Value: 0x1000 - - Tag: DT_VERNEEDNUM - Value: 0x0 - - Tag: DT_AUXILIARY - Value: 0x1 - - Tag: DT_USED - Value: 0x3 - - Tag: DT_FILTER - Value: 0x3 -## Show behaviour for unknown values in special and un-marked ranges. -## An arbitrary unknown value outside of the special ranges. - - Tag: 0x12345678 - Value: 0x87654321 -## An OS specific tag. - - Tag: 0x6abcdef0 - Value: 0x99887766 -## A processor specific tags. - - Tag: 0x76543210 - Value: 0x55556666 - - Tag: DT_NULL - Value: 0x0 -ProgramHeaders: - - Type: PT_LOAD - VAddr: 0x1000 - Sections: - - Section: .dynstr - - Section: .dynamic - - Type: PT_DYNAMIC - VAddr: 0x1010 - Sections: - - Section: .dynamic - ## When printing the "Name/Value" column we want to have the minimal possible indentation. ## Use an arbitrary dynamic tag to demonstrate this. -# RUN: yaml2obj %s --docnum=3 -o %t3 +# RUN: yaml2obj %s --docnum=2 -o %t3 # RUN: llvm-readobj --dynamic-table %t3 \ # RUN: | FileCheck %s --check-prefix=INDENT-LLVM-64 --strict-whitespace # RUN: llvm-readelf --dynamic-table %t3 \ # RUN: | FileCheck %s --check-prefix=INDENT-GNU-64 --strict-whitespace -# RUN: yaml2obj %s --docnum=4 -o %t4 +# RUN: yaml2obj %s --docnum=2 -DBITS=32 -o %t4 # RUN: llvm-readobj --dynamic-table %t4 \ # RUN: | FileCheck %s --check-prefix=INDENT-LLVM-32 --strict-whitespace # RUN: llvm-readelf --dynamic-table %t4 \ @@ -611,25 +460,10 @@ --- !ELF FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 -Sections: - - Name: .dynamic - Type: SHT_DYNAMIC - Entries: - - Tag: DT_NEEDED - Value: 0x1 - - Tag: DT_NULL - Value: 0x0 - ---- !ELF -FileHeader: - Class: ELFCLASS32 + Class: ELFCLASS[[BITS=64]] Data: ELFDATA2LSB Type: ET_EXEC - Machine: EM_386 + Machine: EM_NONE Sections: - Name: .dynamic Type: SHT_DYNAMIC Index: llvm/test/tools/llvm-readobj/ELF/file-header-abi-version.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/file-header-abi-version.test +++ llvm/test/tools/llvm-readobj/ELF/file-header-abi-version.test @@ -1,24 +1,26 @@ ## This is a test to test how the ABI version field (EI_ABIVERSION) of an ELF file header is dumped. ## EI_ABIVERSION is set to zero. -# RUN: yaml2obj %s --docnum=1 -o %t.abiver.zero +# RUN: yaml2obj %s -DABIVERSION=0 -o %t.abiver.zero # RUN: llvm-readobj --file-headers %t.abiver.zero | FileCheck %s --match-full-lines --check-prefix=ABIVER-ZERO-LLVM # RUN: llvm-readelf --file-headers %t.abiver.zero | FileCheck %s --match-full-lines --check-prefix=ABIVER-ZERO-GNU -## EI_ABIVERSION is set to an arbitrary number. -# RUN: yaml2obj %s --docnum=2 -o %t.abiver.any -# RUN: llvm-readobj --file-headers %t.abiver.any | FileCheck %s --match-full-lines --check-prefix=ABIVER-ANY-LLVM -# RUN: llvm-readelf --file-headers %t.abiver.any | FileCheck %s --match-full-lines --check-prefix=ABIVER-ANY-GNU -## EI_ABIVERSION is set to the maximum possible value. -# RUN: yaml2obj %s --docnum=3 -o %t.abiver.max -# RUN: llvm-readobj --file-headers %t.abiver.max | FileCheck %s --match-full-lines --check-prefix=ABIVER-MAX-LLVM -# RUN: llvm-readelf --file-headers %t.abiver.max | FileCheck %s --match-full-lines --check-prefix=ABIVER-MAX-GNU # ABIVER-ZERO-LLVM: ABIVersion: 0 # ABIVER-ZERO-GNU: ABI Version: 0 +## EI_ABIVERSION is set to an arbitrary number. +# RUN: yaml2obj %s -DABIVERSION=52 -o %t.abiver.any +# RUN: llvm-readobj --file-headers %t.abiver.any | FileCheck %s --match-full-lines --check-prefix=ABIVER-ANY-LLVM +# RUN: llvm-readelf --file-headers %t.abiver.any | FileCheck %s --match-full-lines --check-prefix=ABIVER-ANY-GNU + # ABIVER-ANY-LLVM: ABIVersion: 52 # ABIVER-ANY-GNU: ABI Version: 52 +## EI_ABIVERSION is set to the maximum possible value. +# RUN: yaml2obj %s -DABIVERSION=255 -o %t.abiver.max +# RUN: llvm-readobj --file-headers %t.abiver.max | FileCheck %s --match-full-lines --check-prefix=ABIVER-MAX-LLVM +# RUN: llvm-readelf --file-headers %t.abiver.max | FileCheck %s --match-full-lines --check-prefix=ABIVER-MAX-GNU + # ABIVER-MAX-LLVM: ABIVersion: 255 # ABIVER-MAX-GNU: ABI Version: 255 @@ -28,20 +30,4 @@ Data: ELFDATA2LSB Type: ET_REL Machine: EM_X86_64 - ABIVersion: 0x0 - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - ABIVersion: 0x34 - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - ABIVersion: 0xFF + ABIVersion: [[ABIVERSION]] Index: llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test +++ llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test @@ -1,7 +1,7 @@ ## This is a test to test how the OS/ABI identification field (EI_OSABI) of an ELF file header is dumped. ## EI_OSABI is set to ELFOSABI_NONE. -# RUN: yaml2obj %s --docnum=1 -o %t.osabi.none +# RUN: yaml2obj %s -DOSABI=ELFOSABI_NONE -o %t.osabi.none # RUN: llvm-readobj --file-headers %t.osabi.none | FileCheck %s --match-full-lines --check-prefix=OSABI-NONE-LLVM # RUN: llvm-readelf --file-headers %t.osabi.none | FileCheck %s --match-full-lines --check-prefix=OSABI-NONE-GNU @@ -14,292 +14,148 @@ Data: ELFDATA2LSB Type: ET_REL Machine: EM_X86_64 - OSABI: ELFOSABI_NONE + OSABI: [[OSABI]] ## EI_OSABI is set to ELFOSABI_HPUX. -# RUN: yaml2obj %s --docnum=2 -o %t.osabi.hpux +# RUN: yaml2obj %s -DOSABI=ELFOSABI_HPUX -o %t.osabi.hpux # RUN: llvm-readobj --file-headers %t.osabi.hpux | FileCheck %s --match-full-lines --check-prefix=OSABI-HPUX-LLVM # RUN: llvm-readelf --file-headers %t.osabi.hpux | FileCheck %s --match-full-lines --check-prefix=OSABI-HPUX-GNU # OSABI-HPUX-LLVM: OS/ABI: HPUX (0x1) # OSABI-HPUX-GNU: OS/ABI: UNIX - HP-UX ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_HPUX - ## EI_OSABI is set to ELFOSABI_NETBSD. -# RUN: yaml2obj %s --docnum=3 -o %t.osabi.netbsd +# RUN: yaml2obj %s -DOSABI=ELFOSABI_NETBSD -o %t.osabi.netbsd # RUN: llvm-readobj --file-headers %t.osabi.netbsd | FileCheck %s --match-full-lines --check-prefix=OSABI-NETBSD-LLVM # RUN: llvm-readelf --file-headers %t.osabi.netbsd | FileCheck %s --match-full-lines --check-prefix=OSABI-NETBSD-GNU # OSABI-NETBSD-LLVM: OS/ABI: NetBSD (0x2) # OSABI-NETBSD-GNU: OS/ABI: UNIX - NetBSD ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_NETBSD - ## EI_OSABI is set to ELFOSABI_LINUX. -# RUN: yaml2obj %s --docnum=4 -o %t.osabi.linux +# RUN: yaml2obj %s -DOSABI=ELFOSABI_LINUX -o %t.osabi.linux # RUN: llvm-readobj --file-headers %t.osabi.linux | FileCheck %s --match-full-lines --check-prefix=OSABI-LINUX-LLVM # RUN: llvm-readelf --file-headers %t.osabi.linux | FileCheck %s --match-full-lines --check-prefix=OSABI-LINUX-GNU # OSABI-LINUX-LLVM: OS/ABI: GNU/Linux (0x3) # OSABI-LINUX-GNU: OS/ABI: UNIX - GNU ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_LINUX - ## EI_OSABI is set to ELFOSABI_HURD. -# RUN: yaml2obj %s --docnum=5 -o %t.osabi.hurd +# RUN: yaml2obj %s -DOSABI=ELFOSABI_HURD -o %t.osabi.hurd # RUN: llvm-readobj --file-headers %t.osabi.hurd | FileCheck %s --match-full-lines --check-prefix=OSABI-HURD-LLVM # RUN: llvm-readelf --file-headers %t.osabi.hurd | FileCheck %s --match-full-lines --check-prefix=OSABI-HURD-GNU # OSABI-HURD-LLVM: OS/ABI: GNU/Hurd (0x4) # OSABI-HURD-GNU: OS/ABI: GNU/Hurd ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_HURD - ## EI_OSABI is set to ELFOSABI_SOLARIS. -# RUN: yaml2obj %s --docnum=6 -o %t.osabi.solaris +# RUN: yaml2obj %s -DOSABI=ELFOSABI_SOLARIS -o %t.osabi.solaris # RUN: llvm-readobj --file-headers %t.osabi.solaris | FileCheck %s --match-full-lines --check-prefix=OSABI-SOLARIS-LLVM # RUN: llvm-readelf --file-headers %t.osabi.solaris | FileCheck %s --match-full-lines --check-prefix=OSABI-SOLARIS-GNU # OSABI-SOLARIS-LLVM: OS/ABI: Solaris (0x6) # OSABI-SOLARIS-GNU: OS/ABI: UNIX - Solaris ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_SOLARIS - ## EI_OSABI is set to ELFOSABI_AIX. -# RUN: yaml2obj %s --docnum=7 -o %t.osabi.aix +# RUN: yaml2obj %s -DOSABI=ELFOSABI_AIX -o %t.osabi.aix # RUN: llvm-readobj --file-headers %t.osabi.aix | FileCheck %s --match-full-lines --check-prefix=OSABI-AIX-LLVM # RUN: llvm-readelf --file-headers %t.osabi.aix | FileCheck %s --match-full-lines --check-prefix=OSABI-AIX-GNU # OSABI-AIX-LLVM: OS/ABI: AIX (0x7) # OSABI-AIX-GNU: OS/ABI: UNIX - AIX ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_AIX - ## EI_OSABI is set to ELFOSABI_IRIX. -# RUN: yaml2obj %s --docnum=8 -o %t.osabi.irix +# RUN: yaml2obj %s -DOSABI=ELFOSABI_IRIX -o %t.osabi.irix # RUN: llvm-readobj --file-headers %t.osabi.irix | FileCheck %s --match-full-lines --check-prefix=OSABI-IRIX-LLVM # RUN: llvm-readelf --file-headers %t.osabi.irix | FileCheck %s --match-full-lines --check-prefix=OSABI-IRIX-GNU # OSABI-IRIX-LLVM: OS/ABI: IRIX (0x8) # OSABI-IRIX-GNU: OS/ABI: UNIX - IRIX ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_IRIX - ## EI_OSABI is set to ELFOSABI_FREEBSD. -# RUN: yaml2obj %s --docnum=9 -o %t.osabi.freebsd +# RUN: yaml2obj %s -DOSABI=ELFOSABI_FREEBSD -o %t.osabi.freebsd # RUN: llvm-readobj --file-headers %t.osabi.freebsd | FileCheck %s --match-full-lines --check-prefix=OSABI-FREEBSD-LLVM # RUN: llvm-readelf --file-headers %t.osabi.freebsd | FileCheck %s --match-full-lines --check-prefix=OSABI-FREEBSD-GNU # OSABI-FREEBSD-LLVM: OS/ABI: FreeBSD (0x9) # OSABI-FREEBSD-GNU: OS/ABI: UNIX - FreeBSD ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_FREEBSD - ## EI_OSABI is set to ELFOSABI_TRU64. -# RUN: yaml2obj %s --docnum=10 -o %t.osabi.tru64 +# RUN: yaml2obj %s -DOSABI=ELFOSABI_TRU64 -o %t.osabi.tru64 # RUN: llvm-readobj --file-headers %t.osabi.tru64 | FileCheck %s --match-full-lines --check-prefix=OSABI-TRU64-LLVM # RUN: llvm-readelf --file-headers %t.osabi.tru64 | FileCheck %s --match-full-lines --check-prefix=OSABI-TRU64-GNU # OSABI-TRU64-LLVM: OS/ABI: TRU64 (0xA) # OSABI-TRU64-GNU: OS/ABI: UNIX - TRU64 ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_TRU64 - ## EI_OSABI is set to ELFOSABI_MODESTO. -# RUN: yaml2obj %s --docnum=11 -o %t.osabi.modesto +# RUN: yaml2obj %s -DOSABI=ELFOSABI_MODESTO -o %t.osabi.modesto # RUN: llvm-readobj --file-headers %t.osabi.modesto | FileCheck %s --match-full-lines --check-prefix=OSABI-MODESTO-LLVM # RUN: llvm-readelf --file-headers %t.osabi.modesto | FileCheck %s --match-full-lines --check-prefix=OSABI-MODESTO-GNU # OSABI-MODESTO-LLVM: OS/ABI: Modesto (0xB) # OSABI-MODESTO-GNU: OS/ABI: Novell - Modesto ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_MODESTO - ## EI_OSABI is set to ELFOSABI_OPENBSD. -# RUN: yaml2obj %s --docnum=12 -o %t.osabi.openbsd +# RUN: yaml2obj %s -DOSABI=ELFOSABI_OPENBSD -o %t.osabi.openbsd # RUN: llvm-readobj --file-headers %t.osabi.openbsd | FileCheck %s --match-full-lines --check-prefix=OSABI-OPENBSD-LLVM # RUN: llvm-readelf --file-headers %t.osabi.openbsd | FileCheck %s --match-full-lines --check-prefix=OSABI-OPENBSD-GNU # OSABI-OPENBSD-LLVM: OS/ABI: OpenBSD (0xC) # OSABI-OPENBSD-GNU: OS/ABI: UNIX - OpenBSD ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_OPENBSD - ## EI_OSABI is set to ELFOSABI_OPENVMS. -# RUN: yaml2obj %s --docnum=13 -o %t.osabi.openvms +# RUN: yaml2obj %s -DOSABI=ELFOSABI_OPENVMS -o %t.osabi.openvms # RUN: llvm-readobj --file-headers %t.osabi.openvms | FileCheck %s --match-full-lines --check-prefix=OSABI-OPENVMS-LLVM # RUN: llvm-readelf --file-headers %t.osabi.openvms | FileCheck %s --match-full-lines --check-prefix=OSABI-OPENVMS-GNU # OSABI-OPENVMS-LLVM: OS/ABI: OpenVMS (0xD) # OSABI-OPENVMS-GNU: OS/ABI: VMS - OpenVMS ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_OPENVMS - ## EI_OSABI is set to ELFOSABI_NSK. -# RUN: yaml2obj %s --docnum=14 -o %t.osabi.nsk +# RUN: yaml2obj %s -DOSABI=ELFOSABI_NSK -o %t.osabi.nsk # RUN: llvm-readobj --file-headers %t.osabi.nsk | FileCheck %s --match-full-lines --check-prefix=OSABI-NSK-LLVM # RUN: llvm-readelf --file-headers %t.osabi.nsk | FileCheck %s --match-full-lines --check-prefix=OSABI-NSK-GNU # OSABI-NSK-LLVM: OS/ABI: NSK (0xE) # OSABI-NSK-GNU: OS/ABI: HP - Non-Stop Kernel ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_NSK - ## EI_OSABI is set to ELFOSABI_AROS. -# RUN: yaml2obj %s --docnum=15 -o %t.osabi.aros +# RUN: yaml2obj %s -DOSABI=ELFOSABI_AROS -o %t.osabi.aros # RUN: llvm-readobj --file-headers %t.osabi.aros | FileCheck %s --match-full-lines --check-prefix=OSABI-AROS-LLVM # RUN: llvm-readelf --file-headers %t.osabi.aros | FileCheck %s --match-full-lines --check-prefix=OSABI-AROS-GNU # OSABI-AROS-LLVM: OS/ABI: AROS (0xF) # OSABI-AROS-GNU: OS/ABI: AROS ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_AROS - ## EI_OSABI is set to ELFOSABI_FENIXOS. -# RUN: yaml2obj %s --docnum=16 -o %t.osabi.fenixos +# RUN: yaml2obj %s -DOSABI=ELFOSABI_FENIXOS -o %t.osabi.fenixos # RUN: llvm-readobj --file-headers %t.osabi.fenixos | FileCheck %s --match-full-lines --check-prefix=OSABI-FENIXOS-LLVM # RUN: llvm-readelf --file-headers %t.osabi.fenixos | FileCheck %s --match-full-lines --check-prefix=OSABI-FENIXOS-GNU # OSABI-FENIXOS-LLVM: OS/ABI: FenixOS (0x10) # OSABI-FENIXOS-GNU: OS/ABI: FenixOS ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_FENIXOS - ## EI_OSABI is set to ELFOSABI_CLOUDABI. -# RUN: yaml2obj %s --docnum=17 -o %t.osabi.cloudabi +# RUN: yaml2obj %s -DOSABI=ELFOSABI_CLOUDABI -o %t.osabi.cloudabi # RUN: llvm-readobj --file-headers %t.osabi.cloudabi | FileCheck %s --match-full-lines --check-prefix=OSABI-CLOUDABI-LLVM # RUN: llvm-readelf --file-headers %t.osabi.cloudabi | FileCheck %s --match-full-lines --check-prefix=OSABI-CLOUDABI-GNU # OSABI-CLOUDABI-LLVM: OS/ABI: CloudABI (0x11) # OSABI-CLOUDABI-GNU: OS/ABI: CloudABI ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_CLOUDABI - ## EI_OSABI is set to ELFOSABI_STANDALONE. -# RUN: yaml2obj %s --docnum=18 -o %t.osabi.standalone +# RUN: yaml2obj %s -DOSABI=ELFOSABI_STANDALONE -o %t.osabi.standalone # RUN: llvm-readobj --file-headers %t.osabi.standalone | FileCheck %s --match-full-lines --check-prefix=OSABI-STANDALONE-LLVM # RUN: llvm-readelf --file-headers %t.osabi.standalone | FileCheck %s --match-full-lines --check-prefix=OSABI-STANDALONE-GNU # OSABI-STANDALONE-LLVM: OS/ABI: Standalone (0xFF) # OSABI-STANDALONE-GNU: OS/ABI: Standalone App ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: ELFOSABI_STANDALONE - ## EI_OSABI is set to an arbitrary value which is not supported by llvm-readobj/llvm-readelf. -# RUN: yaml2obj %s --docnum=19 -o %t.osabi.unknown +# RUN: yaml2obj %s -DOSABI=0xFE -o %t.osabi.unknown # RUN: llvm-readobj --file-headers %t.osabi.unknown | FileCheck %s --match-full-lines --check-prefix=OSABI-UNKNOWN-LLVM # RUN: llvm-readelf --file-headers %t.osabi.unknown | FileCheck %s --match-full-lines --check-prefix=OSABI-UNKNOWN-GNU # OSABI-UNKNOWN-LLVM: OS/ABI: 0xFE # OSABI-UNKNOWN-GNU: OS/ABI: fe - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - OSABI: 0xFE Index: llvm/test/tools/llvm-readobj/ELF/file-types.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/file-types.test +++ llvm/test/tools/llvm-readobj/ELF/file-types.test @@ -1,6 +1,6 @@ ## Check llvm-readobj and llvm-readelf can dump files of the different ELF types. -# RUN: yaml2obj %s --docnum=1 -o %t1 +# RUN: yaml2obj %s -DTYPE=ET_NONE -o %t1 # RUN: llvm-readobj -h %t1 | FileCheck %s --match-full-lines --check-prefix LLVM-NONE # RUN: llvm-readelf -h %t1 | FileCheck %s --match-full-lines --check-prefix GNU-NONE @@ -14,10 +14,10 @@ FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB - Type: ET_NONE + Type: [[TYPE]] Machine: EM_X86_64 -# RUN: yaml2obj %s --docnum=2 -o %t2 +# RUN: yaml2obj %s -DTYPE=ET_REL -o %t2 # RUN: llvm-readobj -h %t2 | FileCheck %s --match-full-lines --check-prefix LLVM-REL # RUN: llvm-readelf -h %t2 | FileCheck %s --match-full-lines --check-prefix GNU-REL @@ -27,14 +27,7 @@ # GNU-REL: ELF Header: # GNU-REL: Type: REL (Relocatable file) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - -# RUN: yaml2obj %s --docnum=3 -o %t3 +# RUN: yaml2obj %s -DTYPE=ET_EXEC -o %t3 # RUN: llvm-readobj -h %t3 | FileCheck %s --match-full-lines --check-prefix LLVM-EXEC # RUN: llvm-readelf -h %t3 | FileCheck %s --match-full-lines --check-prefix GNU-EXEC @@ -44,14 +37,7 @@ # GNU-EXEC: ELF Header: # GNU-EXEC: Type: EXEC (Executable file) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 - -# RUN: yaml2obj %s --docnum=4 -o %t4 +# RUN: yaml2obj %s -DTYPE=ET_DYN -o %t4 # RUN: llvm-readobj -h %t4 | FileCheck %s --match-full-lines --check-prefix LLVM-DYN # RUN: llvm-readelf -h %t4 | FileCheck %s --match-full-lines --check-prefix GNU-DYN @@ -61,14 +47,7 @@ # GNU-DYN: ELF Header: # GNU-DYN: Type: DYN (Shared object file) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 - -# RUN: yaml2obj %s --docnum=5 -o %t5 +# RUN: yaml2obj %s -DTYPE=ET_CORE -o %t5 # RUN: llvm-readobj -h %t5 | FileCheck %s --match-full-lines --check-prefix LLVM-CORE # RUN: llvm-readelf -h %t5 | FileCheck %s --match-full-lines --check-prefix GNU-CORE @@ -78,14 +57,7 @@ # GNU-CORE: ELF Header: # GNU-CORE: Type: CORE (Core file) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_CORE - Machine: EM_X86_64 - -# RUN: yaml2obj %s --docnum=6 -o %t6 +# RUN: yaml2obj %s -DTYPE=0xfe00 -o %t6 # RUN: llvm-readobj -h %t6 | FileCheck %s --match-full-lines --check-prefix LLVM-LOOS # RUN: llvm-readelf -h %t6 | FileCheck %s --match-full-lines --check-prefix GNU-LOOS @@ -95,14 +67,7 @@ # GNU-LOOS: ELF Header: # GNU-LOOS: Type: fe00 ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: 0xfe00 - Machine: EM_X86_64 - -# RUN: yaml2obj %s --docnum=7 -o %t7 +# RUN: yaml2obj %s -DTYPE=0xfeff -o %t7 # RUN: llvm-readobj -h %t7 | FileCheck %s --match-full-lines --check-prefix LLVM-HIOS # RUN: llvm-readelf -h %t7 | FileCheck %s --match-full-lines --check-prefix GNU-HIOS @@ -112,14 +77,7 @@ # GNU-HIOS: ELF Header: # GNU-HIOS: Type: feff ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: 0xfeff - Machine: EM_X86_64 - -# RUN: yaml2obj %s --docnum=8 -o %t8 +# RUN: yaml2obj %s -DTYPE=0xff00 -o %t8 # RUN: llvm-readobj -h %t8 | FileCheck %s --match-full-lines --check-prefix LLVM-LOPROC # RUN: llvm-readelf -h %t8 | FileCheck %s --match-full-lines --check-prefix GNU-LOPROC @@ -129,14 +87,7 @@ # GNU-LOPROC: ELF Header: # GNU-LOPROC: Type: ff00 ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: 0xff00 - Machine: EM_X86_64 - -# RUN: yaml2obj %s --docnum=9 -o %t9 +# RUN: yaml2obj %s -DTYPE=0xffff -o %t9 # RUN: llvm-readobj -h %t9 | FileCheck %s --match-full-lines --check-prefix LLVM-HIPROC # RUN: llvm-readelf -h %t9 | FileCheck %s --match-full-lines --check-prefix GNU-HIPROC @@ -145,10 +96,3 @@ # GNU-HIPROC: ELF Header: # GNU-HIPROC: Type: ffff - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: 0xffff - Machine: EM_X86_64 Index: llvm/test/tools/llvm-readobj/ELF/gnu-notes.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/gnu-notes.test +++ llvm/test/tools/llvm-readobj/ELF/gnu-notes.test @@ -87,8 +87,8 @@ Data: ELFDATA2LSB Type: ET_EXEC Machine: EM_X86_64 - EPhEntSize: [[PHENTSIZE=56]] - EShNum: [[SHNUM=6]] + EPhEntSize: [[PHENTSIZE=]] + EShNum: [[SHNUM=]] Sections: - Name: .note.ABI-tag Type: SHT_NOTE Index: llvm/test/tools/llvm-readobj/ELF/gnu-phdrs.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/gnu-phdrs.test +++ llvm/test/tools/llvm-readobj/ELF/gnu-phdrs.test @@ -109,7 +109,6 @@ Data: ELFDATA2LSB Type: ET_EXEC Machine: [[MACHINE]] - Entry: 0x12345678 Sections: - Name: .foo.begin Type: SHT_PROGBITS @@ -374,8 +373,8 @@ Data: ELFDATA2LSB Type: ET_EXEC Machine: EM_X86_64 - EPhEntSize: [[PHENTSIZE=56]] - EPhOff: [[PHOFF=64]] + EPhEntSize: [[PHENTSIZE=]] + EPhOff: [[PHOFF=]] Sections: - Name: .foo Type: SHT_PROGBITS Index: llvm/test/tools/llvm-readobj/ELF/gnu-section-mapping-no-phdrs.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/gnu-section-mapping-no-phdrs.test +++ llvm/test/tools/llvm-readobj/ELF/gnu-section-mapping-no-phdrs.test @@ -1,4 +1,4 @@ -## Test the behaviour of --section-mapping when there are no section headers in an object. +## Test the behaviour of --section-mapping when there are no program headers in an object. # RUN: yaml2obj %s -o %t # RUN: llvm-readelf --section-mapping %t | FileCheck %s --strict-whitespace --match-full-lines Index: llvm/test/tools/llvm-readobj/ELF/gnu-section-mapping.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/gnu-section-mapping.test +++ llvm/test/tools/llvm-readobj/ELF/gnu-section-mapping.test @@ -18,7 +18,7 @@ Data: ELFDATA2LSB Type: ET_EXEC Machine: EM_X86_64 - EPhEntSize: [[PHENTSIZE=56]] + EPhEntSize: [[PHENTSIZE=]] Sections: - Name: .foo.begin Type: SHT_PROGBITS Index: llvm/test/tools/llvm-readobj/ELF/gnu-sections.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/gnu-sections.test +++ llvm/test/tools/llvm-readobj/ELF/gnu-sections.test @@ -1,23 +1,24 @@ ## In this test case we check how we print section and flag descriptions for different targets. -## EM_386 is a target that does not have any processor and OS specific flags, +## EM_NONE is a target that does not have any processor and OS specific flags, ## we use it to show how the default flag key is printed. -# RUN: yaml2obj --docnum=1 %s -o %t-i386.o -# RUN: llvm-readelf -S %t-i386.o | FileCheck %s --check-prefix=ELF32 --strict-whitespace --match-full-lines +# RUN: yaml2obj -DBITS=32 %s -o %t-default.o +# RUN: llvm-readelf -S %t-default.o | FileCheck %s --check-prefix=ELF32 --strict-whitespace --match-full-lines -# ELF32:There are 8 section headers, starting at offset 0x90: +# ELF32:There are 9 section headers, starting at offset 0x9c: # ELF32-EMPTY: # ELF32-NEXT:Section Headers: # ELF32-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al # ELF32-NEXT: [ 0] NULL 00000000 000000 000000 00 0 0 0 # ELF32-NEXT: [ 1] .text PROGBITS 00000000 000034 000001 00 AX 0 0 4 -# ELF32-NEXT: [ 2] .rel.text REL 00000000 000038 000000 08 5 1 4 -# ELF32-NEXT: [ 3] .data PROGBITS 00000000 000038 000000 00 WA 0 0 4 -# ELF32-NEXT: [ 4] .bss NOBITS 00000000 000038 000000 00 WA 0 0 4 -# ELF32-NEXT: [ 5] .symtab SYMTAB 00000000 000038 000020 10 6 2 8 -# ELF32-NEXT: [ 6] .strtab STRTAB 00000000 000058 000007 00 0 0 1 -# ELF32-NEXT: [ 7] .shstrtab STRTAB 00000000 00005f 000030 00 0 0 1 +# ELF32-NEXT: [ 2] .rel.text REL 00000000 000038 000000 08 6 1 4 +# ELF32-NEXT: [ 3] .rela.text RELA 00000000 000038 000000 18 6 1 8 +# ELF32-NEXT: [ 4] .data PROGBITS 00000000 000038 000000 00 WA 0 0 4 +# ELF32-NEXT: [ 5] .bss NOBITS 00000000 000038 000000 00 WA 0 0 4 +# ELF32-NEXT: [ 6] .symtab SYMTAB 00000000 000038 000020 10 7 2 8 +# ELF32-NEXT: [ 7] .strtab STRTAB 00000000 000058 000007 00 0 0 1 +# ELF32-NEXT: [ 8] .shstrtab STRTAB 00000000 00005f 00003b 00 0 0 1 # ELF32-NEXT:Key to Flags: # ELF32-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), # ELF32-NEXT: L (link order), O (extra OS processing required), G (group), T (TLS), @@ -26,11 +27,11 @@ --- !ELF FileHeader: - Class: ELFCLASS32 + Class: ELFCLASS[[BITS=64]] Data: ELFDATA2LSB OSABI: ELFOSABI_GNU Type: ET_REL - Machine: EM_386 + Machine: [[MACHINE=EM_NONE]] Sections: - Name: .text Type: SHT_PROGBITS @@ -44,6 +45,13 @@ EntSize: 0x0000000000000008 Info: .text Relocations: + - Name: .rela.text + Type: SHT_RELA + Link: .symtab + AddressAlign: 0x0000000000000008 + EntSize: 0x0000000000000018 + Info: .text + Relocations: - Name: .data Type: SHT_PROGBITS Flags: [ SHF_WRITE, SHF_ALLOC ] @@ -61,7 +69,7 @@ ## For an EM_X86_64 target we print "l" for the SHF_X86_64_LARGE section flag. ## Check we mention it in the flag key. -# RUN: yaml2obj --docnum=2 %s -o %t-x64.o +# RUN: yaml2obj -DMACHINE=EM_X86_64 %s -o %t-x64.o # RUN: llvm-readelf -S %t-x64.o | FileCheck %s --check-prefix=ELF64 --strict-whitespace --match-full-lines ## Check that --wide is the same as -W and ignored and also @@ -72,62 +80,29 @@ # RUN: | FileCheck %s --check-prefix=ELF64 # RUN: llvm-readelf -W -S %t-x64.o | FileCheck %s --check-prefix=ELF64 -# ELF64:There are 8 section headers, starting at offset 0xb0: +# ELF64:There are 9 section headers, starting at offset 0xc0: # ELF64-EMPTY: # ELF64-NEXT:Section Headers: # ELF64-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al # ELF64-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 # ELF64-NEXT: [ 1] .text PROGBITS 0000000000000000 000040 000001 00 AX 0 0 4 -# ELF64-NEXT: [ 2] .rela.text RELA 0000000000000000 000048 000000 18 5 1 8 -# ELF64-NEXT: [ 3] .data PROGBITS 0000000000000000 000048 000000 00 WA 0 0 4 -# ELF64-NEXT: [ 4] .bss NOBITS 0000000000000000 000048 000000 00 WA 0 0 4 -# ELF64-NEXT: [ 5] .symtab SYMTAB 0000000000000000 000048 000030 18 6 2 8 -# ELF64-NEXT: [ 6] .strtab STRTAB 0000000000000000 000078 000007 00 0 0 1 -# ELF64-NEXT: [ 7] .shstrtab STRTAB 0000000000000000 00007f 000031 00 0 0 1 +# ELF64-NEXT: [ 2] .rel.text REL 0000000000000000 000044 000000 08 6 1 4 +# ELF64-NEXT: [ 3] .rela.text RELA 0000000000000000 000048 000000 18 6 1 8 +# ELF64-NEXT: [ 4] .data PROGBITS 0000000000000000 000048 000000 00 WA 0 0 4 +# ELF64-NEXT: [ 5] .bss NOBITS 0000000000000000 000048 000000 00 WA 0 0 4 +# ELF64-NEXT: [ 6] .symtab SYMTAB 0000000000000000 000048 000030 18 7 2 8 +# ELF64-NEXT: [ 7] .strtab STRTAB 0000000000000000 000078 000007 00 0 0 1 +# ELF64-NEXT: [ 8] .shstrtab STRTAB 0000000000000000 00007f 00003b 00 0 0 1 # ELF64-NEXT:Key to Flags: # ELF64-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), # ELF64-NEXT: L (link order), O (extra OS processing required), G (group), T (TLS), # ELF64-NEXT: C (compressed), x (unknown), o (OS specific), E (exclude), # ELF64-NEXT: l (large), p (processor specific) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - EntSize: 0x0000000000000018 - Info: .text - Relocations: - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 - Content: '' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - AddressAlign: 0x0000000000000004 -Symbols: - - Name: .text - Type: STT_SECTION - Section: .text - ## For an EM_ARM target we print "y" for the SHF_ARM_PURECODE section flag. ## Check we mention it in the flag key. -# RUN: yaml2obj --docnum=3 %s -o %t-arm.o +# RUN: yaml2obj -DMACHINE=EM_ARM %s -o %t-arm.o # RUN: llvm-readelf -S %t-arm.o | FileCheck %s --check-prefix=ARM --strict-whitespace --match-full-lines # ARM:Key to Flags: @@ -135,11 +110,3 @@ # ARM-NEXT: L (link order), O (extra OS processing required), G (group), T (TLS), # ARM-NEXT: C (compressed), x (unknown), o (OS specific), E (exclude), # ARM-NEXT: y (purecode), p (processor specific) - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_ARM -Sections: [] Index: llvm/test/tools/llvm-readobj/ELF/hidden-versym.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/hidden-versym.test +++ llvm/test/tools/llvm-readobj/ELF/hidden-versym.test @@ -7,36 +7,30 @@ --- !ELF FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 - Entry: 0x0000000000201000 + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 Sections: - - Name: .gnu.version - Type: SHT_GNU_versym - Flags: [ SHF_ALLOC ] - Address: 0x0000000000200210 - Link: .dynsym - AddressAlign: 0x0000000000000002 - EntSize: 0x0000000000000002 - Entries: [ 0, 0x8003 ] - - Name: .gnu.version_r - Type: SHT_GNU_verneed - Flags: [ SHF_ALLOC ] - Address: 0x0000000000200250 - Link: .dynstr - AddressAlign: 0x0000000000000004 - Info: 0x0000000000000001 + - Name: .gnu.version + Type: SHT_GNU_versym + Flags: [ SHF_ALLOC ] + Address: 0x0000000000200210 + Link: .dynsym + Entries: [ 0, 0x8003 ] + - Name: .gnu.version_r + Type: SHT_GNU_verneed + Flags: [ SHF_ALLOC ] + Link: .dynstr + Info: 0x0000000000000001 Dependencies: - - Version: 1 - File: somefile + - Version: 1 + File: somefile Entries: - - Name: hiddensym - Hash: 1234 - Flags: 0 - Other: 3 + - Name: hiddensym + Hash: 1234 + Flags: 0 + Other: 3 DynamicSymbols: - - Name: h - Binding: STB_GLOBAL -... + - Name: h + Binding: STB_GLOBAL Index: llvm/test/tools/llvm-readobj/ELF/merged.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/merged.test +++ llvm/test/tools/llvm-readobj/ELF/merged.test @@ -1,13 +1,13 @@ -# Check merged args produce identical output to when not merged. -RUN: llvm-readelf -aeWhSrnudlVgIs %p/Inputs/trivial.obj.elf-i386 > %t.merged -RUN: llvm-readelf -a -e -W -h -S -r -n -u -d -l -V -g -I -s %p/Inputs/trivial.obj.elf-i386 > %t.not-merged -RUN: cmp %t.merged %t.not-merged -RUN: FileCheck %s --input-file %t.merged +## Check merged args produce identical output to when not merged. +# RUN: llvm-readelf -aeWhSrnudlVgIs %p/Inputs/trivial.obj.elf-i386 > %t.merged +# RUN: llvm-readelf -a -e -W -h -S -r -n -u -d -l -V -g -I -s %p/Inputs/trivial.obj.elf-i386 > %t.not-merged +# RUN: cmp %t.merged %t.not-merged +# RUN: FileCheck %s --input-file %t.merged -# llvm-readobj does not support merged args, because it also supports some old -# flags (-st, -sd, etc.), and it would be confusing if only some merged args -# were supported. -RUN: not llvm-readobj -aeWhSrnudlVgIs %p/Inputs/trivial.obj.elf-i386 2>&1 | FileCheck %s --check-prefix=UNKNOWN +## llvm-readobj does not support merged args, because it also supports some old +## flags (-st, -sd, etc.), and it would be confusing if only some merged args +## were supported. +# RUN: not llvm-readobj -aeWhSrnudlVgIs %p/Inputs/trivial.obj.elf-i386 2>&1 | FileCheck %s --check-prefix=UNKNOWN -CHECK-NOT: Unknown command line argument -UNKNOWN: for the --section-headers option: may only occur zero or one times! +# CHECK-NOT: Unknown command line argument +# UNKNOWN: for the --section-headers option: may only occur zero or one times! Index: llvm/test/tools/llvm-readobj/ELF/mips-got-overlapped.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/mips-got-overlapped.test +++ llvm/test/tools/llvm-readobj/ELF/mips-got-overlapped.test @@ -3,43 +3,43 @@ # address as the .got. got-over.exe.elf-mips has zero-sized .data # section at the same offset .got section. -RUN: llvm-readobj -A %p/Inputs/got-over.exe.elf-mips | FileCheck %s +# RUN: llvm-readobj -A %p/Inputs/got-over.exe.elf-mips | FileCheck %s -GOT-OBJ: Cannot find PLTGOT dynamic table tag. +# GOT-OBJ: Cannot find PLTGOT dynamic table tag. -CHECK: Primary GOT { -CHECK-NEXT: Canonical gp value: 0x418270 -CHECK-NEXT: Reserved entries [ -CHECK-NEXT: Entry { -CHECK-NEXT: Address: 0x410280 -CHECK-NEXT: Access: -32752 -CHECK-NEXT: Initial: 0x0 -CHECK-NEXT: Purpose: Lazy resolver -CHECK-NEXT: } -CHECK-NEXT: Entry { -CHECK-NEXT: Address: 0x410284 -CHECK-NEXT: Access: -32748 -CHECK-NEXT: Initial: 0x80000000 -CHECK-NEXT: Purpose: Module pointer (GNU extension) -CHECK-NEXT: } -CHECK-NEXT: ] -CHECK-NEXT: Local entries [ -CHECK-NEXT: Entry { -CHECK-NEXT: Address: 0x410288 -CHECK-NEXT: Access: -32744 -CHECK-NEXT: Initial: 0x4001B8 -CHECK-NEXT: } -CHECK-NEXT: ] -CHECK-NEXT: Global entries [ -CHECK-NEXT: Entry { -CHECK-NEXT: Address: 0x41028C -CHECK-NEXT: Access: -32740 -CHECK-NEXT: Initial: 0x0 -CHECK-NEXT: Value: 0x0 -CHECK-NEXT: Type: None -CHECK-NEXT: Section: Undefined -CHECK-NEXT: Name: _foo -CHECK-NEXT: } -CHECK-NEXT: ] -CHECK-NEXT: Number of TLS and multi-GOT entries: 0 -CHECK-NEXT: } +# CHECK: Primary GOT { +# CHECK-NEXT: Canonical gp value: 0x418270 +# CHECK-NEXT: Reserved entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x410280 +# CHECK-NEXT: Access: -32752 +# CHECK-NEXT: Initial: 0x0 +# CHECK-NEXT: Purpose: Lazy resolver +# CHECK-NEXT: } +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x410284 +# CHECK-NEXT: Access: -32748 +# CHECK-NEXT: Initial: 0x80000000 +# CHECK-NEXT: Purpose: Module pointer (GNU extension) +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Local entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x410288 +# CHECK-NEXT: Access: -32744 +# CHECK-NEXT: Initial: 0x4001B8 +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Global entries [ +# CHECK-NEXT: Entry { +# CHECK-NEXT: Address: 0x41028C +# CHECK-NEXT: Access: -32740 +# CHECK-NEXT: Initial: 0x0 +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Type: None +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: Name: _foo +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: Number of TLS and multi-GOT entries: 0 +# CHECK-NEXT: } Index: llvm/test/tools/llvm-readobj/ELF/mips-options.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/mips-options.test +++ llvm/test/tools/llvm-readobj/ELF/mips-options.test @@ -1,22 +1,22 @@ -# Check DT_MIPS_OPTIONS .dynamic section tag reading +## Check DT_MIPS_OPTIONS .dynamic section tag reading -RUN: llvm-readobj --dynamic-table %p/Inputs/mips-options.elf-mips64el | \ -RUN: FileCheck %s +# RUN: llvm-readobj --dynamic-table %p/Inputs/mips-options.elf-mips64el | \ +# RUN: FileCheck %s -CHECK: DynamicSection [ (14 entries) -CHECK-NEXT: Tag Type Name/Value -CHECK-NEXT: 0x0000000000000004 HASH 0x158 -CHECK-NEXT: 0x0000000000000005 STRTAB 0x1C0 -CHECK-NEXT: 0x0000000000000006 SYMTAB 0x178 -CHECK-NEXT: 0x000000000000000A STRSZ 7 (bytes) -CHECK-NEXT: 0x000000000000000B SYMENT 24 (bytes) -CHECK-NEXT: 0x0000000070000001 MIPS_RLD_VERSION 1 -CHECK-NEXT: 0x0000000070000005 MIPS_FLAGS NOTPOT -CHECK-NEXT: 0x0000000070000006 MIPS_BASE_ADDRESS 0x0 -CHECK-NEXT: 0x000000007000000A MIPS_LOCAL_GOTNO 2 -CHECK-NEXT: 0x0000000070000011 MIPS_SYMTABNO 3 -CHECK-NEXT: 0x0000000070000013 MIPS_GOTSYM 0x3 -CHECK-NEXT: 0x0000000000000003 PLTGOT 0x2000 -CHECK-NEXT: 0x0000000070000029 MIPS_OPTIONS 0x1000 -CHECK-NEXT: 0x0000000000000000 NULL 0x0 -CHECK-NEXT: ] +# CHECK: DynamicSection [ (14 entries) +# CHECK-NEXT: Tag Type Name/Value +# CHECK-NEXT: 0x0000000000000004 HASH 0x158 +# CHECK-NEXT: 0x0000000000000005 STRTAB 0x1C0 +# CHECK-NEXT: 0x0000000000000006 SYMTAB 0x178 +# CHECK-NEXT: 0x000000000000000A STRSZ 7 (bytes) +# CHECK-NEXT: 0x000000000000000B SYMENT 24 (bytes) +# CHECK-NEXT: 0x0000000070000001 MIPS_RLD_VERSION 1 +# CHECK-NEXT: 0x0000000070000005 MIPS_FLAGS NOTPOT +# CHECK-NEXT: 0x0000000070000006 MIPS_BASE_ADDRESS 0x0 +# CHECK-NEXT: 0x000000007000000A MIPS_LOCAL_GOTNO 2 +# CHECK-NEXT: 0x0000000070000011 MIPS_SYMTABNO 3 +# CHECK-NEXT: 0x0000000070000013 MIPS_GOTSYM 0x3 +# CHECK-NEXT: 0x0000000000000003 PLTGOT 0x2000 +# CHECK-NEXT: 0x0000000070000029 MIPS_OPTIONS 0x1000 +# CHECK-NEXT: 0x0000000000000000 NULL 0x0 +# CHECK-NEXT: ] Index: llvm/test/tools/llvm-readobj/ELF/mips-rld-map-rel.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/mips-rld-map-rel.test +++ llvm/test/tools/llvm-readobj/ELF/mips-rld-map-rel.test @@ -1,24 +1,24 @@ -# Check DT_MIPS_RLD_MAP_REL .dynamic section tag reading +## Check DT_MIPS_RLD_MAP_REL .dynamic section tag reading -RUN: llvm-readobj --dynamic-table %p/Inputs/mips-rld-map-rel.elf-mipsel | \ -RUN: FileCheck %s +# RUN: llvm-readobj --dynamic-table %p/Inputs/mips-rld-map-rel.elf-mipsel | \ +# RUN: FileCheck %s -CHECK: DynamicSection [ (16 entries) -CHECK-NEXT: Tag Type Name/Value -CHECK-NEXT: 0x00000004 HASH 0x220 -CHECK-NEXT: 0x00000005 STRTAB 0x2FC -CHECK-NEXT: 0x00000006 SYMTAB 0x25C -CHECK-NEXT: 0x0000000A STRSZ 72 (bytes) -CHECK-NEXT: 0x0000000B SYMENT 16 (bytes) -CHECK-NEXT: 0x70000035 MIPS_RLD_MAP_REL 0x101E0 -CHECK-NEXT: 0x00000015 DEBUG 0x0 -CHECK-NEXT: 0x00000003 PLTGOT 0x10390 -CHECK-NEXT: 0x70000001 MIPS_RLD_VERSION 1 -CHECK-NEXT: 0x70000005 MIPS_FLAGS NOTPOT -CHECK-NEXT: 0x70000006 MIPS_BASE_ADDRESS 0x0 -CHECK-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 2 -CHECK-NEXT: 0x70000011 MIPS_SYMTABNO 10 -CHECK-NEXT: 0x70000012 MIPS_UNREFEXTNO 15 -CHECK-NEXT: 0x70000013 MIPS_GOTSYM 0xA -CHECK-NEXT: 0x00000000 NULL 0x0 -CHECK-NEXT: ] +# CHECK: DynamicSection [ (16 entries) +# CHECK-NEXT: Tag Type Name/Value +# CHECK-NEXT: 0x00000004 HASH 0x220 +# CHECK-NEXT: 0x00000005 STRTAB 0x2FC +# CHECK-NEXT: 0x00000006 SYMTAB 0x25C +# CHECK-NEXT: 0x0000000A STRSZ 72 (bytes) +# CHECK-NEXT: 0x0000000B SYMENT 16 (bytes) +# CHECK-NEXT: 0x70000035 MIPS_RLD_MAP_REL 0x101E0 +# CHECK-NEXT: 0x00000015 DEBUG 0x0 +# CHECK-NEXT: 0x00000003 PLTGOT 0x10390 +# CHECK-NEXT: 0x70000001 MIPS_RLD_VERSION 1 +# CHECK-NEXT: 0x70000005 MIPS_FLAGS NOTPOT +# CHECK-NEXT: 0x70000006 MIPS_BASE_ADDRESS 0x0 +# CHECK-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 2 +# CHECK-NEXT: 0x70000011 MIPS_SYMTABNO 10 +# CHECK-NEXT: 0x70000012 MIPS_UNREFEXTNO 15 +# CHECK-NEXT: 0x70000013 MIPS_GOTSYM 0xA +# CHECK-NEXT: 0x00000000 NULL 0x0 +# CHECK-NEXT: ] Index: llvm/test/tools/llvm-readobj/ELF/needed-libs.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/needed-libs.test +++ llvm/test/tools/llvm-readobj/ELF/needed-libs.test @@ -46,7 +46,7 @@ - Tag: DT_NEEDED Value: 0x1111111 - Tag: DT_STRSZ - Value: 0xD + Value: [[SIZE=0xD]] - Tag: DT_NULL Value: 0x0 ProgramHeaders: Index: llvm/test/tools/llvm-readobj/ELF/no-action.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/no-action.test +++ llvm/test/tools/llvm-readobj/ELF/no-action.test @@ -2,7 +2,7 @@ ## Check the behavior on ET_EXEC input. -# RUN: yaml2obj --docnum=1 %s -o %t.exe +# RUN: yaml2obj -DTYPE=ET_EXEC %s -o %t.exe # RUN: llvm-readobj %t.exe | FileCheck %s -DFILE=%t.exe --check-prefix LLVM # RUN: llvm-readelf %t.exe | FileCheck %s -DFILE=%t.exe --check-prefix GNU --allow-empty @@ -20,31 +20,17 @@ FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB - Type: ET_EXEC + Type: [[TYPE]] Machine: EM_X86_64 ## Check the behavior on ET_REL input. -# RUN: yaml2obj --docnum=2 %s -o %t.o +# RUN: yaml2obj -DTYPE=ET_REL %s -o %t.o # RUN: llvm-readobj %t.o | FileCheck %s -DFILE=%t.o --check-prefix LLVM # RUN: llvm-readelf %t.o | FileCheck %s -DFILE=%t.o --check-prefix GNU --allow-empty ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - ## Check the behavior on ET_DYN input. -# RUN: yaml2obj --docnum=3 %s -o %t.so +# RUN: yaml2obj -DTYPE=ET_DYN %s -o %t.so # RUN: llvm-readobj %t.so | FileCheck %s -DFILE=%t.so --check-prefix LLVM # RUN: llvm-readelf %t.so | FileCheck %s -DFILE=%t.so --check-prefix GNU --allow-empty - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 Index: llvm/test/tools/llvm-readobj/ELF/packed-relocs.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/packed-relocs.test +++ llvm/test/tools/llvm-readobj/ELF/packed-relocs.test @@ -27,25 +27,21 @@ # elf-packed-relocs1.s --- !ELF FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 - Entry: 0x0000000000001000 + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_DYN + Machine: EM_X86_64 Sections: - - Name: .rela.dyn - Type: SHT_ANDROID_RELA - Flags: [ SHF_ALLOC ] - Address: 0x00000000000001C8 - Link: .symtab - AddressAlign: 0x0000000000000001 - Content: 41505332088020020108800280010202088180808010818080802002080181808080100802818080802004020C7E048180808010088180808020 + - Name: .rela.dyn + Type: SHT_ANDROID_RELA + Flags: [ SHF_ALLOC ] + Link: .symtab + Content: 41505332088020020108800280010202088180808010818080802002080181808080100802818080802004020C7E048180808010088180808020 Symbols: - - Name: sym1 - Binding: STB_GLOBAL - - Name: sym2 - Binding: STB_GLOBAL -... + - Name: sym1 + Binding: STB_GLOBAL + - Name: sym2 + Binding: STB_GLOBAL # RUN: yaml2obj --docnum=2 %s | llvm-readobj --relocations - | FileCheck --check-prefix=LLVM2 %s # LLVM2: Section (1) .rel.dyn { @@ -77,25 +73,21 @@ # elf-packed-relocs2.s --- !ELF FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_386 - Entry: 0x0000000000001000 + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_DYN + Machine: EM_386 Sections: - - Name: .rel.dyn - Type: SHT_ANDROID_REL - Flags: [ SHF_ALLOC ] - Address: 0x00000000000001C8 - Link: .symtab - AddressAlign: 0x0000000000000001 - Content: 415053320A80200202088102830408037C08 + - Name: .rel.dyn + Type: SHT_ANDROID_REL + Flags: [ SHF_ALLOC ] + Link: .symtab + Content: 415053320A80200202088102830408037C08 Symbols: - - Name: sym1 - Binding: STB_GLOBAL - - Name: sym2 - Binding: STB_GLOBAL -... + - Name: sym1 + Binding: STB_GLOBAL + - Name: sym2 + Binding: STB_GLOBAL # RUN: yaml2obj --docnum=3 %s | llvm-readobj --relocations - | FileCheck --check-prefix=LLVM3 %s # @@ -120,22 +112,18 @@ # elf-packed-relocs3.s --- !ELF FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 - Entry: 0x0000000000001000 + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_DYN + Machine: EM_X86_64 Sections: - - Name: .rela.dyn - Type: SHT_ANDROID_RELA - Flags: [ SHF_ALLOC ] - Address: 0x00000000000001C8 - Link: .symtab - AddressAlign: 0x0000000000000001 - Content: 415053320680200208800208008001080802008001818080801008818080802002080881808080100008818080802008 + - Name: .rela.dyn + Type: SHT_ANDROID_RELA + Flags: [ SHF_ALLOC ] + Link: .symtab + Content: 415053320680200208800208008001080802008001818080801008818080802002080881808080100008818080802008 Symbols: - - Name: sym1 - Binding: STB_GLOBAL - - Name: sym2 - Binding: STB_GLOBAL -... + - Name: sym1 + Binding: STB_GLOBAL + - Name: sym2 + Binding: STB_GLOBAL Index: llvm/test/tools/llvm-readobj/ELF/pt-gnu-property.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/pt-gnu-property.test +++ llvm/test/tools/llvm-readobj/ELF/pt-gnu-property.test @@ -2,6 +2,8 @@ # RUN: llvm-readelf --program-headers %t | FileCheck %s --check-prefix=GNU # RUN: llvm-readobj --program-headers %t | FileCheck %s --check-prefix=LLVM +## TODO: merge this test with program-headers.test. + # GNU: {{ }}GNU_PROPERTY{{ }} # LLVM: ProgramHeader { Index: llvm/test/tools/llvm-readobj/ELF/reloc-symbol-with-versioning.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/reloc-symbol-with-versioning.test +++ llvm/test/tools/llvm-readobj/ELF/reloc-symbol-with-versioning.test @@ -21,88 +21,69 @@ # LLVM-NEXT: ] --- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 - Entry: 0x0000000000000000 -Sections: - - Name: .gnu.version - Type: SHT_GNU_versym - Flags: [ SHF_ALLOC ] - Link: .dynsym - AddressAlign: 0x0000000000000002 - EntSize: 0x0000000000000002 - Entries: [ 0, 2, 3, 4, 2 ] - - Name: .gnu.version_r - Type: SHT_GNU_verneed - Flags: [ SHF_ALLOC ] - Link: .dynstr - AddressAlign: 0x0000000000000004 - Info: 0x0000000000000002 - Dependencies: - - Version: 1 - File: verneed1.so.0 - Entries: - - Name: v2 - Hash: 1938 - Flags: 0 - Other: 3 - - Name: v3 - Hash: 1939 - Flags: 0 - Other: 2 - - Version: 1 - File: verneed2.so.0 - Entries: - - Name: v1 - Hash: 1937 - Flags: 0 - Other: 4 - - Name: .rela.plt - Type: SHT_RELA - Flags: [ SHF_ALLOC ] - Info: 0 - Link: .dynsym - AddressAlign: 0x0000000000000008 - EntSize: 0x0000000000000018 - Relocations: - - Offset: 0x0000000000013018 - Symbol: f1 - Type: R_X86_64_JUMP_SLOT - - Offset: 0x0000000000013020 - Symbol: f2 - Type: R_X86_64_JUMP_SLOT - - Offset: 0x0000000000013028 - Symbol: g1 - Type: R_X86_64_JUMP_SLOT - - Offset: 0x0000000000013040 - Symbol: _Z2f1v - Type: R_X86_64_JUMP_SLOT - - Offset: 0x0000000000013058 - Symbol: f3 - Type: R_X86_64_JUMP_SLOT -Symbols: - - Name: f1 - Binding: STB_GLOBAL - - Name: f2 - Binding: STB_GLOBAL - - Name: g1 - Binding: STB_GLOBAL - - Name: _Z2f1v - Binding: STB_GLOBAL - - Name: f3 - Binding: STB_GLOBAL +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 +Sections: + - Name: .gnu.version + Type: SHT_GNU_versym + Flags: [ SHF_ALLOC ] + Entries: [ 0, 2, 3, 4, 2 ] + - Name: .gnu.version_r + Type: SHT_GNU_verneed + Flags: [ SHF_ALLOC ] + Link: .dynstr + AddressAlign: 0x0000000000000004 + Info: 0x0000000000000002 + Dependencies: + - Version: 1 + File: verneed1.so.0 + Entries: + - Name: v2 + Hash: 1938 + Flags: 0 + Other: 3 + - Name: v3 + Hash: 1939 + Flags: 0 + Other: 2 + - Version: 1 + File: verneed2.so.0 + Entries: + - Name: v1 + Hash: 1937 + Flags: 0 + Other: 4 + - Name: .rela.plt + Type: SHT_RELA + Flags: [ SHF_ALLOC ] + Link: .dynsym + Relocations: + - Offset: 0x0000000000013018 + Symbol: f1 + Type: R_X86_64_JUMP_SLOT + - Offset: 0x0000000000013020 + Symbol: f2 + Type: R_X86_64_JUMP_SLOT + - Offset: 0x0000000000013028 + Symbol: g1 + Type: R_X86_64_JUMP_SLOT + - Offset: 0x0000000000013040 + Symbol: _Z2f1v + Type: R_X86_64_JUMP_SLOT + - Offset: 0x0000000000013058 + Symbol: f3 + Type: R_X86_64_JUMP_SLOT DynamicSymbols: - - Name: f1 - Binding: STB_GLOBAL - - Name: f2 - Binding: STB_GLOBAL - - Name: g1 - Binding: STB_GLOBAL - - Name: _Z2f1v - Binding: STB_GLOBAL - - Name: f3 - Binding: STB_GLOBAL -... + - Name: f1 + Binding: STB_GLOBAL + - Name: f2 + Binding: STB_GLOBAL + - Name: g1 + Binding: STB_GLOBAL + - Name: _Z2f1v + Binding: STB_GLOBAL + - Name: f3 + Binding: STB_GLOBAL Index: llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-aarch64.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-aarch64.test +++ llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-aarch64.test @@ -136,14 +136,8 @@ Type: ET_REL Machine: EM_AARCH64 Sections: - - Name: .text - Type: SHT_PROGBITS - Content: 00 - - Name: .rela.text - Type: SHT_RELA - AddressAlign: 0x0000000000000008 - EntSize: 0x0000000000000018 - Info: .text + - Name: .rela.text + Type: SHT_RELA Relocations: - Type: R_AARCH64_NONE - Type: R_AARCH64_ABS64 Index: llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-arm.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-arm.test +++ llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-arm.test @@ -142,16 +142,9 @@ Data: ELFDATA2LSB Type: ET_REL Machine: EM_ARM - Flags: [ EF_ARM_EABI_VER5 ] Sections: - - Name: .text - Type: SHT_PROGBITS - Content: 00 - - Name: .rel.text - Type: SHT_REL - AddressAlign: 0x0000000000000004 - EntSize: 0x0000000000000008 - Info: .text + - Name: .rel.text + Type: SHT_REL Relocations: - Type: R_ARM_NONE - Type: R_ARM_PC24 Index: llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-i386.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-i386.test +++ llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-i386.test @@ -47,7 +47,7 @@ # LLVM: Type: R_386_IRELATIVE (42) # LLVM: Type: R_386_GOT32X (43) -# GNU: Relocation section '.rel.text' at offset 0x38 contains 41 entries: +# GNU: Relocation section '.rel.text' at offset 0x34 contains 41 entries: # GNU-NEXT: Offset Info Type Sym. Value Symbol's Name # GNU-NEXT: 00000002 00000100 R_386_NONE 00000000 foo # GNU-NEXT: 00000008 00000101 R_386_32 00000000 foo @@ -93,21 +93,14 @@ --- !ELF FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU - Type: ET_REL - Machine: EM_386 + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_386 Sections: - - Name: .text - Type: SHT_PROGBITS - Content: 00 - - Name: .rel.text - Type: SHT_REL - Link: .symtab - AddressAlign: 0x0000000000000004 - EntSize: 0x0000000000000008 - Info: .text + - Name: .rel.text + Type: SHT_REL + Link: .symtab Relocations: - Offset: 0x0000000000000002 Type: R_386_NONE Index: llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-lanai.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-lanai.test +++ llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-lanai.test @@ -19,16 +19,8 @@ Type: ET_REL Machine: EM_LANAI Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - AddressAlign: 0x0000000000000004 - Content: 00 - - Name: .rela.text - Type: SHT_RELA - AddressAlign: 0x0000000000000004 - EntSize: 0x000000000000000C - Info: .text + - Name: .rela.text + Type: SHT_RELA Relocations: - Type: R_LANAI_NONE - Type: R_LANAI_21 Index: llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-mips.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-mips.test +++ llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-mips.test @@ -61,18 +61,11 @@ FileHeader: Class: ELFCLASS32 Data: ELFDATA2MSB - OSABI: ELFOSABI_GNU Type: ET_REL Machine: EM_MIPS Sections: - - Name: .text - Type: SHT_PROGBITS - Content: 00 - - Name: .rel.text - Type: SHT_REL - AddressAlign: 0x0000000000000004 - EntSize: 0x0000000000000008 - Info: .text + - Name: .rel.text + Type: SHT_REL Relocations: - Type: R_MIPS_NONE - Type: R_MIPS_16 Index: llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-mips64.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-mips64.test +++ llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-mips64.test @@ -61,18 +61,11 @@ FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU Type: ET_REL Machine: EM_MIPS Sections: - - Name: .text - Type: SHT_PROGBITS - Content: 00 - - Name: .rela.text - Type: SHT_RELA - AddressAlign: 0x0000000000000008 - EntSize: 0x0000000000000018 - Info: .text + - Name: .rela.text + Type: SHT_RELA Relocations: - Type: R_MIPS_NONE - Type: R_MIPS_16 Index: llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-x64.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-x64.test +++ llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-x64.test @@ -46,7 +46,7 @@ # LLVM: Type: R_X86_64_GOTPCRELX (41) # LLVM: Type: R_X86_64_REX_GOTPCRELX (42) -# GNU: Relocation section '.rela.text' at offset 0x48 contains 40 entries: +# GNU: Relocation section '.rela.text' at offset 0x40 contains 40 entries: # GNU-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend # GNU-NEXT: 0000000000000003 0000000100000000 R_X86_64_NONE 0000000000000000 foo + 0 # GNU-NEXT: 000000000000000a 0000000100000001 R_X86_64_64 0000000000000000 foo + 0 @@ -93,19 +93,11 @@ FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB - OSABI: ELFOSABI_GNU Type: ET_REL Machine: EM_X86_64 Sections: - - Name: .text - Type: SHT_PROGBITS - Content: 00 - - Name: .rela.text - Type: SHT_RELA - Link: .symtab - AddressAlign: 0x0000000000000008 - EntSize: 0x0000000000000018 - Info: .text + - Name: .rela.text + Type: SHT_RELA Relocations: - Offset: 0x0000000000000003 Type: R_X86_64_NONE Index: llvm/test/tools/llvm-readobj/ELF/sections.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/sections.test +++ llvm/test/tools/llvm-readobj/ELF/sections.test @@ -1,9 +1,9 @@ ## Check how llvm-readobj prints sections with --sections. ## We test the --sections flag for llvm-readelf in the gnu-sections.test. -# RUN: yaml2obj --docnum=1 %s -o %t64 +# RUN: yaml2obj %s -o %t64 # RUN: llvm-readobj --sections %t64 | FileCheck %s --check-prefixes=ELF,ELF64 -# RUN: yaml2obj --docnum=2 %s -o %t32 +# RUN: yaml2obj -DBITS=32 %s -o %t32 # RUN: llvm-readobj --sections %t32 | FileCheck %s --check-prefixes=ELF,ELF32 ## Check flag aliases produce identical output. @@ -89,27 +89,10 @@ --- !ELF FileHeader: - Class: ELFCLASS64 + Class: ELFCLASS[[BITS=64]] Data: ELFDATA2LSB Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .foo - Type: SHT_PROGBITS - Info: 1 - Address: 0x2 - Size: 0x3 - Flags: [ SHF_WRITE, SHF_ALLOC ] - Link: 4 - AddressAlign: 5 - EntSize: 6 - ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_386 + Machine: EM_NONE Sections: - Name: .foo Type: SHT_PROGBITS Index: llvm/test/tools/llvm-readobj/ELF/types.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/types.test +++ llvm/test/tools/llvm-readobj/ELF/types.test @@ -1,5 +1,5 @@ # Show that llvm-readobj can handle all standard ELF types. -# RUN: yaml2obj %s --docnum=1 -o %t.none +# RUN: yaml2obj %s -DTYPE=ET_NONE -o %t.none # RUN: llvm-readobj --file-headers %t.none | FileCheck %s --check-prefix=LLVM-NONE # RUN: llvm-readelf --file-headers %t.none | FileCheck %s --check-prefix=GNU-NONE @@ -10,107 +10,57 @@ FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB - Type: ET_NONE + Type: [[TYPE]] Machine: EM_X86_64 -# RUN: yaml2obj %s --docnum=2 -o %t.rel +# RUN: yaml2obj %s -DTYPE=ET_REL -o %t.rel # RUN: llvm-readobj --file-headers %t.rel | FileCheck %s --check-prefix=LLVM-REL # RUN: llvm-readelf --file-headers %t.rel | FileCheck %s --check-prefix=GNU-REL # LLVM-REL: Type: Relocatable (0x1) # GNU-REL: Type: REL (Relocatable file) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 - - -# RUN: yaml2obj %s --docnum=3 -o %t.exec +# RUN: yaml2obj %s -DTYPE=ET_EXEC -o %t.exec # RUN: llvm-readobj --file-headers %t.exec | FileCheck %s --check-prefix=LLVM-EXEC # RUN: llvm-readelf --file-headers %t.exec | FileCheck %s --check-prefix=GNU-EXEC # LLVM-EXEC: Type: Executable (0x2) # GNU-EXEC: Type: EXEC (Executable file) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 - -# RUN: yaml2obj %s --docnum=4 -o %t.so +# RUN: yaml2obj %s -DTYPE=ET_DYN -o %t.so # RUN: llvm-readobj --file-headers %t.so | FileCheck %s --check-prefix=LLVM-SO # RUN: llvm-readelf --file-headers %t.so | FileCheck %s --check-prefix=GNU-SO # LLVM-SO: Type: SharedObject (0x3) # GNU-SO: Type: DYN (Shared object file) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 - -# RUN: yaml2obj %s --docnum=5 -o %t.core +# RUN: yaml2obj %s -DTYPE=ET_CORE -o %t.core # RUN: llvm-readobj --file-headers %t.core | FileCheck %s --check-prefix=LLVM-CORE # RUN: llvm-readelf --file-headers %t.core | FileCheck %s --check-prefix=GNU-CORE # LLVM-CORE: Type: Core (0x4) # GNU-CORE: Type: CORE (Core file) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_CORE - Machine: EM_X86_64 - # Show that llvm-readobj can handle an unknown ELF type. -# RUN: yaml2obj %s --docnum=6 -o %t.unknown +# RUN: yaml2obj %s -DTYPE=0x42 -o %t.unknown # RUN: llvm-readobj --file-headers %t.unknown | FileCheck %s --check-prefix=LLVM-UNKNOWN # RUN: llvm-readelf --file-headers %t.unknown | FileCheck %s --check-prefix=GNU-UNKNOWN # LLVM-UNKNOWN: Type: 0x42 # GNU-UNKNOWN: Type: 42 ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: 0x42 - Machine: EM_X86_64 - # Show that llvm-readobj can handle an unknown OS-specific ELF type. -# RUN: yaml2obj %s --docnum=7 -o %t.os +# RUN: yaml2obj %s -DTYPE=0xfe00 -o %t.os # RUN: llvm-readobj --file-headers %t.os | FileCheck %s --check-prefix=LLVM-OS # RUN: llvm-readelf --file-headers %t.os | FileCheck %s --check-prefix=GNU-OS # LLVM-OS: Type: 0xFE00 # GNU-OS: Type: fe00 ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: 0xfe00 - Machine: EM_X86_64 - # Show that llvm-readobj can handle an unknown machine-specific ELF type. -# RUN: yaml2obj %s --docnum=8 -o %t.proc +# RUN: yaml2obj %s -DTYPE=0xff00 -o %t.proc # RUN: llvm-readobj --file-headers %t.proc | FileCheck %s --check-prefix=LLVM-PROC # RUN: llvm-readelf --file-headers %t.proc | FileCheck %s --check-prefix=GNU-PROC # LLVM-PROC: Type: 0xFF00 # GNU-PROC: Type: ff00 - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: 0xff00 - Machine: EM_X86_64 Index: llvm/test/tools/llvm-readobj/ELF/verdef-invalid.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/verdef-invalid.test +++ llvm/test/tools/llvm-readobj/ELF/verdef-invalid.test @@ -2,7 +2,7 @@ ## Check that we report a warning when sh_link references a non-existent section. -# RUN: yaml2obj %s --docnum=1 -o %t1 +# RUN: yaml2obj %s --docnum=1 -DLINK=0xFF -o %t1 # RUN: llvm-readobj -V %t1 2>&1 | FileCheck %s --check-prefix=INVALID-LINK-LLVM --implicit-check-not="warning:" -DFILE=%t1 # RUN: llvm-readelf -V %t1 2>&1 | FileCheck %s --check-prefix=INVALID-LINK-GNU --implicit-check-not="warning:" -DFILE=%t1 @@ -21,34 +21,21 @@ Sections: - Name: .gnu.version_d Type: SHT_GNU_verdef - Link: 0xFF + Link: [[LINK]] Info: 0x0 Entries: [] ## Check that we report a warning when the sh_link field of a SHT_GNU_verdef section references a non-string table section. -# RUN: yaml2obj %s --docnum=2 -o %t2 +# RUN: yaml2obj %s --docnum=1 -DLINK=0x0 -o %t2 # RUN: llvm-readobj -V %t2 2>&1 | FileCheck %s --check-prefix=INVALID-STRING-TABLE -DFILE=%t2 # RUN: llvm-readelf -V %t2 2>&1 | FileCheck %s --check-prefix=INVALID-STRING-TABLE -DFILE=%t2 # INVALID-STRING-TABLE: warning: '[[FILE]]': invalid string table linked to SHT_GNU_verdef section with index 1: invalid sh_type for string table section [index 0]: expected SHT_STRTAB, but got SHT_NULL ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -Sections: - - Name: .gnu.version_d - Type: SHT_GNU_verdef - Link: 0x0 - Info: 0x0 - Entries: [] - ## Check that we report a warning when we can't read the content of the SHT_GNU_verdef section. -# RUN: yaml2obj %s --docnum=3 -o %t3 +# RUN: yaml2obj %s --docnum=2 -o %t3 # RUN: llvm-readobj -V %t3 2>&1 | FileCheck %s --check-prefix=INVALID-DATA -DFILE=%t3 # RUN: llvm-readelf -V %t3 2>&1 | FileCheck %s --check-prefix=INVALID-DATA -DFILE=%t3 @@ -73,7 +60,7 @@ ## Check that we report a warning when a SHT_GNU_verdef section contains a version definition ## that goes past the end of the section. -# RUN: yaml2obj %s --docnum=4 -o %t4 +# RUN: yaml2obj %s --docnum=3 -o %t4 # RUN: llvm-readobj -V %t4 2>&1 | FileCheck %s --check-prefix=DEF-PAST-END -DFILE=%t4 # RUN: llvm-readelf -V %t4 2>&1 | FileCheck %s --check-prefix=DEF-PAST-END -DFILE=%t4 @@ -104,7 +91,7 @@ ## Check that we report a warning when a SHT_GNU_verdef section contains a version definition ## that refers to an auxiliary entry that goes past the end of the section. -# RUN: yaml2obj %s --docnum=5 -o %t5 +# RUN: yaml2obj %s --docnum=4 -o %t5 # RUN: llvm-readobj -V %t5 2>&1 | FileCheck %s --check-prefix=AUX-PAST-END -DFILE=%t5 # RUN: llvm-readelf -V %t5 2>&1 | FileCheck %s --check-prefix=AUX-PAST-END -DFILE=%t5 @@ -135,7 +122,7 @@ ## Check that we can dump a SHT_GNU_verdef section properly even if it contains version names strings ## that overrun the linked string table. -# RUN: yaml2obj %s --docnum=6 -o %t6 +# RUN: yaml2obj %s --docnum=5 -o %t6 # RUN: llvm-readobj -V %t6 2>&1 | FileCheck %s --check-prefix=PAST-STRTAB-END-LLVM --implicit-check-not="warning:" -DFILE=%t6 # RUN: llvm-readelf -V %t6 2>&1 | FileCheck %s --check-prefix=PAST-STRTAB-END-GNU --implicit-check-not="warning:" -DFILE=%t6 @@ -180,7 +167,7 @@ ## Check we report a warning when a version definition is not correctly aligned in memory. -# RUN: yaml2obj %s --docnum=7 -o %t7 +# RUN: yaml2obj %s --docnum=6 -o %t7 # RUN: llvm-readobj -V %t7 2>&1 | FileCheck %s --check-prefix=MISALIGNED-DEF -DFILE=%t7 # RUN: llvm-readelf -V %t7 2>&1 | FileCheck %s --check-prefix=MISALIGNED-DEF -DFILE=%t7 @@ -211,7 +198,7 @@ ## Check we report a warning when an auxiliary entry is not correctly aligned in memory. -# RUN: yaml2obj %s --docnum=8 -o %t8 +# RUN: yaml2obj %s --docnum=7 -o %t8 # RUN: llvm-readobj -V %t8 2>&1 | FileCheck %s --check-prefix=MISALIGNED-AUX -DFILE=%t8 # RUN: llvm-readelf -V %t8 2>&1 | FileCheck %s --check-prefix=MISALIGNED-AUX -DFILE=%t8 @@ -237,7 +224,7 @@ ## Check how we handle a version definition entry with an unsupported version. -# RUN: yaml2obj %s --docnum=9 -o %t9 +# RUN: yaml2obj %s --docnum=8 -o %t9 # RUN: llvm-readobj -V %t9 2>&1 | FileCheck %s --check-prefix=UNSUPPORTED-VERSION -DFILE=%t9 # RUN: llvm-readelf -V %t9 2>&1 | FileCheck %s --check-prefix=UNSUPPORTED-VERSION -DFILE=%t9 @@ -266,7 +253,7 @@ ## Check we report a warning when trying to print version symbols, but SHT_GNU_verdef ## is invalid due to any reason. -# RUN: yaml2obj %s --docnum=10 -o %t10 +# RUN: yaml2obj %s --docnum=9 -o %t10 # RUN: llvm-readobj -V %t10 2>&1 | FileCheck %s --check-prefix=INVALID-VERDEF-LLVM -DFILE=%t10 # RUN: llvm-readelf -V %t10 2>&1 | FileCheck %s --check-prefix=INVALID-VERDEF-GNU -DFILE=%t10 Index: llvm/test/tools/llvm-readobj/ELF/versym-invalid.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/versym-invalid.test +++ llvm/test/tools/llvm-readobj/ELF/versym-invalid.test @@ -2,11 +2,11 @@ ## Check that we report a warning when sh_link references a non-existent section. -# RUN: yaml2obj --docnum=1 %s -o %t1 +# RUN: yaml2obj --docnum=1 -DLINK=0xFF %s -o %t1 # RUN: llvm-readelf -V %t1 2>&1 | FileCheck -DFILE=%t1 %s --check-prefix=GNU-INVALID-LINK # RUN: llvm-readobj -V %t1 2>&1 | FileCheck -DFILE=%t1 %s --check-prefix=LLVM-INVALID-LINK -# GNU-INVALID-LINK: Version symbols section '.gnu.version' contains 0 entries: +# GNU-INVALID-LINK: Version symbols section '.gnu.version' contains 1 entries: # GNU-INVALID-LINK-NEXT: warning: '[[FILE]]': invalid section linked to SHT_GNU_versym section with index 1: invalid section index: 255 # GNU-INVALID-LINK-NEXT: Addr: 0000000000000000 Offset: 0x000040 Link: 255 () @@ -23,13 +23,13 @@ Sections: - Name: .gnu.version Type: SHT_GNU_versym - Link: 0xFF - Entries: [ ] + Link: [[LINK]] + Entries: [ 0 ] ## Check that we report a warning when the sh_link field of a SHT_GNU_versym section does not reference ## a dynamic symbol table section. -# RUN: yaml2obj --docnum=2 %s -o %t2 +# RUN: yaml2obj --docnum=1 -DLINK=0x0 %s -o %t2 # RUN: llvm-readelf -V %t2 2>&1 | FileCheck -DFILE=%t2 %s --check-prefix=INVALID-SYMBOL-TABLE-GNU # RUN: llvm-readobj -V %t2 2>&1 | FileCheck -DFILE=%t2 %s --check-prefix=INVALID-SYMBOL-TABLE-LLVM @@ -42,23 +42,11 @@ # INVALID-SYMBOL-TABLE-LLVM-NEXT: warning: '[[FILE]]': invalid section linked to SHT_GNU_versym section with index 1: expected SHT_DYNSYM, but got SHT_NULL # INVALID-SYMBOL-TABLE-LLVM-NEXT: ] ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 -Sections: - - Name: .gnu.version - Type: SHT_GNU_versym - Link: 0x0 - Entries: [ 0 ] - ## Check we report a warning when something is wrong with a string table linked to a symbol table that ## is linked with SHT_GNU_versym. In this case we are unable to produce LLVM style output, ## but GNU style is fine because it does not need that string table. -# RUN: yaml2obj --docnum=3 %s -o %t3 +# RUN: yaml2obj --docnum=2 %s -o %t3 # RUN: llvm-readelf -V %t3 2>&1 | FileCheck -DFILE=%t3 %s --check-prefix=INVALID-STRING-TABLE-GNU # RUN: llvm-readobj -V %t3 2>&1 | FileCheck -DFILE=%t3 %s --check-prefix=INVALID-STRING-TABLE-LLVM @@ -88,7 +76,7 @@ ## Check we report a warning when a SHT_GNU_versym section is not correctly aligned in memory. -# RUN: yaml2obj --docnum=4 %s -o %t4 +# RUN: yaml2obj --docnum=3 %s -o %t4 # RUN: llvm-readelf -V %t4 2>&1 | FileCheck -DFILE=%t4 %s --check-prefix=MISALIGNED-GNU # RUN: llvm-readobj -V %t4 2>&1 | FileCheck -DFILE=%t4 %s --check-prefix=MISALIGNED-LLVM @@ -114,7 +102,7 @@ ## Check we report a warning when a SHT_GNU_versym section has an invalid entry size. -# RUN: yaml2obj --docnum=5 %s -o %t5 +# RUN: yaml2obj --docnum=4 %s -o %t5 # RUN: llvm-readelf -V --dyn-syms %t5 2>&1 | FileCheck -DFILE=%t5 %s --check-prefix=INVALID-ENT-SIZE-GNU # RUN: llvm-readobj -V --dyn-syms %t5 2>&1 | FileCheck -DFILE=%t5 %s --check-prefix=INVALID-ENT-SIZE-LLVM @@ -168,7 +156,7 @@ ## Check we report a warning when the number of version entries does not match the number of symbols in the associated symbol table. -# RUN: yaml2obj --docnum=6 %s -o %t6 +# RUN: yaml2obj --docnum=5 %s -o %t6 # RUN: llvm-readelf -V %t6 2>&1 | FileCheck -DFILE=%t6 %s --check-prefix=SYMBOLS-NUM-MISMATCH-GNU # RUN: llvm-readobj -V %t6 2>&1 | FileCheck -DFILE=%t6 %s --check-prefix=SYMBOLS-NUM-MISMATCH-LLVM @@ -199,7 +187,7 @@ ## Check we can dump a SHT_GNU_versym section when it is linked to a custom dynamic symbol ## table that is not called ".dynsym". -# RUN: yaml2obj --docnum=7 %s -o %t7 +# RUN: yaml2obj --docnum=6 %s -o %t7 # RUN: llvm-readelf -V %t7 2>&1 | FileCheck -DFILE=%t7 %s --check-prefix=CUSTOM-SYMTAB-GNU # RUN: llvm-readobj -V %t7 2>&1 | FileCheck -DFILE=%t7 %s --check-prefix=CUSTOM-SYMTAB-LLVM @@ -238,7 +226,7 @@ ## Version index in a SHT_GNU_versym section overflows the version map. ## Check we report it when trying to dump dynamic symbols. -# RUN: yaml2obj %s --docnum=8 -o %t8 +# RUN: yaml2obj %s --docnum=7 -o %t8 # RUN: llvm-readobj --dyn-syms %t8 2>&1 \ # RUN: | FileCheck -DFILE=%t8 --implicit-check-not=warning --check-prefix=VERSION-OVERFLOW-LLVM %s # RUN: llvm-readelf --dyn-syms %t8 2>&1 \