}
\f
-void
-fill_freloc (void)
+static void
+freloc_check_fill (void)
{
+ if (freloc.size)
+ return;
+
if (ARRAYELTS (helper_link_table) > F_RELOC_MAX_SIZE)
goto overflow;
memcpy (freloc.link_table, helper_link_table, sizeof (helper_link_table));
freloc.size = ARRAYELTS (helper_link_table);
+ eassert (!NILP (Vcomp_subr_list));
+
Lisp_Object subr_l = Vcomp_subr_list;
FOR_EACH_TAIL (subr_l)
{
fatal ("Overflowing function relocation table, increase F_RELOC_MAX_SIZE");
}
-int
-filled_freloc (void)
-{
- return freloc.link_table[0] ? 1 : 0;
-}
-
/******************************************************************************/
/* Helper functions called from the run-time. */
/* These can't be statics till shared mechanism is used to solve relocations. */
void
load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump)
{
+ freloc_check_fill ();
+
dynlib_handle_ptr handle = comp_u->handle;
struct thread_state ***current_thread_reloc =
dynlib_sym (handle, CURRENT_THREAD_RELOC_SYM);
{
CHECK_STRING (file);
- if (!freloc.link_table[0])
- xsignal2 (Qnative_lisp_load_failed, file,
- build_string ("Empty relocation table"));
struct Lisp_Native_Comp_Unit *comp_u = allocate_native_comp_unit();
comp_u->handle = dynlib_open (SSDATA (file));
if (!comp_u->handle)
doc: /* The compiler context. */);
Vcomp_ctxt = Qnil;
- /* FIXME should be initialized but not here... */
+ /* FIXME should be initialized but not here... Plus this don't have
+ to be necessarily exposed to lisp but can easy debug for now. */
DEFVAR_LISP ("comp-subr-list", Vcomp_subr_list,
doc: /* List of all defined subrs. */);
DEFVAR_LISP ("comp-sym-subr-c-name-h", Vcomp_sym_subr_c_name_h,
extern void load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u,
bool loading_dump);
extern void syms_of_comp (void);
-/* Fill the freloc structure. Must be called before any eln is loaded. */
-extern void fill_freloc (void);
-/* Return 1 if freloc is filled or 0 otherwise. */
-extern int filled_freloc (void);
-
#endif
#endif