• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -relocation-model=pic -data-sections -o - %s | FileCheck %s
2
3target triple = "x86_64-unknown-linux-gnu"
4
5@hidden = external hidden global i8
6@default = external global i8
7
8; CHECK: .section .rodata.rodata
9; CHECK: rodata:
10; CHECK: .long hidden-rodata
11@rodata = hidden constant i32 trunc (i64 sub (i64 ptrtoint (i8* @hidden to i64), i64 ptrtoint (i32* @rodata to i64)) to i32)
12
13; CHECK: .section .data.rel.ro.relro1
14; CHECK: relro1:
15; CHECK: .long default-relro1
16@relro1 = hidden constant i32 trunc (i64 sub (i64 ptrtoint (i8* @default to i64), i64 ptrtoint (i32* @relro1 to i64)) to i32)
17
18; CHECK: .section .data.rel.ro.relro2
19; CHECK: relro2:
20; CHECK: .long hidden-relro2
21@relro2 = constant i32 trunc (i64 sub (i64 ptrtoint (i8* @hidden to i64), i64 ptrtoint (i32* @relro2 to i64)) to i32)
22
23; CHECK:      .section .rodata.cst8
24; CHECK-NEXT: .globl obj
25; CHECK:      obj:
26; CHECK:      .long 0
27; CHECK:      .long (hidden_func-obj)-4
28
29declare hidden void @hidden_func()
30
31; Ensure that inbound GEPs with constant offsets are also resolved.
32@obj = dso_local unnamed_addr constant { { i32, i32 } } {
33  { i32, i32 } {
34    i32 0,
35    i32 trunc (i64 sub (i64 ptrtoint (void ()* dso_local_equivalent @hidden_func to i64), i64 ptrtoint (i32* getelementptr inbounds ({ { i32, i32 } }, { { i32, i32 } }* @obj, i32 0, i32 0, i32 1) to i64)) to i32)
36  } }, align 4
37
38; CHECK:      .section .rodata.rodata2
39; CHECK-NEXT: .globl rodata2
40; CHECK:      rodata2:
41; CHECK:      .long extern_func@PLT-rodata2
42
43declare void @extern_func()
44
45@rodata2 = dso_local constant i32 trunc (i64 sub (i64 ptrtoint (void ()* dso_local_equivalent @extern_func to i64), i64 ptrtoint (i32* @rodata2 to i64)) to i32)
46