1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-11 13:06:59 +03:00

Handle -undefined as a synonym for --undefined instead of -u ndefined

Fixes https://github.com/rui314/mold/discussions/1059
This commit is contained in:
Rui Ueyama 2023-07-18 16:59:12 +09:00
parent a8eb52f61a
commit 2d25a93126
2 changed files with 28 additions and 1 deletions

View File

@ -662,7 +662,7 @@ std::vector<std::string> parse_nonpositional_args(Context<E> &ctx) {
ctx.arg.unresolved_symbols = UNRESOLVED_IGNORE;
else
Fatal(ctx) << "unknown --unresolved-symbols argument: " << arg;
} else if (read_arg("u") || read_arg("undefined")) {
} else if (read_arg("undefined") || read_arg("u")) {
ctx.arg.undefined.push_back(arg);
} else if (read_arg("require-defined")) {
ctx.arg.require_defined.push_back(arg);

27
test/elf/undefined2.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
. $(dirname $0)/common.inc
test_cflags -static || skip
cat <<EOF | $CC -o $t/a.o -c -x assembler -
.globl _start
_start:
EOF
cat <<EOF | $CC -o $t/b.o -c -x assembler -
.globl ndefined
ndefined:
EOF
cat <<EOF | $CC -o $t/c.o -c -x assembler -
.globl foo
foo:
EOF
rm -f $t/d.a
ar cr $t/d.a $t/b.o $t/c.o
./mold -static -o $t/exe $t/a.o $t/d.a -undefined foo
readelf --symbols $t/exe > $t/log
grep -q foo $t/log
! grep -q ndefined $t/log || false