]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Separate IRT tables in rtld.
authorRoland McGrath <roland@hack.frob.com>
Thu, 22 Jan 2015 19:30:37 +0000 (11:30 -0800)
committerRoland McGrath <roland@hack.frob.com>
Thu, 22 Jan 2015 19:30:37 +0000 (11:30 -0800)
sysdeps/nacl/Makefile
sysdeps/nacl/Versions
sysdeps/nacl/nacl-interface-list.h
sysdeps/nacl/nacl-interface-table.c
sysdeps/nacl/nacl-interfaces.h
sysdeps/nacl/nacl-interfaces.mk.in
sysdeps/nacl/shlib-versions

index 86d84650ca3966d0d46afe337d6e1db7571cc844..693cd4cf312687d51cd373be0cf39f525948a49e 100644 (file)
@@ -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)
index 60f1e92d4912713c5a022ea052fcaf0e89ca163c..32eb77241ac0be8d2c35fa55a19541e1b6257d76 100644 (file)
@@ -15,5 +15,7 @@ libc {
     __libc_open;
     __libc_close;
     __libc_fork;
+
+    __nacl_irt_*;
   }
 }
index 3206eb75f9ac75e116c092a1876ea69d78c50869..2e6afd731c3958ea1bb8bffaacc167598efe6d19 100644 (file)
@@ -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)
index 5a53fbdb0d2c8eb4918d4a773039b2bafa67846b..e5401983f9af21c5574394b47ccbc033f64a4750 100644 (file)
 #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))
index 524ca8d75c68ce6c9a386c9c9661f1219cb1ba35..8d28e1a6df8cab1779ae7cb785cdf5ba5d8743f6 100644 (file)
@@ -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
index 5d8c36e99f5c9f90b179f2da32e71e2db70491fe..92ff3c6afee9ccc1fb5ae0415c7c7225ef501a79 100644 (file)
@@ -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"
 
index dc122bf3f54d8fa51d1c9e8b4360618bc9f0faec..2658047209f71bb522b04904846f6a051574fd7a 100644 (file)
@@ -1,6 +1,6 @@
 # DEFAULT                      Earliest symbol set
 # -------                      -------------------
-DEFAULT                                GLIBC_2.20
+DEFAULT                                GLIBC_2.21
 
 # Library=version              Earliest symbol set (optional)
 # ---------------              ------------------------------