Skip to content
  • Tim Abbott's avatar
    kbuild: Don't define ALIGN and ENTRY when preprocessing linker scripts. · 42f29a25
    Tim Abbott authored
    
    
    Adding a reference to <linux/linkage.h> to x86's <asm/cache.h> causes
    the x86 linker script to have syntax errors, because the ALIGN and
    ENTRY keywords get redefined to the assembly implementations of those.
    One could fix this by adjusting the include structure, but I think any
    solution based on that approach would be fragile.
    
    Currently, it is impossible when writing a header to do something
    different for assembly files and linker scripts, even though there are
    clearly cases where one wants them to define macros differently for
    the two (ENTRY being an excellent example).
    So I think the right solution here is to introduce a new preprocessor
    definition, called LINKER_SCRIPT that is set along with __ASSEMBLY__
    for linker scripts, and to use that to not define ALIGN and ENTRY in
    linker scripts.
    I suspect we'll find other uses for this mechanism in
    the future.
    
    Signed-off-by: default avatarTim Abbott <tabbott@ksplice.com>
    Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
    42f29a25