CC u-boot mailing list to make people aware of the discussion. By the way, I also noticed that, the final linking command is using: '''-pie -Bstatic --no-dynamic-linker''' And there are self-relocating code in Start.S.
BUT it is not included when u-boot is not configured using "POSITION_INDEPENDENT" Which means, PIE feature cannot be used at load time. I am not sure about the code design and use cases, but '''LDFLAGS_u-boot += -pie''' may need to be guarded with '''CONFIG_POSITION_INDEPENDENT''' as well? Otherwise what is the purpose of pie without processing the dynamic relocations? I tried to do that, and with some fixes in other places to change the checks for relocations, it could generate a binary without any relocations. Though, I am NOT sure about the CORRECTNESS of the binary. In the original code, R_AARCH64_ABS32 relocation is used to resolve an address at static linking time. It seems works fine originally (which doesn't mean it is not bugous). I assume it is because, no one is trying to use pie feature really. If people is using pie feature to load the binary in a different address, proper relocations are required, as well as the self-relocating code. The linker won't generate a dynamic RELATIVE relocation for _AARCH64_ABS32. SO the address in the table won't be updated by the fixup code. However, bfd linker will generate a dynamic RELATIVE relocation for R_AARCH64_ABS64 relocation, and it could be processed by self-relocating code, taking the load address into account. Regards, Renlin On Tue, Oct 2, 2018 at 11:45 AM Renlin Li <renlin....@gmail.com> wrote: > Hi Meng, > > Thanks for raising the issue! > I could reproduce the issue with the information you gave. > > It seems to me that, the change I made earlier catches an issue here. > in /arch/arm/cpu/armv8/psci.S > > */* PSCI function and ID table definition*/* > *#define PSCI_TABLE(__id, __fn) \* > * .word __id; \* > * .word __fn* > > "*.word*" is used to hold the address of a function. > > The toolchain you used is aarch64-linux, which by default supports LP64 > ABI. > This means Long and void * (pointer) data type is 64-bit. > > IIUC, a "*.xword*" should be used instead. Otherwise, you should use > ILP32 ABI. But be aware, the support for ILP32 might not be complete. > > Regards, > Renlin > > > >> >> Hi All, >> Could you please help to have a look whether below issue is valuable? >> I got u-boot source code from https://github.com/u-boot/u-boot.git, >> branch = >> is master. >> I got toolchain from >> https://mirrors.edge.kernel.org/pub/tools/crosstool/fi= >> les/bin/x86_64/8.1.0/ >> I built stratix10(socfpga) platform with below commands: >> export >> CROSS_COMPILE=3Dxxx/gcc-8.1.0-nolibc/aarch64-linux/bin/aarch64-linux= >> - >> export ARCH=3Darm64 >> make mrproper >> make socfpga_stratix10_defconfig >> make menuconfig, and then enable CONFIG_ARMV8_PSCI >> make >> there will be below error: >> LD u-boot >> >> /home/wrsadmin/Project/Native/SDK/Altera-Arria-10/gcc-8.1.0-nolibc/aarch64-= >> linux/bin/aarch64-linux-ld.bfd: arch/arm/cpu/armv8/built-in.o: relocation >> R= >> _AARCH64_ABS32 against `psci_cpu_suspend' can not be used when making a >> sha= >> red object > > _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot