Skip to content

improve overflow diagnostics to show input file for destination symbol #755

@quic-seaswara

Description

@quic-seaswara
cat > jal.t << \!
baz = 0xffffffff81090494;
SECTIONS {
. = 0xffffffff812000a0;
foo : { *(.text) }
}
!

cat > jal1.t << \!
SECTIONS {
. = 0xffffffff81090494;
.baz : { *(.baz) }
. = 0xffffffff812000a0;
foo : { *(.text) }
}
!

cat > a.s << \!
.section .baz,"ax",@progbits
.global baz
baz:
nop
!

cat > b.s << \!
.section .text,"ax",@progbits
jal baz
!

clang -c -target riscv64 b.s a.s
ld.eld b.o -T jal.t
ld.eld a.o b.o -T jal1.t

eld emits

Error: b.o:(.text): relocation R_RISCV_JAL out of range: -1506316 is not in [-1048576, 1048575]; references 'baz'
Error: b.o:(.text): relocation R_RISCV_JAL out of range: -1506316 is not in [-1048576, 1048575]; references 'baz'

lld emits

ld.lld: error: b.o:(.text+0x0): relocation R_RISCV_JAL out of range: -1506316 is not in [-1048576, 1048575]; references 'baz'
>>> defined in jal.t:1

$ ld.lld a.o b.o -T jal1.t 
ld.lld: error: b.o:(.text+0x0): relocation R_RISCV_JAL out of range: -1506316 is not in [-1048576, 1048575]; references 'baz'
>>> defined in a.o

eld used to show the input file for the destination symbol and now it does not.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions