summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2015-01-22 11:30:37 -0800
committerRoland McGrath <roland@hack.frob.com>2015-01-22 11:30:37 -0800
commit7c78e343799368f2b1a664e88a988ce4ec79eaa3 (patch)
tree33f168cc5453df7e73b4c8b234298ce737c05697
parent0a6e4c2bb8875ddf33c2326cbc4080f8af2f896f (diff)
downloadglibc-7c78e343799368f2b1a664e88a988ce4ec79eaa3.tar.gz
glibc-7c78e343799368f2b1a664e88a988ce4ec79eaa3.tar.xz
glibc-7c78e343799368f2b1a664e88a988ce4ec79eaa3.zip
Separate IRT tables in rtld.
-rw-r--r--sysdeps/nacl/Makefile32
-rw-r--r--sysdeps/nacl/Versions2
-rw-r--r--sysdeps/nacl/nacl-interface-list.h31
-rw-r--r--sysdeps/nacl/nacl-interface-table.c5
-rw-r--r--sysdeps/nacl/nacl-interfaces.h15
-rw-r--r--sysdeps/nacl/nacl-interfaces.mk.in19
-rw-r--r--sysdeps/nacl/shlib-versions2
7 files changed, 74 insertions, 32 deletions
diff --git a/sysdeps/nacl/Makefile b/sysdeps/nacl/Makefile
index 86d84650ca..693cd4cf31 100644
--- a/sysdeps/nacl/Makefile
+++ b/sysdeps/nacl/Makefile
@@ -20,6 +20,7 @@
 # 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
@@ -62,16 +63,24 @@ ifeq ($(subdir),misc)
 # 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
@@ -81,21 +90,24 @@ endef
 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)
diff --git a/sysdeps/nacl/Versions b/sysdeps/nacl/Versions
index 60f1e92d49..32eb77241a 100644
--- a/sysdeps/nacl/Versions
+++ b/sysdeps/nacl/Versions
@@ -15,5 +15,7 @@ libc {
     __libc_open;
     __libc_close;
     __libc_fork;
+
+    __nacl_irt_*;
   }
 }
diff --git a/sysdeps/nacl/nacl-interface-list.h b/sysdeps/nacl/nacl-interface-list.h
index 3206eb75f9..2e6afd731c 100644
--- a/sysdeps/nacl/nacl-interface-list.h
+++ b/sysdeps/nacl/nacl-interface-list.h
@@ -1,11 +1,20 @@
-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)
diff --git a/sysdeps/nacl/nacl-interface-table.c b/sysdeps/nacl/nacl-interface-table.c
index 5a53fbdb0d..e5401983f9 100644
--- a/sysdeps/nacl/nacl-interface-table.c
+++ b/sysdeps/nacl/nacl-interface-table.c
@@ -23,6 +23,10 @@
 #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)
 
@@ -36,3 +40,4 @@ static const struct nacl_interface PASTE (desc_, INTERFACE_TYPE)
 
 struct INTERFACE_TYPE PASTE (__, INTERFACE_TYPE)
   __attribute__ ((SECTION (tables)));
+PASTE (INTERFACE_MODULE, _hidden_data_def) (PASTE (__, INTERFACE_TYPE))
diff --git a/sysdeps/nacl/nacl-interfaces.h b/sysdeps/nacl/nacl-interfaces.h
index 524ca8d75c..8d28e1a6df 100644
--- a/sysdeps/nacl/nacl-interfaces.h
+++ b/sysdeps/nacl/nacl-interfaces.h
@@ -75,8 +75,19 @@ next_nacl_interface (const struct nacl_interface *i)
                          & -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
diff --git a/sysdeps/nacl/nacl-interfaces.mk.in b/sysdeps/nacl/nacl-interfaces.mk.in
index 5d8c36e99f..92ff3c6afe 100644
--- a/sysdeps/nacl/nacl-interfaces.mk.in
+++ b/sysdeps/nacl/nacl-interfaces.mk.in
@@ -1,20 +1,23 @@
 /* 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"
 
diff --git a/sysdeps/nacl/shlib-versions b/sysdeps/nacl/shlib-versions
index dc122bf3f5..2658047209 100644
--- a/sysdeps/nacl/shlib-versions
+++ b/sysdeps/nacl/shlib-versions
@@ -1,6 +1,6 @@
 # DEFAULT			Earliest symbol set
 # -------			-------------------
-DEFAULT				GLIBC_2.20
+DEFAULT				GLIBC_2.21
 
 # Library=version		Earliest symbol set (optional)
 # ---------------		------------------------------