u-boot-brain/arch
Michal Simek e14ba8a577 arch: Add explicit linker script for u-boot-elf
Commit f4dc714aaa ("arm64: Turn u-boot.bin back into an ELF file after
relocate-rela")
introduce REMAKE_ELF option to recreate u-boot.elf from u-boot ->
u-boot.bin + DT -> u-boot.elf.

The best is to ilustrate it from make V=1 output
  cat u-boot-nodtb.bin dts/dt.dtb > u-boot-dtb.bin
  cp u-boot-dtb.bin u-boot.bin
aarch64-linux-gnu-objcopy -I binary -B aarch64 -O elf64-littleaarch64  u-boot.bin u-boot-elf.o
  aarch64-linux-gnu-ld.bfd u-boot-elf.o -o u-boot.elf --defsym="_start"=0x8000000 -Ttext=0x8000000

Last command has no explicit linker script passed that's why toolchain
internal linker script is used.
In Binutils 2.32 case it contains SIZEOF_HEADERS symbol which has changed
behavior by commit
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=64029e93683a266c38d19789e780f3748bd6a188
which result in situation that program headers has changed from
(xilinx_zynqmp_mini_defconfig)

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000010000 0x00000000fffc0000 0x00000000fffc0000
                 0x0000000000018918 0x0000000000018918  RW     0x10000

to

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x00000000fffb0000 0x00000000fffb0000
                 0x0000000000028918 0x0000000000028918  RW     0x10000

Xilinx tools like XSDB or Bootgen are using program headers for loading ELF
to the right location and by above binutils change ELF is loaded to
incorrect location.

The patch is explicitly use u-boot-elf.lds (just cat now) for u-boot.elf
recreation which is called when REMAKE_ELF is setup.
By purpose u-boot-elf.lds doesn't contain OUTPUT_FORMAT/OUTPUT_ARCH to be
able to use by all archs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-By: Álvaro Fernández Rojas <noltari@gmail.com>
2020-04-03 11:52:55 -04:00
..
arc ARC: IO: add MB for __raw_* memory accessors 2020-03-31 18:31:53 +03:00
arm mach-snapdragon: Fix overwriting last digit of serial number 2020-04-03 11:47:47 -04:00
m68k dma-mapping: add <asm/dma-mapping.h> for all architectures 2020-02-20 15:09:54 +08:00
microblaze dma-mapping: add <asm/dma-mapping.h> for all architectures 2020-02-20 15:09:54 +08:00
mips arch: Add explicit linker script for u-boot-elf 2020-04-03 11:52:55 -04:00
nds32 dma-mapping: move dma_map_(un)single() to <linux/dma-mapping.h> 2020-02-19 21:27:30 +08:00
nios2 common: Move hang() to the same header as panic() 2020-01-24 23:06:49 +05:30
powerpc gazerbeam: add clocks property to SPI node 2020-03-31 10:06:52 -04:00
riscv riscv: Implement new SBI v0.2 extensions 2020-03-17 11:29:54 +08:00
sandbox dma-mapping: add <asm/dma-mapping.h> for all architectures 2020-02-20 15:09:54 +08:00
sh dma-mapping: add <asm/dma-mapping.h> for all architectures 2020-02-20 15:09:54 +08:00
x86 x86: apl: Use cpu_x86_get_count() for cpu_ops.get_count 2020-03-05 18:25:22 +08:00
xtensa dma-mapping: add <asm/dma-mapping.h> for all architectures 2020-02-20 15:09:54 +08:00
.gitignore
Kconfig x86: Enable pinctrl in SPL and TPL 2019-12-15 11:44:24 +08:00
u-boot-elf.lds arch: Add explicit linker script for u-boot-elf 2020-04-03 11:52:55 -04:00