1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-24 17:01:50 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-20 10:09:40 +09:00
parent 2c8e66a483
commit a5bf19ee06
3 changed files with 17 additions and 2 deletions

View File

@ -286,6 +286,19 @@ static std::vector<u64> create_dynamic_section() {
define(DT_INIT_ARRAYSZ, out::__init_array_end->value - out::__init_array_start->value);
define(DT_FINI_ARRAY, out::__fini_array_start->value);
define(DT_FINI_ARRAYSZ, out::__fini_array_end->value - out::__fini_array_start->value);
auto find = [](StringRef name) -> OutputChunk * {
for (OutputChunk *chunk : out::chunks)
if (chunk->name == name)
return chunk;
return nullptr;
};
if (OutputChunk *chunk = find(".init"))
define(DT_INIT, chunk->shdr.sh_addr);
if (OutputChunk *chunk = find(".fini"))
define(DT_FINI, chunk->shdr.sh_addr);
define(DT_NULL, 0);
return vec;
}

View File

@ -11,7 +11,7 @@
// RUN: /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
// RUN: readelf --dynamic %t.exe | FileCheck %s
// CHECK: Dynamic section at offset 0x2080 contains 20 entries:
// CHECK: Dynamic section at offset 0x2080 contains 22 entries:
// CHECK: Tag Type Name/Value
// CHECK: 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
// CHECK: 0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
@ -32,6 +32,8 @@
// CHECK: 0x000000000000001b (INIT_ARRAYSZ) 8 (bytes)
// CHECK: 0x000000000000001a (FINI_ARRAY) 0x202020
// CHECK: 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
// CHECK: 0x000000000000000c (INIT) 0x201010
// CHECK: 0x000000000000000d (FINI) 0x201000
// CHECK: 0x0000000000000000 (NULL) 0x0
// RUN: readelf --symbols --use-dynamic %t.exe | FileCheck --check-prefix=DYNAMIC %s

View File

@ -15,7 +15,7 @@
// SECTIONS: [19] .got.plt PROGBITS 0000000000202058 00002058
// SECTIONS: 0000000000000028 0000000000000000 WA 0 0 8
// SECTIONS: [20] .dynamic DYNAMIC 0000000000202080 00002080
// SECTIONS: 0000000000000140 0000000000000010 WA 9 0 8
// SECTIONS: 0000000000000160 0000000000000010 WA 9 0 8
// RUN: readelf -x .got.plt %t.exe | FileCheck --check-prefix=GOTPLT %s
// GOTPLT: 0x00202058 80202000 00000000 00000000 00000000