2016-04-28 04:22:31 +08:00
|
|
|
# REQUIRES: x86
|
2017-10-04 17:46:53 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/verneed1.s -o %t1.o
|
2021-08-01 09:57:19 +08:00
|
|
|
# RUN: echo "v1 {}; v2 {}; v3 { global: f1; local: *; };" > %t.script
|
2017-10-04 17:46:53 +08:00
|
|
|
# RUN: ld.lld -shared %t1.o --version-script %t.script -o %t1.so -soname verneed1.so.0
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/verneed2.s -o %t2.o
|
|
|
|
# RUN: ld.lld -shared %t2.o --version-script %t.script -o %t2.so -soname verneed2.so.0
|
|
|
|
|
2016-04-28 04:22:31 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
2017-10-06 17:37:44 +08:00
|
|
|
# RUN: ld.lld --hash-style=sysv %t.o %t1.so %t2.so -o %t
|
2020-03-04 11:49:14 +08:00
|
|
|
# RUN: llvm-readobj -S -d --section-data --dyn-syms -V %t | FileCheck %s
|
2016-04-28 04:22:31 +08:00
|
|
|
|
2016-06-06 16:04:53 +08:00
|
|
|
# CHECK: Section {
|
2018-05-16 01:02:35 +08:00
|
|
|
# CHECK: Index: 1
|
|
|
|
# CHECK-NEXT: Name: .dynsym
|
|
|
|
# CHECK-NEXT: Type: SHT_DYNSYM (0xB)
|
|
|
|
# CHECK-NEXT: Flags [ (0x2)
|
|
|
|
# CHECK-NEXT: SHF_ALLOC (0x2)
|
|
|
|
# CHECK-NEXT: ]
|
[ELF] Split RW PT_LOAD on the PT_GNU_RELRO boundary
Summary:
Based on Peter Collingbourne's suggestion in D56828.
Before D56828: PT_LOAD(.data PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .bss)
Old: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .data .bss)
New: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro)) PT_LOAD(.data. .bss)
The new layout reflects the runtime memory mappings.
By having two PT_LOAD segments, we can utilize the NOBITS part of the
first PT_LOAD and save bytes for .bss.rel.ro.
.bss.rel.ro is currently small and only used by copy relocations of
symbols in read-only segments, but it can be used for other purposes in
the future, e.g. if a relro section's statically relocated data is all
zeros, we can move it to .bss.rel.ro.
Reviewers: espindola, ruiu, pcc
Reviewed By: ruiu
Subscribers: nemanjai, jvesely, nhaehnle, javed.absar, kbarton, emaste, arichardson, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58892
llvm-svn: 356226
2019-03-15 09:29:57 +08:00
|
|
|
# CHECK-NEXT: Address: 0x200200
|
|
|
|
# CHECK-NEXT: Offset: 0x200
|
2018-05-16 01:02:35 +08:00
|
|
|
# CHECK-NEXT: Size: 96
|
2018-06-27 06:13:32 +08:00
|
|
|
# CHECK-NEXT: Link: [[DYNSTR:.*]]
|
2018-05-16 01:02:35 +08:00
|
|
|
# CHECK-NEXT: Info: 1
|
|
|
|
# CHECK-NEXT: AddressAlignment: 8
|
|
|
|
# CHECK-NEXT: EntrySize: 24
|
|
|
|
|
|
|
|
# CHECK: Section {
|
2018-06-27 06:13:32 +08:00
|
|
|
# CHECK-NEXT: Index: 2
|
2018-05-16 01:02:35 +08:00
|
|
|
# CHECK-NEXT: Name: .gnu.version
|
|
|
|
# CHECK-NEXT: Type: SHT_GNU_versym (0x6FFFFFFF)
|
2016-06-06 16:04:53 +08:00
|
|
|
# CHECK-NEXT: Flags [ (0x2)
|
|
|
|
# CHECK-NEXT: SHF_ALLOC (0x2)
|
|
|
|
# CHECK-NEXT: ]
|
2018-06-27 06:13:32 +08:00
|
|
|
# CHECK-NEXT: Address: [[VERSYM:.*]]
|
|
|
|
# CHECK-NEXT: Offset: [[VERSYM_OFFSET:.*]]
|
2018-05-16 01:02:35 +08:00
|
|
|
# CHECK-NEXT: Size: 8
|
|
|
|
# CHECK-NEXT: Link: 1
|
|
|
|
# CHECK-NEXT: Info: 0
|
|
|
|
# CHECK-NEXT: AddressAlignment: 2
|
|
|
|
# CHECK-NEXT: EntrySize: 2
|
|
|
|
|
2018-05-11 16:11:25 +08:00
|
|
|
# CHECK: Section {
|
2018-06-27 06:13:32 +08:00
|
|
|
# CHECK-NEXT: Index: 3
|
2018-05-16 01:02:35 +08:00
|
|
|
# CHECK-NEXT: Name: .gnu.version_r
|
|
|
|
# CHECK-NEXT: Type: SHT_GNU_verneed (0x6FFFFFFE)
|
|
|
|
# CHECK-NEXT: Flags [ (0x2)
|
|
|
|
# CHECK-NEXT: SHF_ALLOC (0x2)
|
|
|
|
# CHECK-NEXT: ]
|
2018-06-27 06:13:32 +08:00
|
|
|
# CHECK-NEXT: Address: [[VERNEED:.*]]
|
[ELF] Split RW PT_LOAD on the PT_GNU_RELRO boundary
Summary:
Based on Peter Collingbourne's suggestion in D56828.
Before D56828: PT_LOAD(.data PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .bss)
Old: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .data .bss)
New: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro)) PT_LOAD(.data. .bss)
The new layout reflects the runtime memory mappings.
By having two PT_LOAD segments, we can utilize the NOBITS part of the
first PT_LOAD and save bytes for .bss.rel.ro.
.bss.rel.ro is currently small and only used by copy relocations of
symbols in read-only segments, but it can be used for other purposes in
the future, e.g. if a relro section's statically relocated data is all
zeros, we can move it to .bss.rel.ro.
Reviewers: espindola, ruiu, pcc
Reviewed By: ruiu
Subscribers: nemanjai, jvesely, nhaehnle, javed.absar, kbarton, emaste, arichardson, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58892
llvm-svn: 356226
2019-03-15 09:29:57 +08:00
|
|
|
# CHECK-NEXT: Offset: 0x268
|
2018-05-16 01:02:35 +08:00
|
|
|
# CHECK-NEXT: Size: 80
|
2018-06-27 06:13:32 +08:00
|
|
|
# CHECK-NEXT: Link: 5
|
2018-05-16 01:02:35 +08:00
|
|
|
# CHECK-NEXT: Info: 2
|
|
|
|
# CHECK-NEXT: AddressAlignment: 4
|
|
|
|
# CHECK-NEXT: EntrySize: 0
|
2016-04-28 04:22:31 +08:00
|
|
|
|
2018-06-27 06:13:32 +08:00
|
|
|
# CHECK: Index: [[DYNSTR]]
|
|
|
|
# CHECK-NEXT: Name: .dynstr
|
|
|
|
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
|
|
|
|
# CHECK-NEXT: Flags [ (0x2)
|
|
|
|
# CHECK-NEXT: SHF_ALLOC (0x2)
|
|
|
|
# CHECK-NEXT: ]
|
[ELF] Split RW PT_LOAD on the PT_GNU_RELRO boundary
Summary:
Based on Peter Collingbourne's suggestion in D56828.
Before D56828: PT_LOAD(.data PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .bss)
Old: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .data .bss)
New: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro)) PT_LOAD(.data. .bss)
The new layout reflects the runtime memory mappings.
By having two PT_LOAD segments, we can utilize the NOBITS part of the
first PT_LOAD and save bytes for .bss.rel.ro.
.bss.rel.ro is currently small and only used by copy relocations of
symbols in read-only segments, but it can be used for other purposes in
the future, e.g. if a relro section's statically relocated data is all
zeros, we can move it to .bss.rel.ro.
Reviewers: espindola, ruiu, pcc
Reviewed By: ruiu
Subscribers: nemanjai, jvesely, nhaehnle, javed.absar, kbarton, emaste, arichardson, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58892
llvm-svn: 356226
2019-03-15 09:29:57 +08:00
|
|
|
# CHECK-NEXT: Address: 0x2002E0
|
|
|
|
# CHECK-NEXT: Offset: 0x2E0
|
2018-06-27 06:13:32 +08:00
|
|
|
# CHECK-NEXT: Size: 47
|
|
|
|
# CHECK-NEXT: Link: 0
|
|
|
|
# CHECK-NEXT: Info: 0
|
|
|
|
# CHECK-NEXT: AddressAlignment: 1
|
|
|
|
# CHECK-NEXT: EntrySize: 0
|
|
|
|
# CHECK-NEXT: SectionData (
|
2019-04-09 01:48:05 +08:00
|
|
|
# CHECK-NEXT: 0000: 00663100 66320067 31007665 726E6565 |.f1.f2.g1.vernee|
|
|
|
|
# CHECK-NEXT: 0010: 64312E73 6F2E3000 76320076 33007665 |d1.so.0.v2.v3.ve|
|
2019-03-13 04:58:34 +08:00
|
|
|
# CHECK-NEXT: 0020: 726E6565 64322E73 6F2E3000 763100 |rneed2.so.0.v1.|
|
2018-06-27 06:13:32 +08:00
|
|
|
# CHECK-NEXT: )
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
|
2020-03-04 11:49:14 +08:00
|
|
|
# CHECK: 0x000000006FFFFFF0 VERSYM [[VERSYM]]
|
|
|
|
# CHECK-NEXT: 0x000000006FFFFFFE VERNEED [[VERNEED]]
|
|
|
|
# CHECK-NEXT: 0x000000006FFFFFFF VERNEEDNUM 2
|
|
|
|
|
2016-04-28 04:22:31 +08:00
|
|
|
# CHECK: DynamicSymbols [
|
|
|
|
# CHECK-NEXT: Symbol {
|
2019-01-08 18:50:59 +08:00
|
|
|
# CHECK-NEXT: Name:
|
2016-04-28 04:22:31 +08:00
|
|
|
# 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 {
|
2016-11-02 05:26:28 +08:00
|
|
|
# CHECK-NEXT: Name: f1@v3
|
2016-04-28 04:22:31 +08:00
|
|
|
# CHECK-NEXT: Value: 0x0
|
|
|
|
# CHECK-NEXT: Size: 0
|
|
|
|
# CHECK-NEXT: Binding: Global (0x1)
|
|
|
|
# CHECK-NEXT: Type: None (0x0)
|
|
|
|
# CHECK-NEXT: Other: 0
|
|
|
|
# CHECK-NEXT: Section: Undefined (0x0)
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Symbol {
|
2016-11-02 05:26:28 +08:00
|
|
|
# CHECK-NEXT: Name: f2@v2
|
2016-04-28 04:22:31 +08:00
|
|
|
# CHECK-NEXT: Value: 0x0
|
|
|
|
# CHECK-NEXT: Size: 0
|
|
|
|
# CHECK-NEXT: Binding: Global (0x1)
|
|
|
|
# CHECK-NEXT: Type: None (0x0)
|
|
|
|
# CHECK-NEXT: Other: 0
|
|
|
|
# CHECK-NEXT: Section: Undefined (0x0)
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Symbol {
|
2016-11-02 05:26:28 +08:00
|
|
|
# CHECK-NEXT: Name: g1@v1
|
2016-04-28 04:22:31 +08:00
|
|
|
# CHECK-NEXT: Value: 0x0
|
|
|
|
# CHECK-NEXT: Size: 0
|
|
|
|
# CHECK-NEXT: Binding: Global (0x1)
|
|
|
|
# CHECK-NEXT: Type: None (0x0)
|
|
|
|
# CHECK-NEXT: Other: 0
|
|
|
|
# CHECK-NEXT: Section: Undefined (0x0)
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
|
2019-10-17 18:23:59 +08:00
|
|
|
# CHECK: VersionSymbols [
|
2019-10-11 20:27:20 +08:00
|
|
|
# CHECK-NEXT: Symbol {
|
|
|
|
# CHECK-NEXT: Version: 0
|
|
|
|
# CHECK-NEXT: Name:
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Symbol {
|
|
|
|
# CHECK-NEXT: Version: 2
|
|
|
|
# CHECK-NEXT: Name: f1@v3
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Symbol {
|
|
|
|
# CHECK-NEXT: Version: 3
|
|
|
|
# CHECK-NEXT: Name: f2@v2
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Symbol {
|
|
|
|
# CHECK-NEXT: Version: 4
|
|
|
|
# CHECK-NEXT: Name: g1@v1
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: ]
|
2019-10-17 18:23:59 +08:00
|
|
|
# CHECK-NEXT: VersionDefinitions [
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: VersionRequirements [
|
2016-06-08 14:54:23 +08:00
|
|
|
# CHECK-NEXT: Dependency {
|
|
|
|
# CHECK-NEXT: Version: 1
|
|
|
|
# CHECK-NEXT: Count: 2
|
|
|
|
# CHECK-NEXT: FileName: verneed1.so.0
|
2019-04-10 20:47:21 +08:00
|
|
|
# CHECK-NEXT: Entries [
|
|
|
|
# CHECK-NEXT: Entry {
|
|
|
|
# CHECK-NEXT: Hash: 1938
|
2019-11-18 22:43:50 +08:00
|
|
|
# CHECK-NEXT: Flags [ (0x0)
|
|
|
|
# CHECK-NEXT: ]
|
2019-04-10 20:47:21 +08:00
|
|
|
# CHECK-NEXT: Index: 3
|
|
|
|
# CHECK-NEXT: Name: v2
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Entry {
|
|
|
|
# CHECK-NEXT: Hash: 1939
|
2019-11-18 22:43:50 +08:00
|
|
|
# CHECK-NEXT: Flags [ (0x0)
|
|
|
|
# CHECK-NEXT: ]
|
2019-04-10 20:47:21 +08:00
|
|
|
# CHECK-NEXT: Index: 2
|
|
|
|
# CHECK-NEXT: Name: v3
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: ]
|
2016-06-08 14:54:23 +08:00
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Dependency {
|
|
|
|
# CHECK-NEXT: Version: 1
|
|
|
|
# CHECK-NEXT: Count: 1
|
|
|
|
# CHECK-NEXT: FileName: verneed2.so.0
|
2019-04-10 20:47:21 +08:00
|
|
|
# CHECK-NEXT: Entries [
|
|
|
|
# CHECK-NEXT: Entry {
|
|
|
|
# CHECK-NEXT: Hash: 1937
|
2019-11-18 22:43:50 +08:00
|
|
|
# CHECK-NEXT: Flags [ (0x0)
|
|
|
|
# CHECK-NEXT: ]
|
2019-04-10 20:47:21 +08:00
|
|
|
# CHECK-NEXT: Index: 4
|
|
|
|
# CHECK-NEXT: Name: v1
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: ]
|
2016-06-08 14:54:23 +08:00
|
|
|
# CHECK-NEXT: }
|
2019-10-17 18:23:59 +08:00
|
|
|
# CHECK-NEXT: ]
|
2016-04-28 04:22:31 +08:00
|
|
|
|
|
|
|
.globl _start
|
|
|
|
_start:
|
2016-04-30 08:49:10 +08:00
|
|
|
call f1@plt
|
|
|
|
call f2@plt
|
|
|
|
call g1@plt
|