1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-04 08:37:28 +03:00

Attempt to fix CI

This commit is contained in:
Rui Ueyama 2022-04-01 13:31:35 +08:00
parent 9eb4e76daf
commit 0ecd72900e
2 changed files with 10 additions and 12 deletions

View File

@ -291,17 +291,15 @@ template <typename E>
static i64 parse_number(Context<E> &ctx, std::string opt,
std::string_view value) {
size_t nread;
i64 ret = std::stol(std::string(value), &nread, 0);
if (value.size() != nread)
Fatal(ctx) << "option -" << opt << ": not a number: " << value;
return ret;
}
template <typename E>
static u64 parse_unsigned_number(Context<E> &ctx, std::string opt,
std::string_view value) {
size_t nread;
u64 ret = std::stoul(std::string(value), &nread, 0);
if (value.starts_with('-')) {
i64 ret = std::stoul(std::string(value.substr(1)), &nread, 0);
if (value.size() - 1 != nread)
Fatal(ctx) << "option -" << opt << ": not a number: " << value;
return -ret;
}
i64 ret = std::stoul(std::string(value), &nread, 0);
if (value.size() != nread)
Fatal(ctx) << "option -" << opt << ": not a number: " << value;
return ret;
@ -776,7 +774,7 @@ void parse_nonpositional_args(Context<E> &ctx,
} else if (read_flag(args, "no-icf")) {
ctx.arg.icf = false;
} else if (read_arg(ctx, args, arg, "image-base")) {
ctx.arg.image_base = parse_unsigned_number(ctx, "image-base", arg);
ctx.arg.image_base = parse_number(ctx, "image-base", arg);
} else if (read_flag(args, "print-icf-sections")) {
ctx.arg.print_icf_sections = true;
} else if (read_flag(args, "no-print-icf-sections")) {

View File

@ -29,7 +29,7 @@ cat <<EOF | $CC -o $t/b.o -c -xc -
void _start() {}
EOF
$CC -B. -o $t/exe2 $t/b.o -nostdlib -Wl,--image-base=0xffffffff80000000
$CC -B. -no-pie -o $t/exe2 $t/b.o -nostdlib -Wl,--image-base=0xffffffff80000000
readelf -W --sections $t/exe2 | grep -Eq '.interp\s+PROGBITS\s+ffffffff80000...\b'
echo OK