[test] Make ELF tests amenable to the order of non-local symbols

This commit is contained in:
Fangrui Song 2021-02-12 21:00:42 -08:00
parent 816053bc71
commit 1f69355802
29 changed files with 198 additions and 954 deletions

View File

@ -24,8 +24,8 @@
# RELOC-NEXT: }
# RELOC: Relocations [
# RELOC-NEXT: Section ({{.*}}) .rela.dyn {
# RELOC-NEXT: 0x220340 R_AARCH64_TLS_TPREL64 bar 0x0
# RELOC-NEXT: 0x220338 R_AARCH64_TLS_TPREL64 foo 0x0
# RELOC-NEXT: 0x220338 R_AARCH64_TLS_TPREL64 bar 0x0
# RELOC-NEXT: 0x220340 R_AARCH64_TLS_TPREL64 foo 0x0
# RELOC-NEXT: }
# RELOC-NEXT:]
@ -41,8 +41,8 @@
.globl _start
_start:
adrp x0, :gottprel:foo
ldr x0, [x0, #:gottprel_lo12:foo]
adrp x0, :gottprel:bar
ldr x0, [x0, #:gottprel_lo12:bar]
adrp x0, :gottprel:foo
ldr x0, [x0, #:gottprel_lo12:foo]

View File

@ -5,13 +5,12 @@
// RUN: llvm-readobj -r --symbols --sections %t | FileCheck %s
.syntax unified
.text
.globl bar, foo
.type foo STT_GNU_IFUNC
.globl foo
foo:
bx lr
.type bar STT_GNU_IFUNC
.globl bar
bar:
bx lr

View File

@ -39,6 +39,7 @@
# NOCOMB-NEXT: 0x23F0 R_X86_64_GLOB_DAT aaa 0x0
# NOCOMB-NEXT: }
.globl aaa, bbb, ccc
.data
.quad aaa
.quad ccc

View File

@ -11,7 +11,7 @@
## *before* the symbol fetching the lazy object.
## The test relies on the symbol table order of llvm-mc (lexical), which will
## need adjustment if llvm-mc changes its behavior.
# RUN: echo '.globl f2, aa; f2: call aa; \
# RUN: echo '.globl aa, f2; f2: call aa; \
# RUN: .section .text.foo,"axG",@progbits,foo,comdat; aa:' | \
# RUN: llvm-mc -filetype=obj -triple=x86_64 - -o %taa.o
# RUN: llvm-nm -p %taa.o | FileCheck --check-prefix=AA-NM %s

View File

@ -32,8 +32,8 @@
# GC-NOT: Name: bar
.comm foo,4,4
.comm bar,4,4
.comm foo,4,4
.text
.globl _start

View File

@ -6,8 +6,8 @@
# CHECK: Name: bar
# CHECK: Name: foo
.comm foo,4,4
.comm bar,4,4
.comm foo,4,4
.text
.globl _start

View File

@ -42,12 +42,6 @@
# static int zed = 3;
# Invocation: g++ -g -S 1.c
.bss
.globl foo
.type foo, @object
.size foo, 4
foo:
.data
.globl bar
.type bar, @object
@ -55,6 +49,12 @@ foo:
bar:
.byte 0
.bss
.globl foo
.type foo, @object
.size foo, 4
foo:
.local zed
zed:

View File

@ -42,14 +42,6 @@
.file "test.c"
.file 1 "test.c"
.type foo,@object
.bss
.globl foo
.p2align 2
foo:
.long 0
.size foo, 4
.type bar,@object
.data
.globl bar
@ -58,6 +50,14 @@ bar:
.long 1
.size bar, 4
.type foo,@object
.bss
.globl foo
.p2align 2
foo:
.long 0
.size foo, 4
.section .debug_str,"MS",@progbits,1
.Linfo_string0:
.asciz "clang version 6.0.0"

View File

@ -1,12 +1,12 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: ld.lld -o %t %t.o --defsym=foo2=foo1
# RUN: llvm-readobj --symbols -S %t | FileCheck %s
# RUN: llvm-readelf -s %t | FileCheck %s
# RUN: llvm-objdump -d --print-imm-hex %t | FileCheck %s --check-prefix=USE
## Check that we accept --defsym foo2=foo1 form.
# RUN: ld.lld -o %t2 %t.o --defsym foo2=foo1
# RUN: llvm-readobj --symbols -S %t2 | FileCheck %s
# RUN: llvm-readelf -s %t2 | FileCheck %s
# RUN: llvm-objdump -d --print-imm-hex %t2 | FileCheck %s --check-prefix=USE
## Check we are reporting the error correctly and don't crash
@ -15,24 +15,8 @@
# --defsym foo2=foo1 2>&1 | FileCheck %s --check-prefix=ERR
# ERR: error: -defsym: syntax error: ERR+
# CHECK: Symbol {
# CHECK: Name: foo1
# CHECK-NEXT: Value: 0x123
# CHECK-NEXT: Size:
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type:
# CHECK-NEXT: Other:
# CHECK-NEXT: Section: Absolute
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: foo2
# CHECK-NEXT: Value: 0x123
# CHECK-NEXT: Size:
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type:
# CHECK-NEXT: Other:
# CHECK-NEXT: Section: Absolute
# CHECK-NEXT: }
# CHECK-DAG: 0000000000000123 0 NOTYPE GLOBAL DEFAULT ABS foo1
# CHECK-DAG: 0000000000000123 0 NOTYPE GLOBAL DEFAULT ABS foo2
## Check we can use foo2 and it that it is an alias for foo1.
# USE: Disassembly of section .text:
@ -41,39 +25,15 @@
# USE-NEXT: movl $0x123, %edx
# RUN: ld.lld -o %t %t.o --defsym=foo2=1
# RUN: llvm-readobj --symbols -S %t | FileCheck %s --check-prefix=ABS
# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=ABS
# ABS: Symbol {
# ABS: Name: foo2
# ABS-NEXT: Value: 0x1
# ABS-NEXT: Size:
# ABS-NEXT: Binding: Global
# ABS-NEXT: Type:
# ABS-NEXT: Other:
# ABS-NEXT: Section: Absolute
# ABS-NEXT: }
# ABS: 0000000000000123 0 NOTYPE GLOBAL DEFAULT ABS foo2
# RUN: ld.lld -o %t %t.o --defsym=foo2=foo1+5
# RUN: llvm-readobj --symbols -S %t | FileCheck %s --check-prefix=EXPR
# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=EXPR
# EXPR: Symbol {
# EXPR: Name: foo1
# EXPR-NEXT: Value: 0x123
# EXPR-NEXT: Size:
# EXPR-NEXT: Binding: Global
# EXPR-NEXT: Type:
# EXPR-NEXT: Other:
# EXPR-NEXT: Section: Absolute
# EXPR-NEXT: }
# EXPR-NEXT: Symbol {
# EXPR-NEXT: Name: foo2
# EXPR-NEXT: Value: 0x128
# EXPR-NEXT: Size:
# EXPR-NEXT: Binding: Global
# EXPR-NEXT: Type:
# EXPR-NEXT: Other:
# EXPR-NEXT: Section: Absolute
# EXPR-NEXT: }
# EXPR-DAG: 0000000000000123 0 NOTYPE GLOBAL DEFAULT ABS foo1
# EXPR-DAG: 0000000000000128 0 NOTYPE GLOBAL DEFAULT ABS foo2
# RUN: not ld.lld -o /dev/null %t.o --defsym=foo2=und 2>&1 | FileCheck %s -check-prefix=ERR1
# ERR1: error: -defsym:1: symbol not found: und

View File

@ -14,9 +14,9 @@
# CHECK-NEXT: foo1
# CHECK-NEXT: foo11
.globl _start, foo1, foo11, foo2, boo1
.globl _start, boo1, foo1, foo11, foo2
_start:
foo1:
foo11:
foo2:
boo1:
_start:

View File

@ -32,7 +32,7 @@
# RELOCATABLE-NEXT: 0000000000000000 *UND* 0000000000000000 _end
# RELOCATABLE-NEXT: 0000000000000000 *UND* 0000000000000000 _etext
.global _start,_end,_etext,_edata,end,etext,edata
.global _edata,_end,_etext,_start,edata,end,etext
.text
_start:
nop

View File

@ -24,7 +24,7 @@
# CHECK-NEXT: Section: .text
.text
.global _start, __ehdr_start
.global __ehdr_start, _start
_start:
.quad __ehdr_start
.quad __executable_start

View File

@ -7,7 +7,7 @@
# RUN: ld.lld -shared %t4.o -o %t4.so
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: ld.lld --gc-sections --export-dynamic-symbol foo -o %t %t.o --as-needed %t2.so %t3.so %t4.so
# RUN: llvm-readobj --dynamic-table --dyn-symbols %t | FileCheck %s
# RUN: llvm-readelf -d --dyn-symbols %t | FileCheck %s
# This test the property that we have a needed line for every undefined.
# It would also be OK to keep bar2 and the need for %t2.so
@ -15,60 +15,17 @@
# this case is checked with symbol qux and %t4.so.
# CHECK-NOT: NEEDED
# CHECK: NEEDED Shared library: [{{.*}}3.so]
# CHECK: (NEEDED) Shared library: [{{.*}}3.so]
# CHECK-NOT: NEEDED
# CHECK: DynamicSymbols [
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name:
# CHECK-NEXT: Value:
# CHECK-NEXT: Size:
# CHECK-NEXT: Binding: Local
# CHECK-NEXT: Type:
# CHECK-NEXT: Other:
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: qux
# CHECK-NEXT: Value:
# CHECK-NEXT: Size:
# CHECK-NEXT: Binding: Weak
# CHECK-NEXT: Type:
# CHECK-NEXT: Other:
# CHECK-NEXT: Section: Undefined
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: bar
# CHECK-NEXT: Value:
# CHECK-NEXT: Size:
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type:
# CHECK-NEXT: Other:
# CHECK-NEXT: Section: .text
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: baz
# CHECK-NEXT: Value:
# CHECK-NEXT: Size:
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type:
# CHECK-NEXT: Other:
# CHECK-NEXT: Section: Undefined
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: foo
# CHECK-NEXT: Value:
# CHECK-NEXT: Size:
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type:
# CHECK-NEXT: Other:
# CHECK-NEXT: Section: .text
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-DAG: FUNC WEAK DEFAULT UND qux
# CHECK-DAG: NOTYPE GLOBAL DEFAULT 6 bar
# CHECK-DAG: FUNC GLOBAL DEFAULT UND baz
# CHECK-DAG: NOTYPE GLOBAL DEFAULT 6 foo
# Test with %t.o at the end too.
# RUN: ld.lld --gc-sections --export-dynamic-symbol foo -o %t --as-needed %t2.so %t3.so %t4.so %t.o
# RUN: llvm-readobj --dynamic-table --dyn-symbols %t | FileCheck --check-prefix=CHECK %s
# RUN: llvm-readelf --dynamic-table --dyn-symbols %t | FileCheck --check-prefix=CHECK %s
.section .text.foo, "ax"
.globl foo

View File

@ -19,7 +19,7 @@ _start:
.data
.long _GLOBAL_OFFSET_TABLE_ - .
// CHECK: Name: _GLOBAL_OFFSET_TABLE_ (11)
// CHECK: Name: _GLOBAL_OFFSET_TABLE_
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local (0x0)

View File

@ -21,8 +21,8 @@ _start:
addl $_GLOBAL_OFFSET_TABLE_, %eax
calll f@PLT
// CHECK: Name: _GLOBAL_OFFSET_TABLE_ (1)
// CHECK-NEXT: Value: 0x325C
// CHECK: Name: _GLOBAL_OFFSET_TABLE_
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local (0x0)
// CHECK-NEXT: Type: None (0x0)

View File

@ -14,7 +14,7 @@
# CHECK-NEXT: Values: [0xB8860BA, 0xB887389]
# CHECK-NEXT: }
.globl foo, bar
.globl bar, foo
foo:
bar:
ret

View File

@ -247,10 +247,10 @@
# PPC64-NEXT: Values: [0xB8860BA, 0xB887389]
# PPC64-NEXT: }
.globl foo,bar,baz
.globl bar,baz,foo
foo:
bar:
.weak zed
.global xyz
.weak zed
.data
.dc.a baz

View File

@ -42,7 +42,7 @@
# CHECK-NEXT: }
# CHECK-NEXT: ]
.comm foo,4,4
.comm bar,4,4
.comm foo,4,4
movl $1, foo(%rip)
movl $2, bar(%rip)

View File

@ -82,5 +82,5 @@
_start:
jmp _start
.comm common_uniq_0,4,4
.comm common_multiple,8,8
.comm common_uniq_0,4,4

View File

@ -15,6 +15,6 @@
# CHECK-NEXT: Section: .text (0x1)
.text
.global _start, __ehdr_start
.global __ehdr_start, _start
_start:
.quad __ehdr_start

View File

@ -1,5 +1,5 @@
# REQUIRES: ppc
#
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
@ -21,6 +21,9 @@ test:
lxv 3, qword@toc@l(3)
blr
.data
.p2align 4
.comm pad, 1, 1
.comm qword, 16, 1
pad:
.byte 1
qword:
.quad 0

View File

@ -21,6 +21,9 @@ test:
lwa 3, word@toc@l(3)
blr
.data
.p2align 4
.comm pad, 1, 1
.comm word, 4, 1
pad:
.byte 1
word:
.long 0

View File

@ -2,320 +2,48 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/resolution.s -o %t2
// RUN: ld.lld -discard-all %t %t2 -o %t3
// RUN: llvm-readobj --symbols %t3 | FileCheck %s
// RUN: llvm-readelf --symbols %t3 | FileCheck %s
// This is an exhaustive test for checking which symbol is kept when two
// have the same name. Each symbol has a different size which is used
// to see which one was chosen.
// CHECK: Symbols [
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: (0)
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local (0x0)
// CHECK-NEXT: Type: None (0x0)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined (0x0)
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonStrong_with_CommonStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 63
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonStrong_with_CommonWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 30
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonStrong_with_RegularStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 55
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonStrong_with_RegularWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 22
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonStrong_with_UndefStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 27
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonStrong_with_UndefWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 26
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonWeak_with_CommonStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 61
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonWeak_with_CommonWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 28
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonWeak_with_RegularStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 53
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonWeak_with_RegularWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 20
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonWeak_with_UndefStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 25
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonWeak_with_UndefWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 24
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularStrong_with_CommonStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 10
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularStrong_with_CommonWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 9
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularStrong_with_RegularWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 2
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularStrong_with_UndefStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 6
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularStrong_with_UndefWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 5
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularWeak_with_CommonStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 40
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularWeak_with_CommonWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 7
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularWeak_with_RegularStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 33
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularWeak_with_RegularWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularWeak_with_UndefStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 4
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularWeak_with_UndefWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 3
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefStrong_with_CommonStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 51
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefStrong_with_CommonWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 50
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefStrong_with_RegularStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 46
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefStrong_with_RegularWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 45
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefWeak_with_CommonStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 49
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefWeak_with_CommonWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 48
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefWeak_with_RegularStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 44
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefWeak_with_RegularWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 43
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefWeak_with_UndefWeak
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: _start
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: None (0x0)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text (0x1)
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK: Symbol table '.symtab' contains 34 entries:
// CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name
// CHECK-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
// CHECK-NEXT: 1: 00000000002021ec 63 OBJECT GLOBAL DEFAULT 2 CommonStrong_with_CommonStrong
// CHECK-NEXT: 2: 000000000020222c 30 OBJECT GLOBAL DEFAULT 2 CommonStrong_with_CommonWeak
// CHECK-NEXT: 3: 00000000002011cc 55 NOTYPE GLOBAL DEFAULT 1 CommonStrong_with_RegularStrong
// CHECK-NEXT: 4: 000000000020224c 22 OBJECT GLOBAL DEFAULT 2 CommonStrong_with_RegularWeak
// CHECK-NEXT: 5: 0000000000202264 27 OBJECT GLOBAL DEFAULT 2 CommonStrong_with_UndefStrong
// CHECK-NEXT: 6: 0000000000202280 26 OBJECT GLOBAL DEFAULT 2 CommonStrong_with_UndefWeak
// CHECK-NEXT: 7: 000000000020229c 61 OBJECT GLOBAL DEFAULT 2 CommonWeak_with_CommonStrong
// CHECK-NEXT: 8: 00000000002022dc 28 OBJECT WEAK DEFAULT 2 CommonWeak_with_CommonWeak
// CHECK-NEXT: 9: 00000000002011cc 53 NOTYPE GLOBAL DEFAULT 1 CommonWeak_with_RegularStrong
// CHECK-NEXT: 10: 00000000002022f8 20 OBJECT WEAK DEFAULT 2 CommonWeak_with_RegularWeak
// CHECK-NEXT: 11: 000000000020230c 25 OBJECT WEAK DEFAULT 2 CommonWeak_with_UndefStrong
// CHECK-NEXT: 12: 0000000000202328 24 OBJECT WEAK DEFAULT 2 CommonWeak_with_UndefWeak
// CHECK-NEXT: 13: 0000000000201159 10 NOTYPE GLOBAL DEFAULT 1 RegularStrong_with_CommonStrong
// CHECK-NEXT: 14: 0000000000201159 9 NOTYPE GLOBAL DEFAULT 1 RegularStrong_with_CommonWeak
// CHECK-NEXT: 15: 0000000000201159 2 NOTYPE GLOBAL DEFAULT 1 RegularStrong_with_RegularWeak
// CHECK-NEXT: 16: 0000000000201159 6 NOTYPE GLOBAL DEFAULT 1 RegularStrong_with_UndefStrong
// CHECK-NEXT: 17: 0000000000201159 5 NOTYPE GLOBAL DEFAULT 1 RegularStrong_with_UndefWeak
// CHECK-NEXT: 18: 0000000000202340 40 OBJECT GLOBAL DEFAULT 2 RegularWeak_with_CommonStrong
// CHECK-NEXT: 19: 0000000000201159 7 NOTYPE WEAK DEFAULT 1 RegularWeak_with_CommonWeak
// CHECK-NEXT: 20: 00000000002011a4 33 NOTYPE GLOBAL DEFAULT 1 RegularWeak_with_RegularStrong
// CHECK-NEXT: 21: 0000000000201159 0 NOTYPE WEAK DEFAULT 1 RegularWeak_with_RegularWeak
// CHECK-NEXT: 22: 0000000000201159 4 NOTYPE WEAK DEFAULT 1 RegularWeak_with_UndefStrong
// CHECK-NEXT: 23: 0000000000201159 3 NOTYPE WEAK DEFAULT 1 RegularWeak_with_UndefWeak
// CHECK-NEXT: 24: 0000000000202368 51 OBJECT GLOBAL DEFAULT 2 UndefStrong_with_CommonStrong
// CHECK-NEXT: 25: 000000000020239c 50 OBJECT WEAK DEFAULT 2 UndefStrong_with_CommonWeak
// CHECK-NEXT: 26: 00000000002011c4 46 NOTYPE GLOBAL DEFAULT 1 UndefStrong_with_RegularStrong
// CHECK-NEXT: 27: 00000000002011c4 45 NOTYPE WEAK DEFAULT 1 UndefStrong_with_RegularWeak
// CHECK-NEXT: 28: 00000000002023d0 49 OBJECT GLOBAL DEFAULT 2 UndefWeak_with_CommonStrong
// CHECK-NEXT: 29: 0000000000202404 48 OBJECT WEAK DEFAULT 2 UndefWeak_with_CommonWeak
// CHECK-NEXT: 30: 00000000002011c4 44 NOTYPE GLOBAL DEFAULT 1 UndefWeak_with_RegularStrong
// CHECK-NEXT: 31: 00000000002011c4 43 NOTYPE WEAK DEFAULT 1 UndefWeak_with_RegularWeak
// CHECK-NEXT: 32: 0000000000000000 0 NOTYPE WEAK DEFAULT UND UndefWeak_with_UndefWeak
// CHECK-NEXT: 33: 0000000000201158 0 NOTYPE GLOBAL DEFAULT 1 _start
.globl _start
_start:

View File

@ -118,11 +118,17 @@
# MULTI: warning: {{.*}}2.o: unable to order absolute symbol: multi
# WARN-NOT: warning:
.section .text._start,"ax",@progbits
.global _start
_start:
movq %rax, absolute
callq shared
absolute = 0x1234
.section .text.gc,"ax",@progbits
.global gc
gc:
.section .text.comdat,"axG",@progbits,comdat,comdat
.weak comdat
comdat:
nop
.section .text.discard,"ax",@progbits
@ -130,9 +136,9 @@ gc:
discard:
nop
.section .text.comdat,"axG",@progbits,comdat,comdat
.weak comdat
comdat:
.section .text.gc,"ax",@progbits
.global gc
gc:
nop
.section .text.glob_or_wk,"ax",@progbits
@ -140,12 +146,6 @@ comdat:
glob_or_wk:
nop
.section .text._start,"ax",@progbits
.global _start
_start:
movq %rax, absolute
callq shared
.section .text.icf1,"ax",@progbits
.global icf1
icf1:

View File

@ -34,8 +34,8 @@
# CHECK-NEXT: }
# CHECK-NEXT: ]
.global foo
.weak bar
.global foo
.data
.dc.a foo
.dc.a bar

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -r --symbols - | FileCheck %s
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t
# RUN: llvm-readobj -r %t | FileCheck %s
# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYM
defined1:
defined2:
@ -31,93 +33,16 @@ global1:
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK: Name: .text (0)
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: Section
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: defined1
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: defined2
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK: Symbol {
// CHECK: Name: bar1@zed
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar3@@zed
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar5@@zed
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar2@zed
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar6@zed
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: g1@@zed
// CHECK-NEXT: Value: 0x14
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: global1
// CHECK-NEXT: Value: 0x14
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: ]
# SYM: Symbol table '.symtab' contains 11 entries:
# SYM-NEXT: Num: Value Size Type Bind Vis Ndx Name
# SYM-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
# SYM-NEXT: 1: 0000000000000000 0 SECTION LOCAL DEFAULT 2 .text
# SYM-NEXT: 2: 0000000000000000 0 NOTYPE LOCAL DEFAULT 2 defined1
# SYM-NEXT: 3: 0000000000000000 0 NOTYPE LOCAL DEFAULT 2 defined2
# SYM-NEXT: 4: 0000000000000000 0 NOTYPE LOCAL DEFAULT 2 bar1@zed
# SYM-NEXT: 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT 2 bar3@@zed
# SYM-NEXT: 6: 0000000000000000 0 NOTYPE LOCAL DEFAULT 2 bar5@@zed
# SYM-NEXT: 7: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar2@zed
# SYM-NEXT: 8: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar6@zed
# SYM-NEXT: 9: 0000000000000014 0 NOTYPE GLOBAL DEFAULT 2 g1@@zed
# SYM-NEXT: 10: 0000000000000014 0 NOTYPE GLOBAL DEFAULT 2 global1

View File

@ -1,4 +1,41 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj --symbols - | FileCheck %s
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s | llvm-readelf -s - | FileCheck %s
# CHECK: Symbol table '.symtab' contains 34 entries:
# CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name
# CHECK-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
# CHECK-NEXT: 1: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 alias1
# CHECK-NEXT: 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 2 alias10
# CHECK-NEXT: 3: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 alias11
# CHECK-NEXT: 4: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 alias12
# CHECK-NEXT: 5: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 alias2
# CHECK-NEXT: 6: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 2 alias3
# CHECK-NEXT: 7: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 alias4
# CHECK-NEXT: 8: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 2 alias5
# CHECK-NEXT: 9: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 2 alias6
# CHECK-NEXT: 10: 0000000000000000 0 TLS GLOBAL DEFAULT 2 alias7
# CHECK-NEXT: 11: 0000000000000000 0 TLS GLOBAL DEFAULT 2 alias8
# CHECK-NEXT: 12: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 alias9
# CHECK-NEXT: 13: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 bar
# CHECK-NEXT: 14: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 foo
# CHECK-NEXT: 15: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 func
# CHECK-NEXT: 16: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 ifunc
# CHECK-NEXT: 17: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 obj
# CHECK-NEXT: 18: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 sym1
# CHECK-NEXT: 19: 0000000000000000 0 TLS GLOBAL DEFAULT 2 sym10
# CHECK-NEXT: 20: 0000000000000000 0 TLS GLOBAL DEFAULT 2 sym11
# CHECK-NEXT: 21: 0000000000000000 0 TLS GLOBAL DEFAULT 2 sym12
# CHECK-NEXT: 22: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 sym2
# CHECK-NEXT: 23: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 sym3
# CHECK-NEXT: 24: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 sym4
# CHECK-NEXT: 25: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 sym5
# CHECK-NEXT: 26: 0000000000000000 0 OBJECT GLOBAL DEFAULT 2 sym6
# CHECK-NEXT: 27: 0000000000000000 0 IFUNC GLOBAL DEFAULT 2 sym7
# CHECK-NEXT: 28: 0000000000000000 0 FUNC GLOBAL DEFAULT 2 sym8
# CHECK-NEXT: 29: 0000000000000000 0 TLS GLOBAL DEFAULT 2 sym9
# CHECK-NEXT: 30: 0000000000000000 0 TLS GLOBAL DEFAULT 2 tls
# CHECK-NEXT: 31: 0000000000000000 0 TLS GLOBAL DEFAULT 2 tls_quoted
# CHECK-NEXT: 32: 0000000000000000 0 TLS GLOBAL DEFAULT 2 tls_upper_case
# CHECK-NEXT: 33: 0000000000000000 0 OBJECT UNIQUE DEFAULT 2 zed
// Test that both % and @ are accepted.
.global foo
@ -129,194 +166,3 @@ alias12:
.global alias12
.type alias12, @function
.set sym12, alias12
// CHECK: Symbol {
// CHECK: Name: bar
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: foo
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Function
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: func
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Function
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: ifunc
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: GNU_IFunc
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: obj
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym1
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: GNU_IFunc (0xA)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym10
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: TLS (0x6)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym11
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: TLS (0x6)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym12
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: TLS (0x6)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym2
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: GNU_IFunc (0xA)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym3
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: GNU_IFunc (0xA)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym4
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: Function (0x2)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym5
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: Function (0x2)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym6
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: Object (0x1)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym7
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: GNU_IFunc (0xA)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym8
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: Function (0x2)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym9
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: TLS (0x6)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: tls
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: TLS
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: tls_quoted
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: TLS
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: tls_upper_case
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: TLS
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: zed
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Unique (0xA)
// CHECK-NEXT: Type: Object (0x1)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: ]

View File

@ -1,7 +1,15 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj --symbols - | FileCheck %s
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s | llvm-readelf -s - | FileCheck %s
// Test which symbols should be in the symbol table
# CHECK: Symbol table '.symtab' contains 5 entries:
# CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name
# CHECK-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
# CHECK-NEXT: 1: 0000000000000000 0 NOTYPE LOCAL DEFAULT 4 .Lsym8
# CHECK-NEXT: 2: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND hidden
# CHECK-NEXT: 3: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND sym6
# CHECK-NEXT: 4: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND undef
.Lsym2:
.Lsym3:
.Lsym4 = .Lsym2 - .Lsym3
@ -22,53 +30,3 @@
test2_a = undef
test2_b = undef + 1
// CHECK: Symbols [
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: (0)
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: .Lsym8
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .rodata.str1.1
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: hidden
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other [
// CHECK-NEXT: STV_HIDDEN
// CHECK-NEXT: ]
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym6
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: undef
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: ]

View File

@ -1,10 +1,30 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj --symbols - | FileCheck %s
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s | llvm-readelf -s - | FileCheck %s
// This is a long test that checks that the aliases created by weakref are
// never in the symbol table and that the only case it causes a symbol to
// be output as a weak undefined symbol is if that variable is not defined
// in this file and all the references to it are done via the alias.
# CHECK: Num: Value Size Type Bind Vis Ndx Name
# CHECK-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
# CHECK-NEXT: 1: 0000000000000000 0 SECTION LOCAL DEFAULT 2 .text
# CHECK-NEXT: 2: 0000000000000018 0 NOTYPE LOCAL DEFAULT 2 bar6
# CHECK-NEXT: 3: 0000000000000018 0 NOTYPE LOCAL DEFAULT 2 bar7
# CHECK-NEXT: 4: 000000000000001c 0 NOTYPE LOCAL DEFAULT 2 bar8
# CHECK-NEXT: 5: 0000000000000020 0 NOTYPE LOCAL DEFAULT 2 bar9
# CHECK-NEXT: 6: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar1
# CHECK-NEXT: 7: 0000000000000028 0 NOTYPE GLOBAL DEFAULT 2 bar10
# CHECK-NEXT: 8: 0000000000000030 0 NOTYPE GLOBAL DEFAULT 2 bar11
# CHECK-NEXT: 9: 0000000000000030 0 NOTYPE GLOBAL DEFAULT 2 bar12
# CHECK-NEXT: 10: 0000000000000034 0 NOTYPE GLOBAL DEFAULT 2 bar13
# CHECK-NEXT: 11: 0000000000000038 0 NOTYPE GLOBAL DEFAULT 2 bar14
# CHECK-NEXT: 12: 0000000000000040 0 NOTYPE GLOBAL DEFAULT 2 bar15
# CHECK-NEXT: 13: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar2
# CHECK-NEXT: 14: 0000000000000000 0 NOTYPE WEAK DEFAULT UND bar3
# CHECK-NEXT: 15: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar4
# CHECK-NEXT: 16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar5
.weakref foo1, bar1
.weakref foo2, bar2
@ -68,159 +88,3 @@ bar15:
.weakref foo15, bar15
.long bar15
.long foo15
// CHECK: Symbols [
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: (0)
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local (0x0)
// CHECK-NEXT: Type: None (0x0)
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined (0x0)
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: .text (0)
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: Section
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar6
// CHECK-NEXT: Value: 0x18
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar7
// CHECK-NEXT: Value: 0x18
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar8
// CHECK-NEXT: Value: 0x1C
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar9
// CHECK-NEXT: Value: 0x20
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar1
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar10
// CHECK-NEXT: Value: 0x28
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar11
// CHECK-NEXT: Value: 0x30
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar12
// CHECK-NEXT: Value: 0x30
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar13
// CHECK-NEXT: Value: 0x34
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar14
// CHECK-NEXT: Value: 0x38
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar15
// CHECK-NEXT: Value: 0x40
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar2
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined (0x0)
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar3
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined (0x0)
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar4
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined (0x0)
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar5
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined (0x0)
// CHECK-NEXT: }
// CHECK-NEXT: ]