From f8e509a9dd942ca23013df8fd7a834d30589f8b8 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Thu, 26 May 2016 09:26:09 +0100 Subject: [PATCH] base/asm-common.h: Introduce bad literal-pool handling macros. Organization: Straylight/Edgeware From: Mark Wooding 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. --- base/asm-common.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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. -- [mdw]