mirror of
https://github.com/rui314/mold.git
synced 2024-12-24 00:43:18 +03:00
wip
This commit is contained in:
parent
a1d8b56c04
commit
f56215aae1
@ -458,17 +458,6 @@ void InputSection::apply_reloc_nonalloc(u8 *base) {
|
||||
write_val(rel.r_type, loc, val);
|
||||
};
|
||||
|
||||
// Debug info section may have relocations pointing to
|
||||
// non-alloc sections. Such relocations are not valid.
|
||||
// We treat them as if they were pointing to address 0.
|
||||
bool is_valid = (!sym.input_section ||
|
||||
(sym.input_section->shdr.sh_flags & SHF_ALLOC));
|
||||
|
||||
if (!is_valid) {
|
||||
write(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (rel.r_type) {
|
||||
case R_X86_64_NONE:
|
||||
break;
|
||||
|
@ -174,4 +174,28 @@ clang -c -o $t/e.o $t/e.c -mcmodel=large -fPIC
|
||||
clang -fuse-ld=`pwd`/../mold -o $t/exe $t/c.so $t/e.o
|
||||
$t/exe | grep -q 56
|
||||
|
||||
# R_X86_64_32 against non-alloc section
|
||||
cat <<'EOF' > $t/f.s
|
||||
.globl main
|
||||
main:
|
||||
ret
|
||||
|
||||
.section .foo, "", @progbits
|
||||
.zero 16
|
||||
foo:
|
||||
.quad bar
|
||||
|
||||
.section .bar, "", @progbits
|
||||
.zero 24
|
||||
bar:
|
||||
.quad foo
|
||||
EOF
|
||||
|
||||
clang -c -o $t/f.o $t/f.s
|
||||
clang -fuse-ld=`pwd`/../mold -o $t/exe $t/f.o
|
||||
readelf -x .foo -x .bar $t/exe > $t/log
|
||||
|
||||
fgrep -q '0x00000010 00000000 00000000 10000000 00000000' $t/log
|
||||
fgrep -q '0x00000010 18000000 00000000' $t/log
|
||||
|
||||
echo OK
|
||||
|
Loading…
Reference in New Issue
Block a user