diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-aranges.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-aranges.yaml --- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-aranges.yaml +++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-aranges.yaml @@ -296,17 +296,3 @@ Descriptors: - Address: 0x0000000000001234 Length: 0x20 - -## h) Test that yaml2obj will not generate the .debug_aranges section when the "DWARF" entry -## exists but the "debug_aranges" entry doesn't exist in the "DWARF" entry or the "Sections" entry. - -# RUN: yaml2obj --docnum=8 %s -o %t8.o -# RUN: llvm-readelf --sections %t8.o | FileCheck /dev/null --implicit-check-not=.debug_aranges - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2MSB - Type: ET_EXEC - Machine: EM_X86_64 -DWARF: diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml --- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml +++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml @@ -321,17 +321,3 @@ IncludeDirs: [] Files: [] Opcodes: [] - -## h) Test that yaml2obj will not generate the .debug_line section when the "DWARF" entry -## exists but the "debug_line" entry doesn't exist in the "DWARF" entry or the "Sections" entry. - -# RUN: yaml2obj --docnum=8 %s -o %t8.o -# RUN: llvm-readelf --sections %t8.o | FileCheck /dev/null --implicit-check-not=.debug_line - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 -DWARF: diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-ranges.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-ranges.yaml --- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-ranges.yaml +++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-ranges.yaml @@ -300,24 +300,10 @@ - LowOffset: 0x0000000000000001 HighOffset: 0x0000000000000002 -## h) Test that yaml2obj will not generate the .debug_ranges section when the "DWARF" entry -## exists but the "debug_ranges" entry doesn't exist in the "DWARF" entry or the "Sections" entry. - -# RUN: yaml2obj --docnum=8 %s -o %t8.o -# RUN: llvm-readelf --sections %t8.o | FileCheck /dev/null --implicit-check-not=.debug_ranges - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 -DWARF: - -## i) Test that yaml2obj emits an error message if we try to assign an invalid offset to an +## h) Test that yaml2obj emits an error message if we try to assign an invalid offset to an ## entry of the '.debug_ranges' section. -# RUN: not yaml2obj --docnum=9 %s -o %t9.o 2>&1 | FileCheck %s --check-prefix=INVALID-OFFSET +# RUN: not yaml2obj --docnum=8 %s -o %t8.o 2>&1 | FileCheck %s --check-prefix=INVALID-OFFSET # INVALID-OFFSET: yaml2obj: error: 'Offset' for 'debug_ranges' with index 1 must be greater than or equal to the number of bytes written already (0x20) diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-str.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-str.yaml --- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-str.yaml +++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-str.yaml @@ -175,32 +175,18 @@ - b - c -## h) Test that yaml2obj will not generate the .debug_str section when the "DWARF" entry exists -## but the "debug_str" entry doesn't exist in the "DWARF" entry or the "Sections" entry. - -# RUN: yaml2obj --docnum=8 %s -o %t8.o -# RUN: llvm-readelf -S %t8.o | FileCheck /dev/null --implicit-check-not=.debug_str - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 -DWARF: - -## i) Test that if we try to initialize the .debug_str section with a "Type" with non-standard +## h) Test that if we try to initialize the .debug_str section with a "Type" with non-standard ## syntax, e.g., SHT_DYNAMIC, yaml2obj will treat it as a dynamic section and discard the ## content in the "DWARF" entry. +# RUN: yaml2obj --docnum=8 %s -o %t8.o +# RUN: llvm-readelf -S %t8.o | FileCheck %s --check-prefix=DYN-SHDR +# RUN: llvm-readelf -d %t8.o | FileCheck %s --check-prefix=DYNAMIC + # RUN: yaml2obj --docnum=9 %s -o %t9.o # RUN: llvm-readelf -S %t9.o | FileCheck %s --check-prefix=DYN-SHDR # RUN: llvm-readelf -d %t9.o | FileCheck %s --check-prefix=DYNAMIC -# RUN: yaml2obj --docnum=10 %s -o %t10.o -# RUN: llvm-readelf -S %t10.o | FileCheck %s --check-prefix=DYN-SHDR -# RUN: llvm-readelf -d %t10.o | FileCheck %s --check-prefix=DYNAMIC - # DYN-SHDR: Name Type Address Off Size ES Flg Lk Inf Al # DYN-SHDR: .debug_str DYNAMIC 0000000000000000 000040 000010 10 0 0 0 diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/empty-dwarf-entry.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/empty-dwarf-entry.yaml new file mode 100644 --- /dev/null +++ b/llvm/test/tools/yaml2obj/ELF/DWARF/empty-dwarf-entry.yaml @@ -0,0 +1,12 @@ +## Test that yaml2obj doesn't emit .debug_* sections when the "DWARF" entry is empty. + +# RUN: yaml2obj %s -o %t.o +# RUN: llvm-readobj --sections %t.o | FileCheck /dev/null --implicit-check-not=debug + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 +DWARF: