Unverified Commit 1cc9a8d1 authored by Jonas Devlieghere's avatar Jonas Devlieghere Committed by GitHub
Browse files

[dsymutil] Relax tests to accept both linker outputs (#195354)

Remove the FIXMEs from tests whose divergence between the classic and
parallel linkers was cosmetic. Typical relaxations consist of using
CHECK-DAG for reordered attributes and allowing DIE and string offsets
to differ.
parent 82bf5e84
Loading
Loading
Loading
Loading
+19 −10
Original line number Diff line number Diff line
#RUN: dsymutil --linker=classic -f -oso-prepend-path=%p/../Inputs/ -y %s -o %t.dwarf
#RUN: llvm-dwarfdump %t.dwarf | FileCheck %s --check-prefix=CLASSIC
#RUN: dsymutil --linker=parallel -f -oso-prepend-path=%p/../Inputs/ -y %s -o %t.dwarf
#RUN: llvm-dwarfdump %t.dwarf | FileCheck %s

## FIXME: Support --linker classic
#RUN: llvm-dwarfdump %t.dwarf | FileCheck %s --check-prefix=PARALLEL

# There should be two typedef DIE named "BarInt" in the resultant .dwarf file.
# The second should refer to the first, which refer to "Foo<int>".
# CHECK:      0x[[FIRST_BARINT_ADDR:[0-9a-f]*]]:  DW_TAG_typedef
# CHECK-NEXT:     DW_AT_type  (0x{{([[:xdigit:]]*)}} "Foo<int>")
# CHECK-NEXT:     DW_AT_name  ("BarInt")
# CHECK:      0x{{([[:xdigit:]]*)}}:  DW_TAG_typedef
# CHECK-NEXT:     DW_AT_type  (0x[[FIRST_BARINT_ADDR]] "BarInt")
# CHECK-NEXT:     DW_AT_name  ("BarInt")
# One refers to "Foo<int>", the other refers to the first. The linkers differ
# in which typedef they emit first, so we split the ordering expectations.

# CLASSIC:      0x{{[0-9a-f]+}}:  DW_TAG_typedef
# CLASSIC-NEXT:     DW_AT_type  (0x[[#%x,FIRST_BARINT_ADDR:]] "BarInt")
# CLASSIC-NEXT:     DW_AT_name  ("BarInt")
# CLASSIC:      0x[[#%.8x,FIRST_BARINT_ADDR]]:  DW_TAG_typedef
# CLASSIC-NEXT:     DW_AT_type  (0x{{[0-9a-f]+}} "Foo<int>")
# CLASSIC-NEXT:     DW_AT_name  ("BarInt")

# PARALLEL:      0x[[#%x,FIRST_BARINT_ADDR:]]:  DW_TAG_typedef
# PARALLEL-NEXT:     DW_AT_type  (0x{{[0-9a-f]+}} "Foo<int>")
# PARALLEL-NEXT:     DW_AT_name  ("BarInt")
# PARALLEL:      0x{{[0-9a-f]+}}:  DW_TAG_typedef
# PARALLEL-NEXT:     DW_AT_type  (0x[[#%.8x,FIRST_BARINT_ADDR]] "BarInt")
# PARALLEL-NEXT:     DW_AT_name  ("BarInt")

# Source:
#
+3 −4
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
# RUN: echo '      - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x10000, size: 0x10 }' >> %t2.map
# RUN: echo '...' >> %t2.map
# RUN: dsymutil --linker classic -y %t2.map -f -o - | llvm-dwarfdump -a - | FileCheck %s
# RUN: dsymutil --linker parallel -y %t2.map -f -o - | llvm-dwarfdump -a - | FileCheck %s

# CHECK: file format Mach-O 64-bit x86-64
# CHECK: .debug_info contents:
@@ -25,14 +26,14 @@
# CHECK: DW_TAG_variable
# CHECK: DW_AT_name{{.*}}"var1"
# CHECK: DW_AT_location        (DW_OP_addr
# CHECK: 0x00000043:   NULL
# CHECK: 0x{{[0-9a-f]+}}:   NULL
# CHECK: Compile Unit:
# CHECK: DW_TAG_compile_unit
# CHECK-NOT: DW_AT_low_pc
# CHECK: DW_AT_name{{.*}}"BadCU"
# CHECK-NOT: DW_TAG_subprogram
# CHECK-NOT: DW_TAG_variable
# CHECK: 0x0000005b:   NULL
# CHECK: 0x{{[0-9a-f]+}}:   NULL

--- !mach-o
FileHeader:
@@ -282,5 +283,3 @@ DWARF:
      Entries:
        - Address: 0x10
...

## FIXME: Support --linker parallel
+9 −6
Original line number Diff line number Diff line
@@ -25,14 +25,17 @@ RUN: dsymutil --linker classic -oso-prepend-path %p/../Inputs %p/../Inputs/priva
RUN: llvm-dwarfdump %t.omit.dSYM | FileCheck %s --check-prefix OMIT
RUN: llvm-dwarfdump %t.keep.dSYM | FileCheck %s --check-prefix KEEP

KEEP:     DW_AT_name	("MyDummyVar")
KEEP:     DW_AT_name	("FOO_VAR_TYPE")
KEEP:     DW_AT_name	("x1")
KEEP:     DW_AT_name	("x2")
RUN: dsymutil --linker parallel -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/keep_func/main.out -o %t.omit.dSYM
RUN: dsymutil --linker parallel -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/keep_func/main.out -o %t.keep.dSYM -keep-function-for-static
RUN: llvm-dwarfdump %t.omit.dSYM | FileCheck %s --check-prefix OMIT
RUN: llvm-dwarfdump %t.keep.dSYM | FileCheck %s --check-prefix KEEP

KEEP-DAG:     DW_AT_name	("MyDummyVar")
KEEP-DAG:     DW_AT_name	("FOO_VAR_TYPE")
KEEP-DAG:     DW_AT_name	("x1")
KEEP-DAG:     DW_AT_name	("x2")

OMIT-NOT: DW_AT_name	("MyDummyVar")
OMIT-NOT: DW_AT_name	("FOO_VAR_TYPE")
OMIT-NOT: DW_AT_name	("x1")
OMIT-NOT: DW_AT_name	("x2")

## FIXME: Support --linker parallel
+4 −1
Original line number Diff line number Diff line
@@ -48,7 +48,10 @@ Note that the link order in the last command matters for this test.
RUN: dsymutil --linker parallel -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/union/a.out -o %t.dSYM
RUN: llvm-dwarfdump --debug-info %t.dSYM | FileCheck %s

## FIXME: Support --linker classic
## This test is parallel-specific by design: it checks that the parallel
## linker's artificial type unit carries the full definition of
## Container_ivars with the expected layout. The classic linker's
## handling of the same input is covered by union-fwd-decl.test.

CHECK:       DW_TAG_compile_unit
CHECK-NEXT:    DW_AT_producer    ("llvm DWARFLinkerParallel library
+9 −5
Original line number Diff line number Diff line
RUN: dsymutil --linker classic --verify-dwarf=output -f -oso-prepend-path=%p/.. %p/../Inputs/objc.macho.x86_64 -o %t.d4
RUN: llvm-dwarfdump -apple-types -apple-objc %t.d4 | FileCheck %s

RUN: dsymutil --linker parallel --verify-dwarf=output -f -oso-prepend-path=%p/.. %p/../Inputs/objc.macho.x86_64 -o %t.d4
RUN: llvm-dwarfdump -apple-types -apple-objc %t.d4 | FileCheck %s

; Test DWARF 5 tables
RUN: dsymutil --linker classic --verify-dwarf=output --accelerator='Dwarf' -f -oso-prepend-path=%p/.. %p/../Inputs/objc.macho.x86_64 -o %t.d5
RUN: llvm-dwarfdump -debug-names %t.d5 | FileCheck %s --check-prefix=D5

RUN: dsymutil --linker parallel --verify-dwarf=output --accelerator='Dwarf' -f -oso-prepend-path=%p/.. %p/../Inputs/objc.macho.x86_64 -o %t.d5
RUN: llvm-dwarfdump -debug-names %t.d5 | FileCheck %s --check-prefix=D5

D5: String: {{.*}} "method1:"
D5: String: {{.*}} "method2:"
D5: String: {{.*}} "A"
@@ -13,7 +19,7 @@ D5: String: {{.*}} "-[A method1:]"
D5: String: {{.*}} "-[Amethod2:]"

CHECK: .apple_types contents:
CHECK: String: 0x00000066 "A"
CHECK: String: 0x{{[0-9a-f]+}} "A"
CHECK-NEXT: Data 0 [
CHECK-NEXT:   Atom[0]: 0x0000012d
CHECK-NEXT:   Atom[1]: 0x0013 (DW_TAG_structure_type)
@@ -42,7 +48,7 @@ CHECK-NEXT: ]
CHECK-NEXT: Bucket 0 [
CHECK-NEXT:   Hash 0x2b5e6 [
CHECK-NEXT:     Name@0x38 {
CHECK-NEXT:       String: 0x00000066 "A"
CHECK-NEXT:       String: 0x{{[0-9a-f]+}} "A"
CHECK-NEXT:       Data 0 [
CHECK-NEXT:         Atom[0]: 0x00000027
CHECK-NEXT:       ]
@@ -55,12 +61,10 @@ CHECK-NEXT: ]
CHECK-NEXT: Bucket 1 [
CHECK-NEXT:   Hash 0x3fa0f4b5 [
CHECK-NEXT:     Name@0x4c {
CHECK-NEXT:       String: 0x0000009d "A(Category)"
CHECK-NEXT:       String: 0x{{[0-9a-f]+}} "A(Category)"
CHECK-NEXT:       Data 0 [
CHECK-NEXT:         Atom[0]: 0x0000007a
CHECK-NEXT:       ]
CHECK-NEXT:     }
CHECK-NEXT:   ]
CHECK-NEXT: ]

## FIXME: Support --linker parallel
Loading