From: Mark Wooding Date: Thu, 26 May 2016 08:26:09 +0000 (+0100) Subject: base/asm-common.h: Introduce bad literal-pool handling macros. X-Git-Tag: 2.2.4~26 X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/commitdiff_plain/f8e509a9dd942ca23013df8fd7a834d30589f8b8?hp=2d03a881ef603023163e49d6bfb7f87afa469823 base/asm-common.h: Introduce bad literal-pool handling macros. Abuse subsections for arranging to place literals near the functions which need them. These are no use for human-written code, but they're useful in macros, especially since GAS is actually rather bad at dealing with complex expressions and relocation types in its ARM literal syntax. --- diff --git a/base/asm-common.h b/base/asm-common.h index 28ddd0d1..aa6b4c3e 100644 --- a/base/asm-common.h +++ b/base/asm-common.h @@ -27,6 +27,13 @@ ///-------------------------------------------------------------------------- /// General definitions. +// Some useful variables. + .L$_subsec = 0 + +// Literal pools done the hard way. +#define _LIT .text .L$_subsec + 1 +#define _ENDLIT .text .L$_subsec + // Announcing an external function. #define FUNC(name) \ .globl F(name); \ @@ -40,7 +47,9 @@ F(name): \ #define _ENDFUNC(name) \ .purgem ENDFUNC; \ SIZE_OBJ(name); \ - ENDFUNC_HOOK(name) + ENDFUNC_HOOK(name); \ + .L$_subsec = .L$_subsec + 2; \ + .text .L$_subsec ///-------------------------------------------------------------------------- /// ELF-specific hacking.