1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-05 00:57:08 +03:00
mold/test/elf
Rui Ueyama 4348417dd8 [ELF] Do not convert .ctors/.dtors to .init_array/.fini_array
The .ctors section contains a list of pointers that have to be run
before `main`. It usually contains pointers to global constructors.
The .dtors are for global destructors.

The .init_array and .fini_array serve the same purpose as .ctors and
.dtors. The former sections are newer than the latter sections, and
most programs have already migrated to .{init,fini}_array.

.ctors/.dtors are very similar to .{init,fini}_array, but the order
in which pointers are executed is different. .ctors/.dtors are executed
from the end to the beginning, while .{init,fini}_array are executed
from the beginning to the end.

Previously, we converted .ctors/.dtors sections into .{init,fini}_array
sections. In order to do that, we not only merge .ctors/.dtors to
.{init,fini}_array but also reverse their section contents, so that
the initialization order remains the same.

However, there was a bug in that logic. We forgot to reverse the
locations of dynamic relocations for the converted sections.
So, .ctors/.dtors sections converted to .{init,fini}_array were executed
in a wrong order.

We have two choices to "fix" the issue: (1) reverse not only section
contents but also dynamic relocations, or (2) stop converting .ctors/.dtors.
In this patch, I chose (2).

Since LLVM lld doesn't convert .ctors/.dtors, it shouldn't cause an
issue for most programs.
2022-01-07 17:47:14 +09:00
..
aarch64-hello-static.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
allow-multiple-definition.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
ar-alignment.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
as-needed2.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
as-needed-weak.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
as-needed.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
auxiliary.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
basic.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
bno-symbolic.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
bsymbolic-functions.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
bsymbolic.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
bug178.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
build-id.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
canonical-plt.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
cmdline.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
color-diagnostics.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
comment.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
common-archive.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
common-ref.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
common.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
compress-debug-sections.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
compressed-debug-info.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
copyrel-protected.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
copyrel-relro.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
copyrel.sh [ELF] Fix tests so that they work if CC is clang 2022-01-07 12:45:20 +09:00
default-symver.sh [ELF] Add --default-symver 2022-01-03 20:29:33 +09:00
defsym.sh [ELF] Make --defsym'ed symbols absolute 2022-01-07 16:28:14 +09:00
demangle.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
discard.sh [ELF] Fix tests so that they work if CC is clang 2022-01-07 12:45:20 +09:00
dt-init.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
dt-needed.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
duplicate-error.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
dynamic-linker.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
dynamic-list2.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
dynamic-list.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
dynamic.sh [ELF] Do not place non-exported symbols into .gnu.hash 2022-01-06 17:47:19 +09:00
empty-file.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
empty-input.sh [ELF] Show a better error message for the empty input file 2022-01-02 19:33:07 +09:00
empty-version.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
emulation-deduction.sh [ELF] Deduce emulation from input files if -m is not given 2022-01-05 19:55:32 +09:00
entry.sh Fix test failures on aarch64 2022-01-05 12:26:56 +01:00
exception.sh [ELF] Support R_X86_64_PLTOFF64 2022-01-07 14:44:17 +09:00
exclude-libs2.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
exclude-libs3.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
exclude-libs.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
execstack.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
export-dynamic.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
export-from-exe.sh [ELF] Fix tests so that they work if CC is clang 2022-01-07 12:45:20 +09:00
fatal-warnings.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
filler.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
filter.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
func-addr.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
gc-sections.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
glibc-2.22-bug.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
gnu-hash.sh [ELF] Do not place non-exported symbols into .gnu.hash 2022-01-06 17:47:19 +09:00
gnu-warning.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
hello-dynamic.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
hello-static.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
help.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
i386-hello-dynamic.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
i386-hello-static.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
i386-mergeable-strings.sh Improve test 2021-12-31 00:13:07 +09:00
i386-shared.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
i386-tls-gd.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
i386-tls-ld.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
i386-tlsdesc.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
icf.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
ifunc-dso.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
ifunc-dynamic.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
ifunc-export.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
ifunc-static.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
image-base.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
incompatible-libs.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
init-array-priorities.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
init-array.sh Fix buildbots 2022-01-07 13:24:42 +09:00
initfirst.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
interpose.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
invalid-version-script.sh [ELF] Handle '[]' in glob patterns 2022-01-06 20:45:46 +09:00
link-order.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
linker-script2.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
linker-script3.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
linker-script4.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
linker-script.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
lto-gcc-fallback.sh [ELF] Attempt to fix buildbots 2022-01-04 20:59:33 +09:00
lto-llvm-fallback.sh [ELF] Attempt to fix buildbots 2022-01-04 20:59:33 +09:00
many-sections.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
mergeable-strings.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
missing-but-ok.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
missing-error.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
mold-wrapper2.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
mold-wrapper.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
no-quick-exit.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
nocopyreloc.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
note2.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
note-property.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
note.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
now.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
omagic.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
pie.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
plt-dso.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
plt.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
pltgot.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
preload.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
protected-dynsym.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
protected.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
push-pop-state.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
relax.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
reloc-overflow.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
reloc-rodata.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
reloc-zero.sh Fix test failures on aarch64 2022-01-05 12:26:56 +01:00
reloc.sh [ELF] Support R_X86_64_GOTOFF64 2022-01-02 11:14:33 +09:00
relocatable-archive.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
relocatable.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
relro.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
repro.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
require-defined.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
response-file.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
retain-symbols-file.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
rodata-name.sh [ELF] Fix tests so that they work if CC is clang 2022-01-07 12:45:20 +09:00
rpath.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
run.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
section-alignment.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
section-name.sh Fix buildbots 2022-01-07 13:24:42 +09:00
shared.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
soname.sh [ELF] Improve test 2022-01-03 20:15:04 +09:00
spare-dynamic-tags.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
start-lib.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
start-stop-symbol.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
static-archive.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
stdout.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
strip.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
symbol-version.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
symtab.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
synthetic-symbols.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
sysroot2.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
sysroot-linker-script.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
sysroot.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
thin-archive.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
thread-count.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tls-dso.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tls-gd2.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tls-gd.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tls-ie.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tls-large-tbss.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tls-ld.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tls-le.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tls-nopic.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tls-pic.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tlsdesc-import.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tlsdesc-static.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
tlsdesc.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
trace-symbol.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
trace.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
undefined.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
unique.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
unresolved-symbols.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
verbose.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
version-script2.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
version-script3.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
version-script4.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
version-script5.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
version-script6.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
version-script7.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
version-script8.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
version-script9.sh [ELF] Add a test 2022-01-06 18:27:31 +09:00
version-script10.sh [ELF] Handle '[]' in glob patterns 2022-01-06 20:45:46 +09:00
version-script.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
version.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
versioned-undef.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
warn-common.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
warn-unresolved-symbols.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
weak-export-dso.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
weak-export-exe.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
whole-archive.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
wrap.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
z-defs.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
z-max-page-size.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
z-nodefaultlib.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
z-nodump.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
z-origin.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
z-separate-code.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
z-text.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00
z-unknown.sh Remove redundant "../../" from test script paths 2021-12-30 11:11:27 +09:00