https://sourceware.org/bugzilla/show_bug.cgi?id=31228
Bug ID: 31228 Summary: ld (aarch64): undefined reference to `no symbol' for adrp with constant value Product: binutils Version: 2.39 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: petemoore at gmx dot net Target Milestone: --- Consider the following assembly: ``` $ cat adrp.s .global _start _start: adrp x0, 0x8000 ``` After assembling and linking: ``` $ aarch64-none-elf-as -o adrp.o adrp.s $ aarch64-none-elf-ld -Ttext=0x0 -o adrp.elf adrp.o aarch64-none-elf-ld: adrp.o: in function `_start': (.text+0x0): undefined reference to `no symbol' ``` Note, the following trick works (if e.g. _start is known to be 0): ``` $ cat adrp.s .global _start _start: adrp x0, 0x8000 + _start ``` which assembles as desired: ``` $ aarch64-none-elf-objdump -d adrp.elf adrp.elf: file format elf64-littleaarch64 Disassembly of section .text: 0000000000000000 <_start>: 0: 90000040 adrp x0, 8000 <_start+0x8000> ``` However, this only works if _start is fixed and known. Being able to specify an absolute (rather than relative) value for the immediate of the adrp instruction is useful for e.g. referencing peripherals at fixed locations which are known to be in the +/- 4GB range of the current address. My particular use case is referencing Raspberry Pi peripheral base addresses when the MMU is not enabled. Originally reported in bug 27217 comment 30. ``` $ aarch64-none-elf-ld --version GNU ld (GNU Binutils) 2.39 ``` -- You are receiving this mail because: You are on the CC list for the bug.