Makefile: apply dynamic relocations for LLD

It seems that for aarch64, unless we apply dynamic relocations to the
location being relocated, we fail to boot.

As Fangrui notes:
  For dynamic relocations using the RELA format (readelf -Wr), GNU ld
  sets the initial content to r_addend; ld.lld doesn't do that by
  default (needs --apply-dynamic-relocs).

Otherwise .rodata appears to be full of NUL-bytes before relocation,
causing crashes when trying to invoke the function pointers in
init_sequence_f from initcall_run_list().

Test: BUILD_CONFIG=u-boot/build.config.qemu.aarch64 ./build/build.sh && \
  qemu-system-aarch64 -machine virt -bios \
  out/u-boot-mainline/dist/u-boot.bin -display none -serial mon:stdio \
  -nographic -cpu cortex-a53 -m 1024
Bug: 164420327
Bug: 203698882
Link: https://reviews.llvm.org/D42797
Suggested-by: Fangrui Song <maskray@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: I2e57381bd707acb9ca987a74eeb795b56ec0f4c0
1 file changed