This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch hjl/mbind/master created. glibc-2.23-36-g28ad2df


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/mbind/master has been created
        at  28ad2df22847f7d055889f735e9b9710bc649615 (commit)

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=28ad2df22847f7d055889f735e9b9710bc649615

commit 28ad2df22847f7d055889f735e9b9710bc649615
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Feb 24 10:45:35 2016 -0800

    Add __gnu_mbind_setup and some tests

diff --git a/sysdeps/x86/Versions b/sysdeps/x86/Versions
index 41617ba..a627762 100644
--- a/sysdeps/x86/Versions
+++ b/sysdeps/x86/Versions
@@ -2,7 +2,7 @@ ld {
   GLIBC_PRIVATE {
     __get_cpu_features;
 
-    # Support for NUMA memory node
-    __setup_mbind;
+    # Set up special memory.
+    __gnu_mbind_setup;
   }
 }
diff --git a/sysdeps/x86/init-mbind.h b/sysdeps/x86/init-mbind.h
index daf8c0c..c88f594 100644
--- a/sysdeps/x86/init-mbind.h
+++ b/sysdeps/x86/init-mbind.h
@@ -1,5 +1,5 @@
 /* This file is part of the GNU C Library.
-   Copyright (C) 2015 Free Software Foundation, Inc.
+   Copyright (C) 2016 Free Software Foundation, Inc.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -32,8 +32,8 @@ init_mbind (const char *name, const ElfW(Phdr) *phdr, size_t phnum,
 	if (signature)
 	  {
 	    void *addr = (void *) (uintptr_t) (load + phdr->p_vaddr);
-	    int error_code = __setup_mbind (name, signature, addr,
-					    phdr->p_memsz);
+	    int error_code = __gnu_mbind_setup (name, signature, addr,
+						phdr->p_memsz);
 	    if (error_code < 0)
 	      _dl_fatal_printf (N_("_dl_mbind failed on file %s with signature %s: error 0x%x\n"),
 				name, signature, -error_code);
diff --git a/sysdeps/x86/setup-mbind.c b/sysdeps/x86/setup-mbind.c
index 2364fa6..626d834 100644
--- a/sysdeps/x86/setup-mbind.c
+++ b/sysdeps/x86/setup-mbind.c
@@ -1,5 +1,5 @@
 /* This file is part of the GNU C Library.
-   Copyright (C) 2015 Free Software Foundation, Inc.
+   Copyright (C) 2016 Free Software Foundation, Inc.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -19,10 +19,10 @@
 #include <setup-mbind.h>
 
 int weak_function
-__setup_mbind (const char *filename __attribute__ ((unused)),
-	       const char *signature __attribute__ ((unused)),
-	       void *addr __attribute__ ((unused)),
-	       size_t length __attribute__ ((unused)))
+__gnu_mbind_setup (const char *filename __attribute__ ((unused)),
+		   const char *signature __attribute__ ((unused)),
+		   void *addr __attribute__ ((unused)),
+		   size_t length __attribute__ ((unused)))
 {
   return 0;
 }
diff --git a/sysdeps/x86/setup-mbind.h b/sysdeps/x86/setup-mbind.h
index 30c77fc..12e3a75 100644
--- a/sysdeps/x86/setup-mbind.h
+++ b/sysdeps/x86/setup-mbind.h
@@ -17,6 +17,6 @@
 
 #include <stddef.h>
 
-/* Support NUMA memory node.  */
-extern int weak_function __setup_mbind (const char *, const char *,
-					void *, size_t);
+/* Set up special memory.  */
+extern int weak_function __gnu_mbind_setup (const char *, const char *,
+					    void *, size_t);
diff --git a/sysdeps/x86/tst-mbind1.c b/sysdeps/x86/tst-mbind1.c
index 60fe53b..cf4e16d 100644
--- a/sysdeps/x86/tst-mbind1.c
+++ b/sysdeps/x86/tst-mbind1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 Free Software Foundation, Inc.
+/* Copyright (C) 2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,10 +24,10 @@ static int mbind_called;
 #endif
 
 int
-__setup_mbind (const char *filename,
-	       const char *signature __attribute__ ((unused)),
-	       void *addr __attribute__ ((unused)),
-	       size_t length __attribute__ ((unused)))
+__gnu_mbind_setup (const char *filename,
+		   const char *signature __attribute__ ((unused)),
+		   void *addr __attribute__ ((unused)),
+		   size_t length __attribute__ ((unused)))
 {
   size_t len = strlen (filename);
   size_t program_size = sizeof (PROGRAM_NAME);
@@ -41,7 +41,7 @@ do_test (void)
 {
   if (mbind_called != 1)
     {
-      printf ("__setup_mbind isn't called\n");
+      printf ("__gnu_mbind_setup isn't called\n");
       return 1;
     }
 
diff --git a/sysdeps/x86/tst-mbind2.c b/sysdeps/x86/tst-mbind2.c
index 1d84b61..da1d965 100644
--- a/sysdeps/x86/tst-mbind2.c
+++ b/sysdeps/x86/tst-mbind2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 Free Software Foundation, Inc.
+/* Copyright (C) 2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -29,10 +29,10 @@ static int mbind_called;
 extern void mbind_test (void);
 
 int
-__setup_mbind (const char *filename,
-	       const char *signature __attribute__ ((unused)),
-	       void *addr __attribute__ ((unused)),
-	       size_t length __attribute__ ((unused)))
+__gnu_mbind_setup (const char *filename,
+		   const char *signature __attribute__ ((unused)),
+		   void *addr __attribute__ ((unused)),
+		   size_t length __attribute__ ((unused)))
 {
   size_t len = strlen (filename);
   size_t program_size = sizeof (PROGRAM_NAME);
@@ -52,7 +52,7 @@ do_test (void)
 
   if (mbind_called != 2)
     {
-      printf ("__setup_mbind isn't called\n");
+      printf ("__gnu_mbind_setup isn't called\n");
       return 1;
     }
 
diff --git a/sysdeps/x86/tst-mbind3.c b/sysdeps/x86/tst-mbind3.c
index 4c935bd..6d57314 100644
--- a/sysdeps/x86/tst-mbind3.c
+++ b/sysdeps/x86/tst-mbind3.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 Free Software Foundation, Inc.
+/* Copyright (C) 2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,7 +24,7 @@ do_test (void)
 {
   if (mbind_called != 1)
     {
-      printf ("__setup_mbind isn't called\n");
+      printf ("__gnu_mbind_setup isn't called\n");
       return 1;
     }
 
diff --git a/sysdeps/x86/tst-mbind3mod.c b/sysdeps/x86/tst-mbind3mod.c
index f0ab4a0..5551097 100644
--- a/sysdeps/x86/tst-mbind3mod.c
+++ b/sysdeps/x86/tst-mbind3mod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 Free Software Foundation, Inc.
+/* Copyright (C) 2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,10 +23,10 @@ int mbind_called;
 #endif
 
 int
-__setup_mbind (const char *filename,
-	       const char *signature __attribute__ ((unused)),
-	       void *addr __attribute__ ((unused)),
-	       size_t length __attribute__ ((unused)))
+__gnu_mbind_setup (const char *filename,
+		   const char *signature __attribute__ ((unused)),
+		   void *addr __attribute__ ((unused)),
+		   size_t length __attribute__ ((unused)))
 {
   size_t len = strlen (filename);
   size_t program_size = sizeof (PROGRAM_NAME);

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f0c3cbf4300a8a6c6cf2a2c433d5da3bd5c253f8

commit f0c3cbf4300a8a6c6cf2a2c433d5da3bd5c253f8
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Oct 7 12:58:12 2015 -0700

    Add __setup_mbind and some tests

diff --git a/csu/init-first.c b/csu/init-first.c
index 77c6e1c..a58ef63 100644
--- a/csu/init-first.c
+++ b/csu/init-first.c
@@ -77,6 +77,10 @@ _init (int argc, char **argv, char **envp)
   /* First the initialization which normally would be done by the
      dynamic linker.  */
   _dl_non_dynamic_init ();
+
+# ifdef INIT_MBIND
+    INIT_MBIND (argv[0], _dl_phdr, _dl_phnum, 0);
+# endif
 #endif
 
 #ifdef VDSO_SETUP
diff --git a/elf/dl-init.c b/elf/dl-init.c
index 818c3aa..b20bbc8 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -35,6 +35,14 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
      dependency.  */
   l->l_init_called = 1;
 
+#ifdef INIT_MBIND
+  if (l->l_phdr)
+    {
+      const char *name = l->l_name[0] == '\0' ? argv[0] : l->l_name;
+      INIT_MBIND (name, l->l_phdr, l->l_phnum, l->l_addr);
+    }
+#endif
+
   /* Check for object which constructors we do not run here.  */
   if (__builtin_expect (l->l_name[0], 'a') == '\0'
       && l->l_type == lt_executable)
diff --git a/elf/dl-support.c b/elf/dl-support.c
index c30194c..8f2241d 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -383,3 +383,7 @@ _dl_non_dynamic_init (void)
 #ifdef DL_SYSINFO_IMPLEMENTATION
 DL_SYSINFO_IMPLEMENTATION
 #endif
+
+#ifdef INIT_MBIND
+# include <setup-mbind.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/x86/ldsodefs.h b/sysdeps/unix/sysv/linux/x86/ldsodefs.h
new file mode 100644
index 0000000..1b1c1f8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86/ldsodefs.h
@@ -0,0 +1,26 @@
+/* Run-time dynamic linker data structures for loaded ELF shared objects.  x86
+   Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef	_LDSODEFS_H
+
+/* Get the real definitions.  */
+#include_next <ldsodefs.h>
+
+#include <init-mbind.h>
+
+#endif /* ldsodefs.h */
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index 0de4f42..3bc1222 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -3,8 +3,19 @@ gen-as-const-headers += cpu-features-offsets.sym rtld-global-offsets.sym
 endif
 
 ifeq ($(subdir),elf)
-sysdep-dl-routines += dl-get-cpu-features
+sysdep-dl-routines += dl-get-cpu-features setup-mbind
 
-tests += tst-get-cpu-features
-tests-static += tst-get-cpu-features-static
+tests += tst-get-cpu-features tst-mbind1 tst-mbind2 tst-mbind3
+tests-static += tst-get-cpu-features-static tst-mbind1-static
+
+modules-names += tst-mbind2mod tst-mbind3mod
+
+$(objpfx)tst-mbind2: $(objpfx)tst-mbind2mod.so
+$(objpfx)tst-mbind3: $(objpfx)tst-mbind3mod.so
+
+ifeq (yesyes,$(have-fpie)$(build-shared))
+tests += tst-mbind1-pie
+tests-pie += tst-mbind1-pie
+CFLAGS-tst-mbind1-pie.c += $(pie-ccflag)
+endif
 endif
diff --git a/sysdeps/x86/Versions b/sysdeps/x86/Versions
index e029237..41617ba 100644
--- a/sysdeps/x86/Versions
+++ b/sysdeps/x86/Versions
@@ -1,5 +1,8 @@
 ld {
   GLIBC_PRIVATE {
     __get_cpu_features;
+
+    # Support for NUMA memory node
+    __setup_mbind;
   }
 }
diff --git a/sysdeps/x86/init-mbind.h b/sysdeps/x86/init-mbind.h
new file mode 100644
index 0000000..daf8c0c
--- /dev/null
+++ b/sysdeps/x86/init-mbind.h
@@ -0,0 +1,45 @@
+/* This file is part of the GNU C Library.
+   Copyright (C) 2015 Free Software Foundation, Inc.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+#include <libintl.h>
+#include <setup-mbind.h>
+
+static inline void
+init_mbind (const char *name, const ElfW(Phdr) *phdr, size_t phnum,
+	    ElfW(Addr) load)
+{
+  /* FIXME: Need to check PT_GNU_MBIND segment for signature
+     instead of use "foobar" here.  */
+  for (; phnum; phnum--, phdr++)
+    if (phdr->p_type == PT_LOAD)
+      {
+	const char *signature = "foobar";
+	if (signature)
+	  {
+	    void *addr = (void *) (uintptr_t) (load + phdr->p_vaddr);
+	    int error_code = __setup_mbind (name, signature, addr,
+					    phdr->p_memsz);
+	    if (error_code < 0)
+	      _dl_fatal_printf (N_("_dl_mbind failed on file %s with signature %s: error 0x%x\n"),
+				name, signature, -error_code);
+	  }
+	break;
+      }
+}
+
+#define INIT_MBIND init_mbind
diff --git a/sysdeps/x86/setup-mbind.c b/sysdeps/x86/setup-mbind.c
new file mode 100644
index 0000000..2364fa6
--- /dev/null
+++ b/sysdeps/x86/setup-mbind.c
@@ -0,0 +1,28 @@
+/* This file is part of the GNU C Library.
+   Copyright (C) 2015 Free Software Foundation, Inc.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+
+#include <setup-mbind.h>
+
+int weak_function
+__setup_mbind (const char *filename __attribute__ ((unused)),
+	       const char *signature __attribute__ ((unused)),
+	       void *addr __attribute__ ((unused)),
+	       size_t length __attribute__ ((unused)))
+{
+  return 0;
+}
diff --git a/sysdeps/x86/setup-mbind.h b/sysdeps/x86/setup-mbind.h
new file mode 100644
index 0000000..30c77fc
--- /dev/null
+++ b/sysdeps/x86/setup-mbind.h
@@ -0,0 +1,22 @@
+/* This file is part of the GNU C Library.
+   Copyright (C) 2015 Free Software Foundation, Inc.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+
+/* Support NUMA memory node.  */
+extern int weak_function __setup_mbind (const char *, const char *,
+					void *, size_t);
diff --git a/sysdeps/x86/tst-mbind1-pie.c b/sysdeps/x86/tst-mbind1-pie.c
new file mode 100644
index 0000000..ec8c535
--- /dev/null
+++ b/sysdeps/x86/tst-mbind1-pie.c
@@ -0,0 +1,2 @@
+#define PROGRAM_NAME "tst-mbind1-pie"
+#include "tst-mbind1.c"
diff --git a/sysdeps/x86/tst-mbind1-static.c b/sysdeps/x86/tst-mbind1-static.c
new file mode 100644
index 0000000..9584073
--- /dev/null
+++ b/sysdeps/x86/tst-mbind1-static.c
@@ -0,0 +1,2 @@
+#define PROGRAM_NAME "tst-mbind1-static"
+#include "tst-mbind1.c"
diff --git a/sysdeps/x86/tst-mbind1.c b/sysdeps/x86/tst-mbind1.c
new file mode 100644
index 0000000..60fe53b
--- /dev/null
+++ b/sysdeps/x86/tst-mbind1.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <string.h>
+#include <stdio.h>
+
+static int mbind_called;
+#ifndef PROGRAM_NAME
+# define PROGRAM_NAME "tst-mbind1"
+#endif
+
+int
+__setup_mbind (const char *filename,
+	       const char *signature __attribute__ ((unused)),
+	       void *addr __attribute__ ((unused)),
+	       size_t length __attribute__ ((unused)))
+{
+  size_t len = strlen (filename);
+  size_t program_size = sizeof (PROGRAM_NAME);
+  if (strcmp (filename + len - program_size + 1, PROGRAM_NAME) == 0)
+    mbind_called++;
+  return 0;
+}
+
+static int
+do_test (void)
+{
+  if (mbind_called != 1)
+    {
+      printf ("__setup_mbind isn't called\n");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
diff --git a/sysdeps/x86/tst-mbind2.c b/sysdeps/x86/tst-mbind2.c
new file mode 100644
index 0000000..1d84b61
--- /dev/null
+++ b/sysdeps/x86/tst-mbind2.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <string.h>
+#include <stdio.h>
+
+static int mbind_called;
+#ifndef PROGRAM_NAME
+# define PROGRAM_NAME "tst-mbind2"
+#endif
+#ifndef PROGRAM_DSO1_NAME
+# define PROGRAM_DSO1_NAME "tst-mbind2mod.so"
+#endif
+
+extern void mbind_test (void);
+
+int
+__setup_mbind (const char *filename,
+	       const char *signature __attribute__ ((unused)),
+	       void *addr __attribute__ ((unused)),
+	       size_t length __attribute__ ((unused)))
+{
+  size_t len = strlen (filename);
+  size_t program_size = sizeof (PROGRAM_NAME);
+  size_t program_dso1_size = sizeof (PROGRAM_DSO1_NAME);
+  if (strcmp (filename + len - program_size + 1, PROGRAM_NAME) == 0)
+    mbind_called++;
+  if (strcmp (filename + len - program_dso1_size + 1,
+	      PROGRAM_DSO1_NAME) == 0)
+    mbind_called++;
+  return 0;
+}
+
+static int
+do_test (void)
+{
+  mbind_test ();
+
+  if (mbind_called != 2)
+    {
+      printf ("__setup_mbind isn't called\n");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
diff --git a/sysdeps/x86/tst-mbind2mod.c b/sysdeps/x86/tst-mbind2mod.c
new file mode 100644
index 0000000..b1a4d35
--- /dev/null
+++ b/sysdeps/x86/tst-mbind2mod.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+void
+mbind_test (void)
+{
+}
diff --git a/sysdeps/x86/tst-mbind3.c b/sysdeps/x86/tst-mbind3.c
new file mode 100644
index 0000000..4c935bd
--- /dev/null
+++ b/sysdeps/x86/tst-mbind3.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+
+extern int mbind_called;
+
+static int
+do_test (void)
+{
+  if (mbind_called != 1)
+    {
+      printf ("__setup_mbind isn't called\n");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
diff --git a/sysdeps/x86/tst-mbind3mod.c b/sysdeps/x86/tst-mbind3mod.c
new file mode 100644
index 0000000..f0ab4a0
--- /dev/null
+++ b/sysdeps/x86/tst-mbind3mod.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <string.h>
+
+int mbind_called;
+#ifndef PROGRAM_NAME
+# define PROGRAM_NAME "tst-mbind3"
+#endif
+
+int
+__setup_mbind (const char *filename,
+	       const char *signature __attribute__ ((unused)),
+	       void *addr __attribute__ ((unused)),
+	       size_t length __attribute__ ((unused)))
+{
+  size_t len = strlen (filename);
+  size_t program_size = sizeof (PROGRAM_NAME);
+  if (strcmp (filename + len - program_size + 1, PROGRAM_NAME) == 0)
+    mbind_called++;
+  return 0;
+}

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]