2014-03-22 06:00:29 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -t - | FileCheck %s
|
|
|
|
|
|
|
|
// Test that a variable declared with "var = other_var + cst" is in the same
|
|
|
|
// section as other_var and its value is the value of other_var + cst.
|
|
|
|
|
2014-03-24 11:48:15 +08:00
|
|
|
.data
|
|
|
|
.globl sym_a
|
2014-03-27 08:28:24 +08:00
|
|
|
.size sym_a, 42
|
2014-03-24 11:48:15 +08:00
|
|
|
.byte 42
|
|
|
|
.type sym_a, @object
|
2014-03-22 06:00:29 +08:00
|
|
|
sym_a:
|
|
|
|
|
|
|
|
// CHECK: Symbol {
|
|
|
|
// CHECK: Name: sym_a
|
2014-03-24 11:48:15 +08:00
|
|
|
// CHECK-NEXT: Value: 0x1
|
2014-03-27 08:28:24 +08:00
|
|
|
// CHECK-NEXT: Size: 42
|
2014-03-24 11:48:15 +08:00
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: Object
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .data
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
|
|
|
|
.long 42
|
|
|
|
.globl sym_b
|
|
|
|
sym_b:
|
|
|
|
.globl sym_c
|
|
|
|
sym_c = sym_a
|
|
|
|
// CHECK: Symbol {
|
|
|
|
// CHECK: Name: sym_c
|
|
|
|
// CHECK-NEXT: Value: 0x1
|
2014-03-27 08:28:24 +08:00
|
|
|
// CHECK-NEXT: Size: 42
|
2014-03-24 11:48:15 +08:00
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: Object
|
2014-03-22 06:00:29 +08:00
|
|
|
// CHECK-NEXT: Other: 0
|
2014-03-24 11:48:15 +08:00
|
|
|
// CHECK-NEXT: Section: .data
|
2014-03-22 06:00:29 +08:00
|
|
|
// CHECK-NEXT: }
|
2014-03-24 11:48:15 +08:00
|
|
|
|
|
|
|
.globl sym_d
|
|
|
|
sym_d = sym_a + 1
|
|
|
|
// CHECK: Symbol {
|
|
|
|
// CHECK: Name: sym_d
|
|
|
|
// CHECK-NEXT: Value: 0x2
|
2014-03-27 08:28:24 +08:00
|
|
|
// CHECK-NEXT: Size: 42
|
2014-03-24 11:48:15 +08:00
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: Object
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .data
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
|
|
|
|
.globl sym_e
|
|
|
|
sym_e = sym_a + (sym_b - sym_a) * 3
|
|
|
|
// CHECK: Symbol {
|
|
|
|
// CHECK: Name: sym_e
|
|
|
|
// CHECK-NEXT: Value: 0xD
|
2014-03-27 08:28:24 +08:00
|
|
|
// CHECK-NEXT: Size: 42
|
2014-03-24 11:48:15 +08:00
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: Object
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .data
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
|
|
|
|
|
|
|
|
.globl sym_f
|
|
|
|
sym_f = sym_a + (1 - 1)
|
|
|
|
// CHECK: Symbol {
|
|
|
|
// CHECK: Name: sym_f
|
2014-03-22 06:00:29 +08:00
|
|
|
// CHECK-NEXT: Value: 0x1
|
2014-03-27 08:28:24 +08:00
|
|
|
// CHECK-NEXT: Size: 42
|
2014-03-24 11:48:15 +08:00
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: Object
|
2014-03-22 06:00:29 +08:00
|
|
|
// CHECK-NEXT: Other: 0
|
2014-03-24 11:48:15 +08:00
|
|
|
// CHECK-NEXT: Section: .data
|
2014-03-22 06:00:29 +08:00
|
|
|
// CHECK-NEXT: }
|
2014-04-29 04:53:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
.globl test2_a
|
|
|
|
.globl test2_b
|
|
|
|
.globl test2_c
|
|
|
|
.globl test2_d
|
|
|
|
.globl test2_e
|
|
|
|
test2_a:
|
|
|
|
.long 0
|
|
|
|
test2_b = test2_a
|
|
|
|
test2_c:
|
|
|
|
.long 0
|
|
|
|
test2_d = test2_c
|
|
|
|
test2_e = test2_d - test2_b
|
|
|
|
// CHECK: Symbol {
|
|
|
|
// CHECK: Name: test2_a
|
|
|
|
// CHECK-NEXT: Value: 0x5
|
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .data
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: test2_b
|
|
|
|
// CHECK-NEXT: Value: 0x5
|
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .data
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: test2_c
|
|
|
|
// CHECK-NEXT: Value: 0x9
|
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .data
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: test2_d
|
|
|
|
// CHECK-NEXT: Value: 0x9
|
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .data
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: test2_e
|
|
|
|
// CHECK-NEXT: Value: 0x4
|
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: Absolute
|
|
|
|
// CHECK-NEXT: }
|