diff --git a/elf/arch-i386.cc b/elf/arch-i386.cc index 5f12419a8c..84e73c398e 100644 --- a/elf/arch-i386.cc +++ b/elf/arch-i386.cc @@ -425,8 +425,8 @@ void InputSection::scan_relocations(Context &ctx) { case R_386_PLT32: { Action table[][4] = { // Absolute Local Imported data Imported code - { ERROR, NONE, PLT, PLT }, // DSO - { ERROR, NONE, PLT, PLT }, // PIE + { NONE, NONE, PLT, PLT }, // DSO + { NONE, NONE, PLT, PLT }, // PIE { NONE, NONE, PLT, PLT }, // PDE }; dispatch(ctx, table, i, rel, sym); diff --git a/elf/arch-x86-64.cc b/elf/arch-x86-64.cc index 0a142f888b..e7e5118dad 100644 --- a/elf/arch-x86-64.cc +++ b/elf/arch-x86-64.cc @@ -668,8 +668,8 @@ void InputSection::scan_relocations(Context &ctx) { case R_X86_64_PLTOFF64: { Action table[][4] = { // Absolute Local Imported data Imported code - { ERROR, NONE, PLT, PLT }, // DSO - { ERROR, NONE, PLT, PLT }, // PIE + { NONE, NONE, PLT, PLT }, // DSO + { NONE, NONE, PLT, PLT }, // PIE { NONE, NONE, PLT, PLT }, // PDE }; dispatch(ctx, table, i, rel, sym); diff --git a/test/elf/reloc-abs-error.sh b/test/elf/reloc-abs-error.sh deleted file mode 100755 index cf6185ccff..0000000000 --- a/test/elf/reloc-abs-error.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -export LANG= -set -e -CC="${CC:-cc}" -CXX="${CXX:-c++}" -testname=$(basename "$0" .sh) -echo -n "Testing $testname ... " -cd "$(dirname "$0")"/../.. -mold="$(pwd)/mold" -t=out/test/elf/$testname -mkdir -p $t - -cat <& $t/log -grep -q 'recompile with -fno-PIC' $t/log - -echo OK diff --git a/test/elf/weak-undef.sh b/test/elf/weak-undef.sh new file mode 100755 index 0000000000..b55a9a9ed1 --- /dev/null +++ b/test/elf/weak-undef.sh @@ -0,0 +1,43 @@ +#!/bin/bash +export LANG= +set -e +CC="${CC:-cc}" +CXX="${CXX:-c++}" +testname=$(basename "$0" .sh) +echo -n "Testing $testname ... " +cd "$(dirname "$0")"/../.. +mold="$(pwd)/mold" +t=out/test/elf/$testname +mkdir -p $t + +cat < +__attribute__((weak)) int foo(); +int main() { + printf("%d\n", foo ? foo() : -1); +} +EOF + +cat < +__attribute__((weak)) int foo(); +int main() { + printf("%d\n", foo ? foo() : -1); +} +EOF + +cat <