# will probably never be useful for NaCl, just elide the directory rather
# than implementing stuff to make it compile (and never get used).
subdirs := $(filter-out nptl_db,$(subdirs))
+sorted-subdirs := $(filter-out nptl_db,$(sorted-subdirs))
# The (required) --with-headers option to configure sets sysheaders to the
# location of the native_client/.. source directory. We'll get necessary
# install it.
sysdep_headers += bits/mman-linux.h
-$(objpfx)nacl-interfaces.v.i: $(nacl)/nacl-interfaces.mk.in \
+# XXX temp test
+others += hello hellow
+others-static += hello
+
+endif
+
+
+$(common-objpfx)nacl-interfaces.v.i: $(nacl)/nacl-interfaces.mk.in \
$(nacl)/nacl-interface-list.h
--include $(objpfx)nacl-interfaces.v
+-include $(common-objpfx)nacl-interfaces.v
nacl-all-interfaces = $(nacl-mandatory-interfaces) $(nacl-optional-interfaces)
nacl-interface-routines = $(nacl-all-interfaces:%=nacl-interface-%)
define nacl-interface-table-command
(echo '#define INTERFACE_CATEGORY $1'; \
- echo '#define INTERFACE_TYPE $*'; \
+ echo '#define INTERFACE_MODULE $(firstword $(subst -, ,$*))'; \
+ echo '#define INTERFACE_TYPE $(word 2,$(subst -, ,$*))'; \
echo '#define INTERFACE_STRING $(nacl-$*-string)'; \
echo '#include "nacl-interface-table.c"' \
) > $@T
nacl-interface-pattern = $(objpfx)nacl-interface-%.c
$(nacl-mandatory-interfaces:%=$(nacl-interface-pattern)): \
- $(nacl-interface-pattern): $(nacl)/Makefile $(objpfx)nacl-interfaces.v
+ $(nacl-interface-pattern): $(nacl)/Makefile $(common-objpfx)nacl-interfaces.v
$(make-target-directory)
$(call nacl-interface-table-command,mandatory)
$(nacl-optional-interfaces:%=$(nacl-interface-pattern)): \
- $(nacl-interface-pattern): $(nacl)/Makefile $(objpfx)nacl-interfaces.v
+ $(nacl-interface-pattern): $(nacl)/Makefile $(common-objpfx)nacl-interfaces.v
$(make-target-directory)
$(call nacl-interface-table-command,optional)
-sysdep_routines += nacl_interface_query \
- nacl-interfaces $(nacl-interface-routines)
+nacl-routines-of = $(filter nacl-interface-$1-%,$(nacl-interface-routines))
-# XXX temp test
-others += hello hellow
-others-static += hello
+ifeq ($(subdir),csu)
+sysdep_routines += nacl_interface_query \
+ nacl-interfaces $(call nacl-routines-of,libc)
+endif
+ifeq ($(subdir),elf)
+sysdep-dl-routines += $(call nacl-routines-of,rtld)
+sysdep-rtld-routines += nacl-interfaces $(call nacl-routines-of,rtld)
endif
ifeq ($(subdir),io)
__libc_open;
__libc_close;
__libc_fork;
+
+ __nacl_irt_*;
}
}
-NACL_MANDATORY_INTERFACE (NACL_IRT_BASIC_v0_1, nacl_irt_basic)
-NACL_MANDATORY_INTERFACE (NACL_IRT_FDIO_v0_1, nacl_irt_fdio)
-NACL_MANDATORY_INTERFACE (NACL_IRT_FILENAME_v0_1, nacl_irt_filename)
-NACL_MANDATORY_INTERFACE (NACL_IRT_MEMORY_v0_3, nacl_irt_memory)
-NACL_MANDATORY_INTERFACE (NACL_IRT_DYNCODE_v0_1, nacl_irt_dyncode)
-NACL_MANDATORY_INTERFACE (NACL_IRT_THREAD_v0_1, nacl_irt_thread)
-NACL_MANDATORY_INTERFACE (NACL_IRT_FUTEX_v0_1, nacl_irt_futex)
-NACL_MANDATORY_INTERFACE (NACL_IRT_TLS_v0_1, nacl_irt_tls)
-NACL_MANDATORY_INTERFACE (NACL_IRT_RESOURCE_OPEN_v0_1, nacl_irt_resource_open)
-NACL_OPTIONAL_INTERFACE (NACL_IRT_CLOCK_v0_1, nacl_irt_clock)
-NACL_OPTIONAL_INTERFACE (NACL_IRT_DEV_GETPID_v0_1, nacl_irt_dev_getpid)
+NACL_MANDATORY_INTERFACE (rtld,
+ NACL_IRT_BASIC_v0_1, nacl_irt_basic)
+NACL_MANDATORY_INTERFACE (rtld,
+ NACL_IRT_FDIO_v0_1, nacl_irt_fdio)
+NACL_MANDATORY_INTERFACE (rtld,
+ NACL_IRT_FILENAME_v0_1, nacl_irt_filename)
+NACL_MANDATORY_INTERFACE (rtld,
+ NACL_IRT_MEMORY_v0_3, nacl_irt_memory)
+NACL_MANDATORY_INTERFACE (libc,
+ NACL_IRT_THREAD_v0_1, nacl_irt_thread)
+NACL_MANDATORY_INTERFACE (rtld,
+ NACL_IRT_FUTEX_v0_1, nacl_irt_futex)
+NACL_MANDATORY_INTERFACE (rtld,
+ NACL_IRT_TLS_v0_1, nacl_irt_tls)
+NACL_MANDATORY_INTERFACE (libc,
+ NACL_IRT_RESOURCE_OPEN_v0_1, nacl_irt_resource_open)
+NACL_OPTIONAL_INTERFACE (libc,
+ NACL_IRT_CLOCK_v0_1, nacl_irt_clock)
+NACL_OPTIONAL_INTERFACE (rtld,
+ NACL_IRT_DEV_GETPID_v0_1, nacl_irt_dev_getpid)
#define STRINGIFY(x) STRINGIFY_1 (x)
#define STRINGIFY_1(x) #x
+#if IS_IN (rtld) && PASTE (MODULE_, INTERFACE_MODULE) != MODULE_rtld
+# error "This interface is also needed in rtld."
+#endif
+
#define SECTION(which) \
section ("nacl_" STRINGIFY (INTERFACE_CATEGORY) "_interface_" #which)
struct INTERFACE_TYPE PASTE (__, INTERFACE_TYPE)
__attribute__ ((SECTION (tables)));
+PASTE (INTERFACE_MODULE, _hidden_data_def) (PASTE (__, INTERFACE_TYPE))
& -align);
}
-#define NACL_MANDATORY_INTERFACE(id, type) extern struct type __##type;
-#define NACL_OPTIONAL_INTERFACE(id, type) extern struct type __##type;
+#if IS_IN (libpthread)
+# define libpthread_hidden_proto(name) hidden_proto (name)
+#else
+# define libpthread_hidden_proto(name)
+#endif
+
+#define DECLARE_INTERFACE(module, type) \
+ extern struct type __##type; module##_hidden_proto (__##type);
+
+#define NACL_MANDATORY_INTERFACE(module, id, type) \
+ DECLARE_INTERFACE (module, type)
+#define NACL_OPTIONAL_INTERFACE(module, id, type) \
+ DECLARE_INTERFACE (module, type)
#include "nacl-interface-list.h"
#undef NACL_MANDATORY_INTERFACE
#undef NACL_OPTIONAL_INTERFACE
/* Might as well be -*- C -*-.
- This generates a makefile that sets the two variables
- nacl-mandatory-interfaces and nacl-optional-interfaces
+
+ This generates a makefile that sets the variable pairs
+ nacl-MODULE-mandatory-interfaces and nacl-MODULE-optional-interfaces
based on the nacl-interface-list.h list. */
-%define NACL_MANDATORY_INTERFACE(id, type) \
- nacl-mandatory-interfaces += type
-%define NACL_OPTIONAL_INTERFACE(id, type) \
- nacl-optional-interfaces += type
+%define NACL_MANDATORY_INTERFACE(module, id, type) \
+ nacl-mandatory-interfaces += module-type
+%define NACL_OPTIONAL_INTERFACE(module, id, type) \
+ nacl-optional-interfaces += module-type
%include "nacl-interface-list.h"
%undef NACL_MANDATORY_INTERFACE
%undef NACL_OPTIONAL_INTERFACE
-%define NACL_MANDATORY_INTERFACE(id, type) nacl-type-string := id
-%define NACL_OPTIONAL_INTERFACE(id, type) nacl-type-string := id
+%define NACL_MANDATORY_INTERFACE(module, id, type) \
+ nacl-module-type-string := id
+%define NACL_OPTIONAL_INTERFACE(module, id, type) \
+ nacl-module-type-string := id
%include "nacl-interface-list.h"
# DEFAULT Earliest symbol set
# ------- -------------------
-DEFAULT GLIBC_2.20
+DEFAULT GLIBC_2.21
# Library=version Earliest symbol set (optional)
# --------------- ------------------------------