2018-06-27 06:20:04 +08:00
|
|
|
// REQUIRES: x86
|
2015-08-14 10:42:20 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld %t -o %t2
|
2015-08-25 23:53:17 +08:00
|
|
|
// RUN: llvm-readobj -symbols -sections %t2 | FileCheck %s
|
2015-08-14 10:42:20 +08:00
|
|
|
|
2015-08-14 23:10:49 +08:00
|
|
|
.type _start, @function
|
2015-08-14 21:07:05 +08:00
|
|
|
.globl _start
|
2015-08-14 10:42:20 +08:00
|
|
|
_start:
|
|
|
|
|
2015-08-14 23:10:49 +08:00
|
|
|
.type foo, @object
|
2015-08-14 21:07:05 +08:00
|
|
|
.weak foo
|
|
|
|
foo:
|
|
|
|
|
2015-08-15 00:46:28 +08:00
|
|
|
.type bar, @object
|
|
|
|
.weak bar
|
|
|
|
.long bar
|
|
|
|
|
2015-08-25 23:53:17 +08:00
|
|
|
.section foobar,"a",@nobits,unique,1
|
2015-08-25 04:06:32 +08:00
|
|
|
.globl zed
|
|
|
|
zed:
|
2015-08-25 23:53:17 +08:00
|
|
|
.long 0
|
|
|
|
.globl zed2
|
|
|
|
zed2:
|
|
|
|
.long 0
|
|
|
|
|
|
|
|
.section foobar,"a",@nobits,unique,2
|
|
|
|
.globl zed3
|
2015-08-27 05:46:24 +08:00
|
|
|
.size zed3, 4
|
2015-08-25 23:53:17 +08:00
|
|
|
zed3:
|
|
|
|
|
2015-08-27 20:40:06 +08:00
|
|
|
.globl abs
|
|
|
|
abs = 0x123
|
|
|
|
|
2015-08-29 05:26:51 +08:00
|
|
|
.comm common,4,4
|
|
|
|
|
2015-09-02 03:42:38 +08:00
|
|
|
.global protected
|
|
|
|
.protected protected
|
|
|
|
protected:
|
|
|
|
|
2015-09-02 04:36:51 +08:00
|
|
|
.global hidden
|
|
|
|
.hidden hidden
|
|
|
|
hidden:
|
|
|
|
|
|
|
|
.global internal
|
|
|
|
.internal internal
|
|
|
|
internal:
|
|
|
|
|
2015-10-02 05:15:02 +08:00
|
|
|
// CHECK: Name: foobar
|
2015-09-24 02:25:05 +08:00
|
|
|
// CHECK-NEXT: Type: SHT_NOBITS
|
2015-08-25 23:53:17 +08:00
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: ]
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Address: 0x200158
|
2015-08-25 23:53:17 +08:00
|
|
|
|
2015-09-24 02:25:05 +08:00
|
|
|
// CHECK: Name: .text
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: SHF_EXECINSTR
|
2015-09-01 06:07:18 +08:00
|
|
|
// CHECK-NEXT: ]
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Address: 0x201000
|
2015-09-01 06:07:18 +08:00
|
|
|
|
2015-10-02 05:15:02 +08:00
|
|
|
// CHECK: Name: .bss
|
2015-08-25 23:53:17 +08:00
|
|
|
// CHECK-NEXT: Type: SHT_NOBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
2015-10-02 05:15:02 +08:00
|
|
|
// CHECK-NEXT: SHF_WRITE
|
2015-08-25 23:53:17 +08:00
|
|
|
// CHECK-NEXT: ]
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Address: 0x202000
|
2016-02-24 02:39:55 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
2015-10-02 05:15:02 +08:00
|
|
|
// CHECK-NEXT: Size: 4
|
2015-08-25 04:06:32 +08:00
|
|
|
|
2015-08-14 21:07:05 +08:00
|
|
|
// 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: }
|
2015-10-05 23:24:04 +08:00
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: hidden
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Value: 0x200160
|
2015-10-05 23:24:04 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Local
|
|
|
|
// CHECK-NEXT: Type: None
|
2016-03-25 00:30:20 +08:00
|
|
|
// CHECK-NEXT: Other [ (0x2)
|
|
|
|
// CHECK-NEXT: STV_HIDDEN
|
|
|
|
// CHECK-NEXT: ]
|
2015-10-05 23:24:04 +08:00
|
|
|
// CHECK-NEXT: Section: foobar
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: internal
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Value: 0x200160
|
2015-10-05 23:24:04 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Local
|
|
|
|
// CHECK-NEXT: Type: None
|
2016-03-25 00:30:20 +08:00
|
|
|
// CHECK-NEXT: Other [ (0x1)
|
|
|
|
// CHECK-NEXT: STV_INTERNAL
|
|
|
|
// CHECK-NEXT: ]
|
2015-10-05 23:24:04 +08:00
|
|
|
// CHECK-NEXT: Section: foobar
|
|
|
|
// CHECK-NEXT: }
|
2015-08-14 21:07:05 +08:00
|
|
|
// CHECK-NEXT: Symbol {
|
2015-08-28 10:46:41 +08:00
|
|
|
// CHECK-NEXT: Name: _start
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Value: 0x201000
|
2015-08-25 04:06:32 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global (0x1)
|
2015-08-28 10:46:41 +08:00
|
|
|
// CHECK-NEXT: Type: Function
|
2015-08-25 04:06:32 +08:00
|
|
|
// CHECK-NEXT: Other: 0
|
2015-08-28 10:46:41 +08:00
|
|
|
// CHECK-NEXT: Section: .text
|
2015-08-25 23:53:17 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
2015-08-28 10:46:41 +08:00
|
|
|
// CHECK-NEXT: Name: abs
|
|
|
|
// CHECK-NEXT: Value: 0x123
|
|
|
|
// CHECK-NEXT: Size: 0
|
2015-08-25 23:53:17 +08:00
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
2015-08-28 10:46:41 +08:00
|
|
|
// CHECK-NEXT: Section: Absolute
|
2015-08-14 21:07:05 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
2015-08-15 00:46:28 +08:00
|
|
|
// CHECK-NEXT: Name: bar
|
|
|
|
// CHECK-NEXT: Value: 0x0
|
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Weak (0x2)
|
|
|
|
// CHECK-NEXT: Type: Object (0x1)
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: Undefined (0x0)
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
2015-09-18 02:26:25 +08:00
|
|
|
// CHECK-NEXT: Name: common
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Value: 0x202000
|
2015-09-18 02:26:25 +08:00
|
|
|
// CHECK-NEXT: Size: 4
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: Object
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .bss
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
2015-08-14 21:07:05 +08:00
|
|
|
// CHECK-NEXT: Name: foo
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Value: 0x201000
|
2015-08-14 21:07:05 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
2015-08-14 21:52:36 +08:00
|
|
|
// CHECK-NEXT: Binding: Weak (0x2)
|
2015-08-14 23:10:49 +08:00
|
|
|
// CHECK-NEXT: Type: Object
|
2015-08-14 21:07:05 +08:00
|
|
|
// CHECK-NEXT: Other: 0
|
2015-08-25 04:06:32 +08:00
|
|
|
// CHECK-NEXT: Section: .text
|
2015-08-14 21:07:05 +08:00
|
|
|
// CHECK-NEXT: }
|
2015-08-25 23:53:17 +08:00
|
|
|
// CHECK-NEXT: Symbol {
|
2015-09-18 02:26:25 +08:00
|
|
|
// CHECK-NEXT: Name: protected
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Value: 0x200160
|
2015-09-18 02:26:25 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
2016-03-25 00:30:20 +08:00
|
|
|
// CHECK-NEXT: Other [ (0x3)
|
|
|
|
// CHECK-NEXT: STV_PROTECTED
|
|
|
|
// CHECK-NEXT: ]
|
2015-09-18 02:26:25 +08:00
|
|
|
// CHECK-NEXT: Section: foobar
|
2015-08-29 05:26:51 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
2015-08-28 10:46:41 +08:00
|
|
|
// CHECK-NEXT: Name: zed
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Value: 0x200158
|
2015-08-28 10:46:41 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global (0x1)
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: foobar
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
2015-09-18 02:26:25 +08:00
|
|
|
// CHECK-NEXT: Name: zed2
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Value: 0x20015C
|
2015-09-02 03:42:38 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
2015-09-18 02:26:25 +08:00
|
|
|
// CHECK-NEXT: Other: 0
|
2015-09-02 03:42:38 +08:00
|
|
|
// CHECK-NEXT: Section: foobar
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
2015-08-28 10:46:41 +08:00
|
|
|
// CHECK-NEXT: Name: zed3
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Value: 0x200160
|
2015-08-28 10:46:41 +08:00
|
|
|
// CHECK-NEXT: Size: 4
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: foobar
|
|
|
|
// CHECK-NEXT: }
|
2015-08-14 10:42:20 +08:00
|
|
|
// CHECK-NEXT: ]
|