1 ## This test shows that llvm-objdump can handle sections with the same address
2 ## when symbols in those sections are referenced. In the past, the section
3 ## picked was non-deterministic, resulting in different symbols being found for
4 ## the section. The test uses YAML for the input, as we need a fully linked ELF
5 ## to reproduce the original failure.
7 ## Two empty sections, one with symbol in, one without.
8 # RUN: yaml2obj %s --docnum=1 -o %t1 -D SIZE1=0 -D SIZE2=0 -D SECTION=.second -D INDEX=SHN_ABS
9 # RUN: llvm-objdump -d %t1 | FileCheck %s --check-prefix=TARGET
10 # RUN: yaml2obj %s --docnum=1 -o %t2 -D SIZE1=0 -D SIZE2=0 -D SECTION=.first -D INDEX=SHN_ABS
11 # RUN: llvm-objdump -d %t2 | FileCheck %s --check-prefix=TARGET
13 ## Two sections, one empty with symbol, other non-empty, without symbol.
14 # RUN: yaml2obj %s --docnum=1 -o %t3 -D SIZE1=1 -D SIZE2=0 -D SECTION=.second -D INDEX=SHN_ABS
15 # RUN: llvm-objdump -d %t3 | FileCheck %s --check-prefix=TARGET
16 # RUN: yaml2obj %s --docnum=1 -o %t4 -D SIZE1=0 -D SIZE2=1 -D SECTION=.first -D INDEX=SHN_ABS
17 # RUN: llvm-objdump -d %t4 | FileCheck %s --check-prefix=TARGET
19 ## Fall back to absolute symbol if no symbol found in candidate sections.
20 # RUN: yaml2obj %s --docnum=1 -o %t5 -D SIZE1=1 -D SIZE2=0 -D SECTION=.caller -D INDEX=SHN_ABS
21 # RUN: llvm-objdump -d %t5 | FileCheck %s --check-prefix=ABSOLUTE
23 ## Show that other symbols with reserved st_shndx values are treated as absolute
25 # RUN: yaml2obj %s --docnum=1 -o %t6 -D SIZE1=1 -D SIZE2=0 -D SECTION=.caller -D INDEX=SHN_LOPROC
26 # RUN: llvm-objdump -d %t6 | FileCheck %s --check-prefix=ABSOLUTE
28 ## Print no target if no symbol in section/absolute symbol found.
29 # RUN: llvm-objcopy %t5 %t7 -N other
30 # RUN: llvm-objdump -d %t7 | FileCheck %s --check-prefix=FAIL
32 # TARGET: callq 0x5 <target>
33 # ABSOLUTE: callq 0x5 <other+0x5>
34 # FAIL: callq 0x5{{$}}
45 Flags: [SHF_ALLOC, SHF_EXECINSTR]
47 Content: e800000000 ## Call instruction to next address.
50 Flags: [SHF_ALLOC, SHF_EXECINSTR]
55 Flags: [SHF_ALLOC, SHF_EXECINSTR]
66 ## Two empty sections, both with symbols.
67 # RUN: yaml2obj %s --docnum=2 -o %t7 -D SIZE1=0 -D SIZE2=0 -D SYMVAL1=0x5 -D SYMVAL2=0x5
68 # RUN: llvm-objdump -d %t7 | FileCheck %s --check-prefix=SECOND
70 ## Two sections, both with symbols, one empty, the other not.
71 # RUN: yaml2obj %s --docnum=2 -o %t8 -D SIZE1=1 -D SIZE2=0 -D SYMVAL1=0x5 -D SYMVAL2=0x5
72 # RUN: llvm-objdump -d %t8 | FileCheck %s --check-prefix=FIRST
73 # RUN: yaml2obj %s --docnum=2 -o %t9 -D SIZE1=0 -D SIZE2=1 -D SYMVAL1=0x5 -D SYMVAL2=0x5
74 # RUN: llvm-objdump -d %t9 | FileCheck %s --check-prefix=SECOND
76 ## Two sections, both with symbols, one empty, other not, symbol in non-empty
77 ## section has value higher than target address.
78 # RUN: yaml2obj %s --docnum=2 -o %t10 -D SIZE1=1 -D SIZE2=0 -D SYMVAL1=0x6 -D SYMVAL2=0x5
79 # RUN: llvm-objdump -d %t10 | FileCheck %s --check-prefix=SECOND
80 # RUN: yaml2obj %s --docnum=2 -o %t11 -D SIZE1=0 -D SIZE2=1 -D SYMVAL1=0x5 -D SYMVAL2=0x6
81 # RUN: llvm-objdump -d %t11 | FileCheck %s --check-prefix=FIRST
83 # FIRST: callq 0x5 <first>
84 # SECOND: callq 0x5 <second>
95 Flags: [SHF_ALLOC, SHF_EXECINSTR]
97 Content: e800000000 ## Call instruction to next address.
100 Flags: [SHF_ALLOC, SHF_EXECINSTR]
105 Flags: [SHF_ALLOC, SHF_EXECINSTR]