03 Apr, 2020

1 commit

  • Commit f4dc714aaa2d ("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
    Reviewed-by: Tom Rini
    Reviewed-by: Daniel Schwierzeck
    Tested-By: Álvaro Fernández Rojas

    Michal Simek
     

18 Nov, 2018

1 commit

  • Use the global MIPS specific u-boot.lds for linking standalone programs
    instead of the outdated ones in examples/standalone/. Also pass --gc-sections
    in LDFLAGS_STANDALONE to optimize the size of standalone programs.
    Finally remove the deprecated config.mk files in arch/mips/cpu/mips[32,64]/.

    Signed-off-by: Daniel Schwierzeck

    Daniel Schwierzeck
     

03 Nov, 2018

1 commit

  • Currently the size of the relocation table will be shrunk
    to the actual size needed. Although this gives a maximal
    space saving, it messes up the _end symbol. This breaks
    features like appended DTBs because the _end symbol doesn't
    point to the real end of the U-Boot binary.

    Remove the size shrinking and make the size of the relocation
    table fixed but configurable. This follows the Linux approach
    and the user can adjust the size to his needs.

    Also rename the relocation table section from .rel to .data.reloc
    to follow the Linux approach and to avoid ambiguities with the
    .rel.* sections added by the linker.

    Reported-by: Lars Povlsen
    Signed-off-by: Daniel Schwierzeck

    Daniel Schwierzeck
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

26 Jul, 2017

1 commit

  • U-Boot has up until now built with -fpic for the MIPS architecture,
    producing position independent code which uses indirection through a
    global offset table, making relocation fairly straightforward as it
    simply involves patching up GOT entries.

    Using -fpic does however have some downsides. The biggest of these is
    that generated code is bloated in various ways. For example, function
    calls are indirected through the GOT & the t9 register:

    8f998064 lw t9,-32668(gp)
    0320f809 jalr t9

    Without -fpic the call is simply:

    0f803f01 jal be00fc04

    This is more compact & faster (due to the lack of the load & the
    dependency the jump has on its result). It is also easier to read &
    debug because the disassembly shows what function is being called,
    rather than just an offset from gp which would then have to be looked up
    in the ELF to discover the target function.

    Another disadvantage of -fpic is that each function begins with a
    sequence to calculate the value of the gp register, for example:

    3c1c0004 lui gp,0x4
    279c3384 addiu gp,gp,13188
    0399e021 addu gp,gp,t9

    Without using -fpic this sequence no longer appears at the start of each
    function, reducing code size considerably.

    This patch switches U-Boot from building with -fpic to building with
    -fno-pic, in order to gain the benefits described above. The cost of
    this is an extra step during the build process to extract relocation
    data from the ELF & write it into a new .rel section in a compact
    format, plus the added complexity of dealing with multiple types of
    relocation rather than the single type that applied to the GOT. The
    benefit is smaller, cleaner, more debuggable code. The relocate_code()
    function is reimplemented in C to handle the new relocation scheme,
    which also makes it easier to read & debug.

    Taking maltael_defconfig as an example the size of u-boot.bin built
    using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
    2.24.90) shrinks from 254KiB to 224KiB.

    Signed-off-by: Paul Burton
    Cc: Daniel Schwierzeck
    Cc: u-boot@lists.denx.de
    Reviewed-by: Daniel Schwierzeck
    Tested-by: Daniel Schwierzeck

    Paul Burton
     

10 May, 2017

1 commit


31 May, 2016

1 commit

  • Provide a default linker script for SPL binaries. Start address
    and size of text section and BSS section are configurable. All
    sections are arranged in a way that only relevant sections are
    kept in the code section for maximum size reduction. All other
    sections are kept but moved outside the code section to help
    with debugging.

    Signed-off-by: Daniel Schwierzeck
    Acked-by: Marek Vasut

    Daniel Schwierzeck
     

17 Jan, 2016

3 commits


28 Mar, 2015

1 commit


02 Nov, 2014

2 commits

  • Commit 79fd7e649e287228a1445820a72f7dd33baedb96

    MIPS: always keep all sections in u-boot ELF binary.

    Always keep all sections in u-boot ELF binary. Move all unneeded
    sections after _end to avoid allocating space in the final binary.
    Also remove .deadcode section which is now obsolete.

    removed section .deadcode because the original symptoms were not
    visible anymore. Unfortuneatly the binutils bug still exists.

    The size of .rel.dyn section is often bigger than needed for all
    entries. But objcopy only allocates space as much as required for all
    reloc entries. Thus there is a gap between the last entry and
    __rel_dyn_end in u-boot.bin. If u-boot is booted from RAM (e.g. in
    SPL scenarios) that area could contain garbage data which could lead
    to CPU exceptions during relocation.

    Signed-off-by: Gabor Juhos
    Signed-off-by: Daniel Schwierzeck

    Daniel Schwierzeck
     
  • Refactor and unify all compiler settings in arch/mips/config.mk.
    Also add tune flags for each supported CPU type.

    Signed-off-by: Daniel Schwierzeck

    Daniel Schwierzeck
     

31 Jul, 2014

1 commit


20 Apr, 2014

2 commits


05 Mar, 2014

1 commit


26 Feb, 2014

1 commit


24 Jul, 2013

1 commit


13 Feb, 2013

1 commit

  • The code handles relocation entries with the
    following relocation types only:
    mips32: R_MIPS_REL32
    mips64: R_MIPS_REL+R_MIPS_64
    xburst: R_MIPS_REL32

    Other relocation entries are skipped without
    processing. The code must be extended if other
    relocation types must be supported.

    Add -pie to LDFLAGS_FINAL to generate the .rel.dyn
    fixup table, which will be applied to the relocated
    image before transferring control to it.

    The CONFIG_NEEDS_MANUAL_RELOC is not needed
    after the patch, so remove that as well.

    Signed-off-by: Gabor Juhos
    Signed-off-by: Daniel Schwierzeck

    Gabor Juhos
     

24 Aug, 2012

2 commits


09 May, 2011

1 commit

  • All architectures but MIPS are using --gc-sections on final linking.
    This patch introduces that feature for MIPS to reduce the memory and
    flash footprint.

    Signed-off-by: Daniel Schwierzeck
    Cc: Wolfgang Denk
    Cc: Stefan Roese
    Cc: Thomas Lange
    Cc: Vlad Lungu
    Signed-off-by: Shinya Kuribayashi

    Daniel Schwierzeck
     

13 Apr, 2011

1 commit

  • Rename STANDALONE_LOAD_ADDR into CONFIG_STANDALONE_LOAD_ADDR
    and allow that the architecture-specific default value gets
    overwritten by defining the value in the board header file.

    Signed-off-by: Wolfgang Denk
    Cc: Mike Frysinger
    Cc: Shinya Kuribayashi
    Cc: Daniel Hellstrom
    Cc: Tsi Chung Liew
    Cc: Nobuhiro Iwamatsu

    Wolfgang Denk
     

13 Apr, 2010

1 commit