3 ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
18 /* Hardcoded limits. Increase as needed. */
19 #define BUILD_MAX_RELOC 200 /* Max. number of relocations. */
20 #define BUILD_MAX_FOLD 4096 /* Max. number of fold rules. */
22 /* Prefix for scanned library definitions. */
23 #define LIBDEF_PREFIX "LJLIB_"
25 /* Prefix for scanned fold definitions. */
26 #define FOLDDEF_PREFIX "LJFOLD"
28 /* Prefixes for generated labels. */
29 #define LABEL_PREFIX "lj_"
30 #define LABEL_PREFIX_BC LABEL_PREFIX "BC_"
31 #define LABEL_PREFIX_FF LABEL_PREFIX "ff_"
32 #define LABEL_PREFIX_CF LABEL_PREFIX "cf_"
33 #define LABEL_PREFIX_FFH LABEL_PREFIX "ffh_"
34 #define LABEL_PREFIX_LIBCF LABEL_PREFIX "lib_cf_"
35 #define LABEL_PREFIX_LIBINIT LABEL_PREFIX "lib_init_"
37 /* Forward declaration. */
42 _(elfasm) _(coffasm) _(machasm) _(peobj) _(raw) \
43 _(bcdef) _(ffdef) _(libdef) _(recdef) _(vmdef) \
47 #define BUILDENUM(name) BUILD_##name,
53 /* Code relocation. */
54 typedef struct BuildReloc
{
60 typedef struct BuildSym
{
65 /* Build context structure. */
66 typedef struct BuildCtx
{
67 /* DynASM state pointer. Should be first member. */
69 /* Parsed command line. */
74 /* Code and symbols generated by DynASM. */
77 int npc
, nglob
, nsym
, nreloc
, nrelocsym
;
80 const char **relocsym
;
83 /* Strings generated by DynASM. */
84 const char *const *globnames
;
85 const char *const *extnames
;
86 const char *dasm_ident
;
87 const char *dasm_arch
;
89 BuildReloc reloc
[BUILD_MAX_RELOC
];
92 extern void owrite(BuildCtx
*ctx
, const void *ptr
, size_t sz
);
93 extern void emit_asm(BuildCtx
*ctx
);
94 extern void emit_peobj(BuildCtx
*ctx
);
95 extern void emit_lib(BuildCtx
*ctx
);
96 extern void emit_fold(BuildCtx
*ctx
);
98 extern const char *const bc_names
[];
99 extern const char *const ir_names
[];
100 extern const char *const irt_names
[];
101 extern const char *const irfpm_names
[];
102 extern const char *const irfield_names
[];
103 extern const char *const ircall_names
[];