nuttx/libs/libc/modlib/modlib_globals.S
Neale Ferguson b5cd7c2a82 libs/libc/modlib: fix dynamic loader issues
* build-globals.sh
    - Macros for defining symbols etc. based on assembler in use
    - Use the System.map to get all the nuttx symbols

  * libs/libc/modlib/modlib_globals.S
    - Provide an empty skeleton. If the dynamic loading functions
      are required then run build-global.sh after a clean build
      using the skeleton. This will fill out the skeleton with the
      symbols to be available to dynamically loaded modules.

  * libs/libc/modlib/modlib_loadhdrs.c
    - Fix case where there are no program headers are avaiable
2023-07-07 13:43:20 -04:00

78 lines
1.3 KiB
ArmAsm

#ifdef __CYGWIN__
# define SYMBOL(s) s
# define WEAK .weak
# define GLOBAL .global
# define SECTION .data
.macro GLOBAL ep
.global SYMBOL(\ep)
.type SYMBOL(\ep), "object"
.endm
.macro SIZE ep
.endm
#elif defined(__ELF__)
# define SYMBOL(s) s
# define WEAK .weak
# define SECTION .data
.macro GLOBAL ep
.global SYMBOL(\ep)
.type SYMBOL(\ep), "object"
.endm
.macro SIZE ep
.size SYMBOL(\ep), . - SYMBOL(\ep)
.endm
#else
# define SYMBOL(s) _##s
# define WEAK .weak_definition
# define SECTION .section __DATA,__data
.macro GLOBAL ep
.private_extern SYMBOL(\ep)
.globl SYMBOL(\ep)
.endm
.macro SIZE ep
.endm
#endif
#if __SIZEOF_POINTER__ == 8
.macro globalEntry index, ep
WEAK SYMBOL(\ep)
.quad .l\index
.quad \ep
.endm
# define ALIGN 8
#else
.macro globalEntry index, ep
WEAK SYMBOL(\ep)
.long .l\index
.long \ep
.endm
# define ALIGN 4
#endif
#ifdef __ARM_ARCH_ISA_THUMB2
# ifdef __ARM_ARCH_7M__
.arch armv7e-m
# elif defined ___ARM_ARCH 8
.arch armv8-m.base
#endif
#ifdef __ARM_ASM_SYNTAX_UNIFIED__
.syntax unified
#endif
.thumb
#endif
.data
.align ALIGN
GLOBAL globalNames
SYMBOL(globalNames):
SIZE globalNames
.align ALIGN
GLOBAL nGlobals
SYMBOL(nGlobals):
.word 0
SIZE nGlobals
.align ALIGN
GLOBAL globalTable
SYMBOL(globalTable):
SIZE globalTable