Package: gcc-aarch64-linux-gnu Version: 4:7.2.0-1d1 Severity: important Dear Maintainer,
I have a bug with some relocation symbols with the current version of gcc-aarch64-linux-gnu (gcc6 was fine). FYI, the gcc-linaro-7.2.1-2017.11 toolchain does not have this issue. Thank you! Test case: ``` test.c struct ld_symbol; extern struct ld_symbol _test_start, _test_end; unsigned long long test(void) { unsigned long long test_start = (unsigned long long)&_test_start; unsigned long long test_end = (unsigned long long)&_test_end; return test_end - test_start; } ``` ``` script.ld OUTPUT_ARCH(aarch64) OUTPUT_FORMAT(elf64-littleaarch64) SECTIONS { _test_start = .; .text : { *(.text) } _test_end = .; . += 0xFFFF0000; } ``` Compile with: ``` aarch64-linux-gnu-gcc -O1 -c test.c -o test.o aarch64-linux-gnu-objdump -ld test.o aarch64-linux-gnu-ld -o test.elf -nostdlib --script script.ld --entry test test.o aarch64-linux-gnu-objdump -ld test.elf ``` Bad (current): ``` test.o: test(): 0: 90000001 adrp x1, 0 <_test_end> 4: f9400021 ldr x1, [x1] 8: 90000000 adrp x0, 0 <_test_start> c: f9400000 ldr x0, [x0] 10: cb000020 sub x0, x1, x0 14: d65f03c0 ret test.elf: test(): 0: 907fff81 adrp x1, ffff0000 <_test_end+0xfffeffe8> 4: f9401421 ldr x1, [x1, #40] 8: 907fff80 adrp x0, ffff0000 <_test_end+0xfffeffe8> c: f9401000 ldr x0, [x0, #32] 10: cb000020 sub x0, x1, x0 14: d65f03c0 ret ``` Good: ``` test(): 0: 90000001 adrp x1, 0 <_test_end> 4: 91000021 add x1, x1, #0x0 8: 90000000 adrp x0, 0 <_test_start> c: 91000000 add x0, x0, #0x0 10: cb000020 sub x0, x1, x0 14: d65f03c0 ret ``` -- System Information: Debian Release: buster/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)$ Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages gcc-aarch64-linux-gnu depends on: ii cpp-aarch64-linux-gnu 4:7.2.0-1d1 ii gcc-7-aarch64-linux-gnu 7.2.0-11cross1 Versions of packages gcc-aarch64-linux-gnu recommends: ii libc6-dev-arm64-cross [libc-dev-arm64-cross] 2.25-3cross1 Versions of packages gcc-aarch64-linux-gnu suggests: ii autoconf 2.69-11 ii automake 1:1.15.1-3 pn bison <none> pn flex <none> pn gcc-doc <none> pn gdb-aarch64-linux-gnu <none> ii libtool 2.4.6-2 ii make 4.1-9.1 ii manpages-dev 4.14-1 -- no debconf information