chiark / gitweb /
base/asm-common.h, *.S: Introduce `AUXFN'/`ENDAUXFN'; abolish `gotaux'.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 13 Jul 2016 09:12:07 +0000 (10:12 +0100)
This change introduces a new macro pair `AUXFN' and `ENDAUXFN' which are
mostly useful in other macros.  They bracket an auxiliary function
definition which will be put somewhere convenient (at the end of the
text section), and defined exactly once.

This is exactly what we need to make the `_where_am_i.GOTREG' macros
automatically in `ldgot', so use this and abolish `gotaux' from the
codebase.

base/asm-common.h
symm/rijndael-x86ish-aesni.S

index 8ab0bc0a03bd3d81e610cd9e21a0f742ed172b67..0b5f2238a2b658373f0b4715f01ab4e5ac78f989 100644 (file)
@@ -51,6 +51,19 @@ F(name):                                                             \
        ENDFUNC_HOOK(name);                                             \
        _LTORG
 
+// Make a helper function, if necessary.
+#define AUXFN(name)                                                    \
+  .ifndef .L$_auxfn_def.name;                                          \
+       .text 7128;                                                     \
+       .macro _ENDAUXFN; _ENDAUXFN_TAIL(name); .endm;                  \
+       FUNC_PREHOOK(name);                                             \
+name:
+#define _ENDAUXFN_TAIL(name)                                           \
+       .purgem _ENDAUXFN;                                              \
+       .text .L$_subsec;                                               \
+       .L$_auxfn_def.name = 1
+#define ENDAUXFN _ENDAUXFN; .endif
+
 ///--------------------------------------------------------------------------
 /// ELF-specific hacking.
 
@@ -109,18 +122,12 @@ F(name):                                                          \
 // Maybe load GOT address into GOT.
 .macro ldgot got=GOTREG
 #if WANT_PIC && CPUFAM_X86
-       call    _where_am_i.\got
-       add     \got, offset _GLOBAL_OFFSET_TABLE_
-#endif
-.endm
-
-// Maybe build a helper subroutine for `ldgot GOT'.
-.macro gotaux got=GOTREG
-#if WANT_PIC && CPUFAM_X86
-       .align  16
-_where_am_i.\got :
+  AUXFN(_ldgot.\got)
        mov     \got, [esp]
        ret
+  ENDAUXFN
+       call    _ldgot.\got
+       add     \got, offset _GLOBAL_OFFSET_TABLE_
 #endif
 .endm
 
index 5194c17df1c2a9d27161f4927aefb4f99ae22f99..12d4267f0fba8ca9ca6e725e851cc7fefee43b5a 100644 (file)
@@ -546,8 +546,6 @@ bogus:      callext F(abort)
 0:     hlt
        jmp     0b
 
-       gotaux  ecx
-
 ///--------------------------------------------------------------------------
 /// Data tables.