Skip to content
Snippets Groups Projects
Forked from Reform / reform-boundary-uboot
Source project has a limited visibility.
  • Alexey Brodkin's avatar
    1022807c
    Makefile: Don't mess with .text section location for selected arches · 1022807c
    Alexey Brodkin authored
    Most of architectures have .text section situated in the very beginning
    of U-Boot binary and thus it is very logical that CONFIG_SYS_TEXT_BASE
    is used on final linkage step to specify where U-Boot gets linked to.
    
    For that we pass the following construction to the LD:
    ---------------------------->8-----------------------
    xxx-ld ...  -Ttext $(CONFIG_SYS_TEXT_BASE) ...
    ---------------------------->8-----------------------
    
    But there could be exceptions. For example:
     1. In case of ARCv2 we want to put vectors table in its own section
        .ivt in front of .text section which means we need either add an
        offset to CONFIG_SYS_TEXT_BASE to compensate for .ivt or don't
        pass "-Ttext" to the LD at all and specify link base in linker
        script directly.
    
     2. Some architectures even though have .text section in the very
        beginning of the U-Boot image still use different symbols to
        specify link-base:
           * NIOS2: CONFIG_SYS_MONITOR_BASE (which I really like because
             that exactly what makes sense - where out image starts but not
             beginning of its .text section which just happened to match the
             whole image beginning)
           * EXTENSA: CONFIG_SYS_TEXT_ADDR
           * X86: Which doesn't use CONFIG_SYS_MONITOR_BASE in case of EFI
             otherwise sets explicit link base in u-boot.lds
    
    I think that's good to allow for flexibility and don't require each and
    every architecture or even platform to specify CONFIG_SYS_TEXT_BASE as well
    as use it to set .text section location.
    
    So let's only pass "-Ttext xxx" for those architectures who don't set
    link-base explicitly in their linker scripts.
    
    This patch iaddresses comments for previously sent
    https://patchwork.ozlabs.org/patch/867540/
    
    .
    
    Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
    Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
    Cc: Marek Vasut <marek.vasut@gmail.com>
    Cc: Max Filippov <jcmvbkbc@gmail.com>
    Cc: Simon Glass <sjg@chromium.org>
    Cc: Tom Rini <trini@konsulko.com>
    1022807c
    History
    Makefile: Don't mess with .text section location for selected arches
    Alexey Brodkin authored
    Most of architectures have .text section situated in the very beginning
    of U-Boot binary and thus it is very logical that CONFIG_SYS_TEXT_BASE
    is used on final linkage step to specify where U-Boot gets linked to.
    
    For that we pass the following construction to the LD:
    ---------------------------->8-----------------------
    xxx-ld ...  -Ttext $(CONFIG_SYS_TEXT_BASE) ...
    ---------------------------->8-----------------------
    
    But there could be exceptions. For example:
     1. In case of ARCv2 we want to put vectors table in its own section
        .ivt in front of .text section which means we need either add an
        offset to CONFIG_SYS_TEXT_BASE to compensate for .ivt or don't
        pass "-Ttext" to the LD at all and specify link base in linker
        script directly.
    
     2. Some architectures even though have .text section in the very
        beginning of the U-Boot image still use different symbols to
        specify link-base:
           * NIOS2: CONFIG_SYS_MONITOR_BASE (which I really like because
             that exactly what makes sense - where out image starts but not
             beginning of its .text section which just happened to match the
             whole image beginning)
           * EXTENSA: CONFIG_SYS_TEXT_ADDR
           * X86: Which doesn't use CONFIG_SYS_MONITOR_BASE in case of EFI
             otherwise sets explicit link base in u-boot.lds
    
    I think that's good to allow for flexibility and don't require each and
    every architecture or even platform to specify CONFIG_SYS_TEXT_BASE as well
    as use it to set .text section location.
    
    So let's only pass "-Ttext xxx" for those architectures who don't set
    link-base explicitly in their linker scripts.
    
    This patch iaddresses comments for previously sent
    https://patchwork.ozlabs.org/patch/867540/
    
    .
    
    Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
    Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
    Cc: Marek Vasut <marek.vasut@gmail.com>
    Cc: Max Filippov <jcmvbkbc@gmail.com>
    Cc: Simon Glass <sjg@chromium.org>
    Cc: Tom Rini <trini@konsulko.com>