[PATCH] x86: Fix linking u-boot with ld.lld
Simon Glass
sjg at chromium.org
Sun Oct 31 13:57:13 CET 2021
On Wed, 20 Oct 2021 at 15:31, Alistair Delva <adelva at google.com> wrote:
>
> When linking the final u-boot binary with LLD, the following link errors
> are seen:
>
> ld.lld: error: can't create dynamic relocation R_386_32 against local
> symbol in readonly segment; recompile object files with
> -fPIC or pass '-Wl,-z,notext' to allow text relocations
> in the output
> >>> defined in arch/x86/cpu/start.o
> >>> referenced by arch/x86/cpu/start.o:(.text.start+0x32)
> [...]
> >>> defined in arch/x86/cpu/start16.o
> >>> referenced by arch/x86/cpu/start16.o:(.start16+0x1C)
>
> According to Nick Desaulniers:
>
> "This is a known difference between GNU and LLVM linkers; the GNU
> linkers permit relocations in readonly segments (making them not read
> only), LLVM does not (by default)."
>
> Since U-Boot apparently seems to use relocations in readonly segments,
> change the global linker flags to permit them when linking with LLD by
> specifying '-z notext'.
>
> Signed-off-by: Alistair Delva <adelva at google.com>
> Cc: Nick Desaulniers <ndesaulniers at google.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Bin Meng <bmeng.cn at gmail.com>
> ---
> Makefile | 3 +++
> 1 file changed, 3 insertions(+)
Reviewed-by: Simon Glass <sjg at chromium.org>
>
Applied to u-boot-dm, thanks!
More information about the U-Boot
mailing list