[aarch64] wrong symbol address
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-defaults (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
gcc-aarch64-
I have a bug with relocation symbols in this version.
It seems to be fixed in gcc version 7.2.1 (tested with gcc-linaro-
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_
OUTPUT_
SECTIONS
{
_test_start = .;
.text :
{
*(.text)
}
_test_end = .;
. += 0xFFFF0000;
}
```
Compile with:
```
aarch64-
aarch64-
aarch64-
aarch64-
```
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_
4: f9401421 ldr x1, [x1, #40]
8: 907fff80 adrp x0, ffff0000 <_test_
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
```
tags: | added: bionic |
bionic was updated to 7.5.0