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.
ENDFUNC_HOOK(name); \
_LTORG
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.
///--------------------------------------------------------------------------
/// ELF-specific hacking.
// Maybe load GOT address into GOT.
.macro ldgot got=GOTREG
#if WANT_PIC && CPUFAM_X86
// 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 :
+ ENDAUXFN
+ call _ldgot.\got
+ add \got, offset _GLOBAL_OFFSET_TABLE_
///--------------------------------------------------------------------------
/// Data tables.
///--------------------------------------------------------------------------
/// Data tables.