[aarch64] wrong symbol address

Bug #1739392 reported by goto
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-defaults (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

gcc-aarch64-linux-gnu package in bionic has gcc version 7.2.0.

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-7.2.1-2017.11 toolchain). Could you please update the package?

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
```

Tags: bionic
tags: added: bionic
Revision history for this message
Matthias Klose (doko) wrote :

bionic was updated to 7.5.0

Changed in gcc-defaults (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.