The linker assign incorrect addresses if the padding due to dot assignment is greater than UINT_MAX.
Reproducer:
#!/usr/bin/env bash
cat >1.c <<\EOF
int u = 1;
int v = 2;
int foo() { return 1; }
EOF
cat >script.t <<\EOF
SECTIONS {
.data 0x1000 : {
. = . + 0x400000000;
*(.data*)
}
}
EOF
LDs=(ld.eld)
SFs=(eld)
clang -o 1.o -target riscv64 1.c -c -fdata-sections -ffunction-sections
for i in "${!SFs[@]}"; do
${LDs[$i]} -o 1.${SFs[$i]}.out 1.o -T script.t -Map 1.${SFs[$i]}.map.txt
done
llvm-readelf -s 1.eld.out | grep 'OBJECT.*u'
Output
12: 0000000000001000 4 OBJECT GLOBAL DEFAULT 2 u
Expected output
12: 0000000400001000 4 OBJECT GLOBAL DEFAULT 2 u
The linker assign incorrect addresses if the padding due to dot assignment is greater than UINT_MAX.
Reproducer:
Output
12: 0000000000001000 4 OBJECT GLOBAL DEFAULT 2 u
Expected output
12: 0000000400001000 4 OBJECT GLOBAL DEFAULT 2 u