blob: 3cb5c63a49f2a00b6469f224079e361efa6d8951 [file] [log] [blame]
Igor Kudrin304860a2015-11-12 04:39:49 +00001# Check MIPS specific .dynamic section entries.
2
3# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
4# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %p/Inputs/mips-dynamic.s -o %td.o
Rafael Espindola9c8904f2015-11-18 06:11:01 +00005# RUN: ld.lld -shared %td.o -o %td.so
Igor Kudrin304860a2015-11-12 04:39:49 +00006
Rafael Espindola9c8904f2015-11-18 06:11:01 +00007# RUN: ld.lld %t.o %td.so -o %t.exe
Igor Kudrin304860a2015-11-12 04:39:49 +00008# RUN: llvm-readobj -sections -dynamic-table %t.exe \
9# RUN: | FileCheck -check-prefix=EXE %s
10
Rui Ueyamacafc0f2e2016-07-14 17:40:18 +000011# RUN: ld.lld %t.o --image-base=0x123000 %td.so -o %t.exe
12# RUN: llvm-readobj -sections -dynamic-table %t.exe \
13# RUN: | FileCheck -check-prefix=IMAGE_BASE %s
14
Rafael Espindola9c8904f2015-11-18 06:11:01 +000015# RUN: ld.lld -shared %t.o %td.so -o %t.so
Igor Kudrin304860a2015-11-12 04:39:49 +000016# RUN: llvm-readobj -sections -dyn-symbols -dynamic-table %t.so \
17# RUN: | FileCheck -check-prefix=DSO %s
18
19# REQUIRES: mips
20
21# EXE: Sections [
22# EXE: Name: .dynamic
23# EXE-NEXT: Type: SHT_DYNAMIC
24# EXE-NEXT: Flags [
25# EXE-NEXT: SHF_ALLOC
26# EXE-NEXT: ]
George Rimar11721ce2015-11-24 10:04:22 +000027# EXE: Name: .got
28# EXE-NEXT: Type: SHT_PROGBITS
29# EXE-NEXT: Flags [ (0x10000003)
30# EXE-NEXT: SHF_ALLOC
Simon Atanasyanc3e54cf2016-01-20 20:01:28 +000031# EXE-NEXT: SHF_MIPS_GPREL
George Rimar11721ce2015-11-24 10:04:22 +000032# EXE-NEXT: SHF_WRITE
33# EXE-NEXT: ]
34# EXE-NEXT: Address: [[GOTADDR:0x[0-9a-f]+]]
35# EXE-NEXT: Offset:
36# EXE-NEXT: Size: 8
George Rimare3336c02015-11-24 10:15:50 +000037# EXE: Name: .rld_map
38# EXE-NEXT: Type: SHT_PROGBITS
39# EXE-NEXT: Flags [
40# EXE-NEXT: SHF_ALLOC
41# EXE-NEXT: SHF_WRITE
42# EXE-NEXT: ]
43# EXE-NEXT: Address: [[RLDMAPADDR:0x[0-9a-f]+]]
44# EXE-NEXT: Offset:
45# EXE-NEXT: Size: 4
Igor Kudrin304860a2015-11-12 04:39:49 +000046# EXE: ]
47# EXE: DynamicSection [
48# EXE-NEXT: Tag Type Name/Value
49# EXE-DAG: 0x00000003 PLTGOT [[GOTADDR]]
50# EXE-DAG: 0x70000001 MIPS_RLD_VERSION 1
51# EXE-DAG: 0x70000005 MIPS_FLAGS NOTPOT
Rui Ueyamacafc0f2e2016-07-14 17:40:18 +000052# EXE-DAG: 0x70000006 MIPS_BASE_ADDRESS 0x10000
Igor Kudrin304860a2015-11-12 04:39:49 +000053# EXE-DAG: 0x7000000A MIPS_LOCAL_GOTNO 2
Peter Collingbournef6e9b4e2016-04-13 16:57:28 +000054# EXE-DAG: 0x70000011 MIPS_SYMTABNO 2
55# EXE-DAG: 0x70000013 MIPS_GOTSYM 0x2
Igor Kudrin304860a2015-11-12 04:39:49 +000056# EXE-DAG: 0x70000016 MIPS_RLD_MAP [[RLDMAPADDR]]
57# EXE: ]
58
Rui Ueyamacafc0f2e2016-07-14 17:40:18 +000059# IMAGE_BASE: 0x70000006 MIPS_BASE_ADDRESS 0x123000
60
Igor Kudrin304860a2015-11-12 04:39:49 +000061# DSO: Sections [
62# DSO: Name: .dynamic
63# DSO-NEXT: Type: SHT_DYNAMIC
64# DSO-NEXT: Flags [
65# DSO-NEXT: SHF_ALLOC
66# DSO-NEXT: ]
67# DSO: Name: .got
68# DSO-NEXT: Type: SHT_PROGBITS
69# DSO-NEXT: Flags [ (0x10000003)
70# DSO-NEXT: SHF_ALLOC
Simon Atanasyanc3e54cf2016-01-20 20:01:28 +000071# DSO-NEXT: SHF_MIPS_GPREL
Igor Kudrin304860a2015-11-12 04:39:49 +000072# DSO-NEXT: SHF_WRITE
73# DSO-NEXT: ]
74# DSO-NEXT: Address: [[GOTADDR:0x[0-9a-f]+]]
75# DSO-NEXT: Offset:
76# DSO-NEXT: Size: 8
77# DSO: ]
78# DSO: DynamicSymbols [
79# DSO: Name: @
Simon Atanasyan41325112016-06-19 21:39:37 +000080# DSO: Name: __start@
Simon Atanasyan7b8481b2016-06-20 11:37:56 +000081# DSO: Name: _foo@
Igor Kudrin304860a2015-11-12 04:39:49 +000082# DSO: ]
83# DSO: DynamicSection [
84# DSO-NEXT: Tag Type Name/Value
85# DSO-DAG: 0x00000003 PLTGOT [[GOTADDR]]
86# DSO-DAG: 0x70000001 MIPS_RLD_VERSION 1
87# DSO-DAG: 0x70000005 MIPS_FLAGS NOTPOT
88# DSO-DAG: 0x70000006 MIPS_BASE_ADDRESS 0x0
89# DSO-DAG: 0x7000000A MIPS_LOCAL_GOTNO 2
Peter Collingbournef6e9b4e2016-04-13 16:57:28 +000090# DSO-DAG: 0x70000011 MIPS_SYMTABNO 3
91# DSO-DAG: 0x70000013 MIPS_GOTSYM 0x3
Igor Kudrin304860a2015-11-12 04:39:49 +000092# DSO: ]
93
94 .text
95 .globl __start,_foo
96 .type _foo,@function
97__start:
98 nop