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/pie/static created. glibc-2.26-488-g564fd37


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/pie/static has been created
        at  564fd3712068200d3659f43bca63537bde7b525b (commit)

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

commit 564fd3712068200d3659f43bca63537bde7b525b
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Sep 27 16:47:29 2017 -0700

    Add --enable-static-pie to build-many-glibcs.py

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 8ce1c6f..013c96d 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -1343,6 +1343,7 @@ class Glibc(object):
         cfg_cmd = [os.path.join(srcdir_copy, 'configure'),
                    '--prefix=/usr',
                    '--enable-add-ons',
+                   '--enable-static-pie',
                    '--enable-profile',
                    '--build=%s' % self.ctx.build_triplet,
                    '--host=%s' % self.triplet,

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

commit a3fbc16706ad26d094d38bc1862f6069c203f944
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Sep 29 01:07:53 2017 -0700

    tile: Check SHARED instead PIC for SYSCALL_ERROR_NAME
    
    For static PIE code, PIC is defined and SHARED is undefined.  We
    should check SHARED instead PIC for SYSCALL_ERROR_NAME.
    
    	* sysdeps/unix/sysv/linux/tile/sysdep.h (SYSCALL_ERROR_NAME):
    	Check SHARED instead PIC.

diff --git a/sysdeps/unix/sysv/linux/tile/sysdep.h b/sysdeps/unix/sysv/linux/tile/sysdep.h
index fb1b89c..6e37fd2 100644
--- a/sysdeps/unix/sysv/linux/tile/sysdep.h
+++ b/sysdeps/unix/sysv/linux/tile/sysdep.h
@@ -42,7 +42,7 @@
 
 #define ret  jrp lr
 
-#ifndef PIC
+#ifndef SHARED
 /* For static code, on error jump to __syscall_error directly. */
 # define SYSCALL_ERROR_NAME __syscall_error
 #elif IS_IN (libc) || IS_IN (libpthread)

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

commit f29948104a576cb38ecde6148f7e24a8d5c44d91
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 16:13:54 2017 -0700

    sparc: Check PIC instead of SHARED in start.S
    
    Since start.o may be compiled as PIC, we should check PIC instead of
    SHARED.
    
    	* sysdeps/sparc/sparc32/start.S (_start): Check PIC instead of
    	SHARED.
    	* sysdeps/sparc/sparc64/start.S (_start): Likewise.

diff --git a/sysdeps/sparc/sparc32/start.S b/sysdeps/sparc/sparc32/start.S
index a06568d..b882d1e 100644
--- a/sysdeps/sparc/sparc32/start.S
+++ b/sysdeps/sparc/sparc32/start.S
@@ -42,7 +42,7 @@
 	.global _start
 	.type _start,#function
 _start:
-#ifdef SHARED
+#ifdef PIC
 	SETUP_PIC_REG(l7)
 #endif
 
@@ -57,7 +57,7 @@ _start:
 	add	%sp, 23*4, %o2
 
   /* Load the addresses of the user entry points.  */
-#ifndef SHARED
+#ifndef PIC
 	sethi	%hi(main), %o0
 	sethi	%hi(__libc_csu_init), %o3
 	sethi	%hi(__libc_csu_fini), %o4
diff --git a/sysdeps/sparc/sparc64/start.S b/sysdeps/sparc/sparc64/start.S
index fcd4721..21d16de 100644
--- a/sysdeps/sparc/sparc64/start.S
+++ b/sysdeps/sparc/sparc64/start.S
@@ -42,7 +42,7 @@
 	.global _start
 	.type _start,#function
 _start:
-#ifdef SHARED
+#ifdef PIC
 	SETUP_PIC_REG(l7)
 #endif
 
@@ -58,7 +58,7 @@ _start:
 	add	%sp, STACK_BIAS+23*8, %o2
 
   /* Load the addresses of the user entry points.  */
-#ifndef SHARED
+#ifndef PIC
 	sethi	%hi(main), %o0
 	sethi	%hi(__libc_csu_init), %o3
 	sethi	%hi(__libc_csu_fini), %o4

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

commit 8a17e75fe7cde79e02f56729d7338ff28fe4f0a5
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 16:13:22 2017 -0700

    microblaze: Check PIC instead of SHARED in start.S
    
    Since start.o may be compiled as PIC, we should check PIC instead of
    SHARED.
    
    	* sysdeps/microblaze/start.S (_start): Check PIC instead of SHARED.

diff --git a/sysdeps/microblaze/start.S b/sysdeps/microblaze/start.S
index f94e816..d9b13d0 100644
--- a/sysdeps/microblaze/start.S
+++ b/sysdeps/microblaze/start.S
@@ -58,7 +58,7 @@ _start:
     sw      r6,r1,r0
     addik   r7,r1,4
     addik   r1,r1,-24
-#ifdef SHARED
+#ifdef PIC
     /* Setup PIC.  */
     mfs     r20,rpc
     addik   r20,r20,_GLOBAL_OFFSET_TABLE_+8

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

commit 31751c2b427bd591f84471891621dc63318eb124
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 16:12:52 2017 -0700

    m68k: Check PIC instead of SHARED in start.S
    
    Since start.o may be compiled as PIC, we should check PIC instead of
    SHARED.
    
    	* sysdeps/m68k/start.S (_start): Check PIC instead of SHARED.

diff --git a/sysdeps/m68k/start.S b/sysdeps/m68k/start.S
index 71ba3b9..9f5d588 100644
--- a/sysdeps/m68k/start.S
+++ b/sysdeps/m68k/start.S
@@ -76,7 +76,7 @@ _start:
 	pea (%a1)		/* Push address of the shared library
 				   termination function.  */
 
-#ifdef SHARED
+#ifdef PIC
 	/* Load PIC register.  */
 	LOAD_GOT (%a5)
 

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

commit 45c66102112767bc989d49cf515f7914116121eb
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 16:12:28 2017 -0700

    hppa: Check PIC instead of SHARED in start.S
    
    Since start.o may be compiled as PIC, we should check PIC instead of
    SHARED.
    
    	* sysdeps/hppa/start.S (_start): Check PIC instead of SHARED.

diff --git a/sysdeps/hppa/start.S b/sysdeps/hppa/start.S
index 5db1ba9..c7f5972 100644
--- a/sysdeps/hppa/start.S
+++ b/sysdeps/hppa/start.S
@@ -42,7 +42,7 @@
 	/* Have the linker create plabel words so we get PLABEL32
 	   relocs and not 21/14.  The use of 21/14 relocs is only
 	   supported in the latest dynamic linker.  */
-#ifdef SHARED
+#ifdef PIC
 	.section	.data.rel.ro,"aw",@progbits
 #else
 	.section	.rodata,"a",@progbits
@@ -56,7 +56,7 @@
 	.word P%__libc_csu_fini
 .Lp__libc_csu_init:
 	.word P%__libc_csu_init
-#ifdef SHARED
+#ifdef PIC
 .Lp__global:
 	.word $global$
 #endif
@@ -101,7 +101,7 @@ _start:
 	stw	%r23, -56(%sp)
 	/* Need to setup 1, 4, 5, and 7th arguments */
 
-#ifdef SHARED
+#ifdef PIC
 	/* load main (1st argument) */
 	addil	LT'.Lpmain, %r19
 	ldw	RT'.Lpmain(%r1), %r26
@@ -130,7 +130,7 @@ _start:
 	/* void *stack_end (7th argument) */
 	stw	%sp, -60(%sp)
 
-#ifdef SHARED
+#ifdef PIC
 	/* load global */
 	addil	LT'.Lp__global, %r19
 	ldw	RT'.Lp__global(%r1), %dp

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

commit b3513a4d38be5186c2b109f162b1400acde53109
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 16:11:02 2017 -0700

    aarch64: Check PIC instead of SHARED in start.S
    
    Since start.o may be compiled as PIC, we should check PIC instead of
    SHARED.
    
    	* sysdeps/aarch64/start.S (_start): Check PIC instead of SHARED.

diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
index c20433a..7a94650 100644
--- a/sysdeps/aarch64/start.S
+++ b/sysdeps/aarch64/start.S
@@ -60,7 +60,7 @@ _start:
 	/* Setup stack limit in argument register */
 	mov	x6, sp
 
-#ifdef SHARED
+#ifdef PIC
         adrp    x0, :got:main
 	ldr     PTR_REG (0), [x0, #:got_lo12:main]
 

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

commit 45b1c08883d1f20b9e832b91e27d0c02e074d824
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:59:00 2017 -0700

    tile: Update elf_machine_load_address for static PIE
    
    tile uses _DYNAMIC to compute load address, which works with static PIE.
    We just need to return 0 if _DYNAMIC is undefined for static executable.
    
    	* sysdeps/tile/dl-machine.h (elf_machine_load_address): Return 0
    	if _DYNAMIC is undefined for static executable.

diff --git a/sysdeps/tile/dl-machine.h b/sysdeps/tile/dl-machine.h
index f7af7c3..8601147 100644
--- a/sysdeps/tile/dl-machine.h
+++ b/sysdeps/tile/dl-machine.h
@@ -84,6 +84,11 @@ elf_machine_dynamic (void)
 static inline ElfW(Addr)
 elf_machine_load_address (void)
 {
+#ifndef SHARED
+  extern ElfW(Dyn) _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+#endif
   ElfW(Addr) *got;
   ElfW(Addr) dynamic;
 

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

commit 7583ff6e18f3fa4eabc5e9c21065475f16802f4a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:57:09 2017 -0700

    sparc: Update elf_machine_load_address for static PIE
    
    sparc uses a local label to compute load address, which works with static
    PIE.  We just need to return 0 if _DYNAMIC is undefined for static
    executable.
    
    	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_dynamic): Return
    	0 if _DYNAMIC is undefined for static executable.
    	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_dynamic):
    	Likewise.

diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 436e4e6..30ae1b5 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -77,6 +77,11 @@ elf_machine_dynamic (void)
 static inline Elf32_Addr
 elf_machine_load_address (void)
 {
+#ifndef SHARED
+  extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+#endif
   register Elf32_Addr *pc __asm ("%o7"), *got __asm ("%l7");
 
   __asm ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t"
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index c2871dc..22e6dcc 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -66,6 +66,11 @@ elf_machine_dynamic (void)
 static inline Elf64_Addr
 elf_machine_load_address (void)
 {
+#ifndef SHARED
+  extern Elf64_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+#endif
   register Elf32_Addr *pc __asm ("%o7");
   register Elf64_Addr *got __asm ("%l7");
 

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

commit e3e46e81264b44842a1b5f0cfedae88bd7dce2e7
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:55:18 2017 -0700

    sh: Update elf_machine_load_address for static PIE
    
    When --enable-static-pie is used to configure glibc, we need to use
    _dl_relocate_static_pie to compute load address in static PIE.
    
    	* sysdeps/sh/dl-machine.h (elf_machine_load_address): Use
    	_dl_relocate_static_pie instead of _dl_start to compute load
    	address in static PIE.  Return 0 if _DYNAMIC is undefined for
    	static executable.

diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 7106afb..627ef11 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -50,6 +50,7 @@ static inline Elf32_Addr __attribute__ ((unused))
 elf_machine_load_address (void)
 {
   Elf32_Addr addr;
+#ifdef SHARED
   asm ("mov.l 1f,r0\n\
 	mov.l 3f,r2\n\
 	add r12,r2\n\
@@ -61,6 +62,22 @@ elf_machine_load_address (void)
 	3: .long _dl_start@GOTOFF\n\
 	2: mov r2,%0"
        : "=r" (addr) : : "r0", "r1", "r2");
+#else
+  extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+  asm ("mov.l 1f,r0\n\
+	mov.l 3f,r2\n\
+	add r12,r2\n\
+	mov.l @(r0,r12),r0\n\
+	bra 2f\n\
+	 sub r0,r2\n\
+	.align 2\n\
+	1: .long _dl_relocate_static_pie@GOT\n\
+	3: .long _dl_relocate_static_pie@GOTOFF\n\
+	2: mov r2,%0"
+       : "=r" (addr) : : "r0", "r1", "r2");
+#endif
   return addr;
 }
 

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

commit aac23fa9e6b56a605a314fe8177d2dc3912792e1
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:53:06 2017 -0700

    s390: Update elf_machine_load_address for static PIE
    
    When --enable-static-pie is used to configure glibc, we need to use
    _dl_relocate_static_pie to compute load address in static PIE.
    
    	* sysdeps/s390/s390-32/dl-machine.h (elf_machine_dynamic): Use
    	_dl_relocate_static_pie instead of _dl_start to compute load
    	address in static PIE.  Return 0 if _DYNAMIC is undefined for
    	static executable.
    	* sysdeps/s390/s390-64/dl-machine.h (elf_machine_dynamic):
    	Likewise.

diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index c302c9d..b5cdcb8 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -70,6 +70,7 @@ elf_machine_load_address (void)
 {
   Elf32_Addr addr;
 
+#ifdef SHARED
   __asm__( "   bras  1,2f\n"
 	   "1: .long _GLOBAL_OFFSET_TABLE_ - 1b\n"
 	   "   .long (_dl_start - 1b - 0x80000000) & 0x00000000ffffffff\n"
@@ -78,6 +79,19 @@ elf_machine_load_address (void)
 	   "   al    1,0(1)\n"
 	   "   sl    %0,_dl_start@GOT(1)"
 	   : "=&d" (addr) : : "1" );
+#else
+  extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+  __asm__( "   bras  1,2f\n"
+	   "1: .long _GLOBAL_OFFSET_TABLE_ - 1b\n"
+	   "   .long (_dl_relocate_static_pie - 1b - 0x80000000) & 0x00000000ffffffff\n"
+	   "2: l     %0,4(1)\n"
+	   "   ar    %0,1\n"
+	   "   al    1,0(1)\n"
+	   "   sl    %0,_dl_relocate_static_pie@GOT(1)"
+	   : "=&d" (addr) : : "1" );
+#endif
   return addr;
 }
 
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index 7513520..724cc4f 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -63,11 +63,22 @@ elf_machine_load_address (void)
 {
   Elf64_Addr addr;
 
+#ifdef SHARED
   __asm__( "   larl	 %0,_dl_start\n"
 	   "   larl	 1,_GLOBAL_OFFSET_TABLE_\n"
 	   "   lghi	 2,_dl_start@GOT\n"
 	   "   slg	 %0,0(2,1)"
 	   : "=&d" (addr) : : "1", "2" );
+#else
+  extern Elf64_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+  __asm__( "   larl	 %0,_dl_relocate_static_pie\n"
+	   "   larl	 1,_GLOBAL_OFFSET_TABLE_\n"
+	   "   lghi	 2,_dl_relocate_static_pie@GOT\n"
+	   "   slg	 %0,0(2,1)"
+	   : "=&d" (addr) : : "1", "2" );
+#endif
   return addr;
 }
 

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

commit a23c8b2f091e0e1f2647bcc1df83b5c1bb1d5998
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:51:41 2017 -0700

    powerpc32: Update elf_machine_load_address for static PIE
    
    powerpc32 uses _DYNAMIC to compute load address, which works with static
    PIE.  We just need to return 0 if _DYNAMIC is undefined for static
    executable.
    
    	* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_load_address):
    	Return 0 if _DYNAMIC is undefined for static executable.

diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h
index 1f8437e..9cf876e 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.h
+++ b/sysdeps/powerpc/powerpc32/dl-machine.h
@@ -64,6 +64,11 @@ elf_machine_dynamic (void)
 static inline Elf32_Addr __attribute__ ((const))
 elf_machine_load_address (void)
 {
+#ifndef SHARED
+  extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+#endif
   Elf32_Addr *branchaddr;
   Elf32_Addr runtime_dynamic;
 

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

commit 015f2e4770152d467595dc8c0c3e3845ce5bda37
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:50:10 2017 -0700

    nios2: Update elf_machine_load_address for static PIE
    
    nios2 uses a local label to compute load address, which works with static
    PIE.  We just need to return 0 if _DYNAMIC is undefined for static
    executable.
    
    	* sysdeps/nios2/dl-machine.h (elf_machine_dynamic): Return 0 if
    	_DYNAMIC is undefined for static executable.

diff --git a/sysdeps/nios2/dl-machine.h b/sysdeps/nios2/dl-machine.h
index b5fdd9b..85ff35d 100644
--- a/sysdeps/nios2/dl-machine.h
+++ b/sysdeps/nios2/dl-machine.h
@@ -53,6 +53,11 @@ elf_machine_dynamic (void)
 static inline Elf32_Addr
 elf_machine_load_address (void)
 {
+#ifndef SHARED
+  extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+#endif
   Elf32_Addr result;
   int tmp;
   asm ("nextpc\t%0\n\t"

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

commit eedf9b4822d848ef1ef30e7a43ac9b06703ab98f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:47:20 2017 -0700

    microblaze: Update elf_machine_load_address for static PIE
    
    microblaze uses _DYNAMIC to compute load address, which works with static
    PIE.  We just need to return 0 if _DYNAMIC is undefined for static
    executable.
    
    	* sysdeps/microblaze/dl-machine.h (elf_machine_load_address):
    	Return 0 if _DYNAMIC is undefined for static executable.

diff --git a/sysdeps/microblaze/dl-machine.h b/sysdeps/microblaze/dl-machine.h
index 9481ff1..c416cdb 100644
--- a/sysdeps/microblaze/dl-machine.h
+++ b/sysdeps/microblaze/dl-machine.h
@@ -57,6 +57,11 @@ elf_machine_load_address (void)
      by a GOTOFF reference, and the link-time address found in the special
      unrelocated first GOT entry.  */
 
+#ifndef SHARED
+  extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+#endif
   Elf32_Addr dyn;
   __asm__ __volatile__ (
     "addik %0,r20,_DYNAMIC@GOTOFF"

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

commit a4b207d2a8516804209204e79fb3c515cb6932b9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:46:26 2017 -0700

    m68k: Update elf_machine_load_address for static PIE
    
    When --enable-static-pie is used to configure glibc, we need to use
    _dl_relocate_static_pie to compute load address in static PIE.
    
    	* sysdeps/m68k/dl-machine.h (elf_machine_load_address): Use
    	_dl_relocate_static_pie instead of _dl_start to compute load
    	address in static PIE.  Return 0 if _DYNAMIC is undefined for
    	static executable.

diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index fd8fb00..a9a1900 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -51,9 +51,18 @@ static inline Elf32_Addr
 elf_machine_load_address (void)
 {
   Elf32_Addr addr;
+#ifdef SHARED
   asm (PCREL_OP ("lea", "_dl_start", "%0", "%0", "%%pc") "\n\t"
        "sub.l _dl_start@GOT.w(%%a5), %0"
        : "=a" (addr));
+#else
+  extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+  asm (PCREL_OP ("lea", "_dl_relocate_static_pie", "%0", "%0", "%%pc") "\n\t"
+       "sub.l _dl_relocate_static_pie@GOT.w(%%a5), %0"
+       : "=a" (addr));
+#endif
   return addr;
 }
 

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

commit bf10de53783a770b0e1706541df3de6ca58b175f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:44:46 2017 -0700

    ia64: Update elf_machine_load_address for static PIE
    
    ia64 uses a local label to compute load address, which works with static
    PIE.  We just need to return 0 if _DYNAMIC is undefined for static
    executable.
    
    	* sysdeps/ia64/dl-machine.h (elf_machine_dynamic): Return 0 if
    	_DYNAMIC is undefined for static executable.

diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h
index b56f1c8..76675e2 100644
--- a/sysdeps/ia64/dl-machine.h
+++ b/sysdeps/ia64/dl-machine.h
@@ -79,6 +79,11 @@ elf_machine_dynamic (void)
 static inline Elf64_Addr __attribute__ ((unused))
 elf_machine_load_address (void)
 {
+#ifndef SHARED
+  extern Elf64_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+#endif
   Elf64_Addr ip;
   int *p;
 

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

commit 357a9c0b0f901a7672cb45073f16fe324e190a68
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:42:18 2017 -0700

    hppa: Update elf_machine_load_address for static PIE
    
    hppa uses _DYNAMIC to compute load address, which works with static PIE.
    We just need to return 0 if _DYNAMIC is undefined for static executable.
    
    	* sysdeps/hppa/dl-machine.h (elf_machine_load_address): Return 0
    	if _DYNAMIC is undefined for static executable.

diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h
index acfb9fc..02af505 100644
--- a/sysdeps/hppa/dl-machine.h
+++ b/sysdeps/hppa/dl-machine.h
@@ -97,6 +97,11 @@ elf_machine_load_address (void) __attribute__ ((const));
 static inline Elf32_Addr
 elf_machine_load_address (void)
 {
+#ifndef SHARED
+  extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+#endif
   Elf32_Addr dynamic;
 
   asm (

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

commit dab877ccc5a766e74eb67fb9a9c65258496bae92
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Sep 28 14:36:33 2017 -0700

    aarch64: Update elf_machine_load_address for static PIE
    
    When --enable-static-pie is used to configure glibc, we need to use
    _dl_relocate_static_pie to compute load address in static PIE.
    
    	* sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Use
    	_dl_relocate_static_pie instead of _dl_start to compute load
    	address in static PIE.  Return 0 if _DYNAMIC is undefined for
    	static executable.

diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 6047203..6f259f1 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -61,6 +61,7 @@ elf_machine_load_address (void)
   ElfW(Addr) static_addr;
   ElfW(Addr) dynamic_addr;
 
+#ifdef SHARED
   asm ("					\n"
 "	adrp	%1, _dl_start;			\n"
 #ifdef __LP64__
@@ -84,6 +85,34 @@ elf_machine_load_address (void)
 #endif
 "2:						\n"
     : "=r" (static_addr),  "=r" (dynamic_addr));
+#else
+  extern ElfW(Dyn) _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+  if (!_DYNAMIC)
+    return 0;
+  asm ("						\n"
+"	adrp	%1, _dl_relocate_static_pie;		\n"
+#ifdef __LP64__
+"	add	%1, %1, #:lo12:_dl_relocate_static_pie	\n"
+#else
+"	add	%w1, %w1, #:lo12:_dl_relocate_static_pie\n"
+#endif
+"	ldr	%w0, 1f					\n"
+"	b	2f					\n"
+"1:							\n"
+#ifdef __LP64__
+"	.word	_dl_relocate_static_pie			\n"
+#else
+# ifdef __AARCH64EB__
+"	.short  0                               	\n"
+# endif
+"	.short  _dl_relocate_static_pie                 \n"
+# ifndef __AARCH64EB__
+"	.short  0                               	\n"
+# endif
+#endif
+"2:						\n"
+    : "=r" (static_addr),  "=r" (dynamic_addr));
+#endif
   return dynamic_addr - static_addr;
 }
 

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

commit 16c4bc96bd9b7d72c3385239d0b3557bcf6ca8ef
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 22 15:37:10 2017 -0700

    Don't use hidden visibility in libc.a with PIE on i386
    
    On i386, when multi-arch is enabled, all external functions must be
    called via PIC PLT in PIE, which requires setting up EBX register,
    since they may be IFUNC functions.
    
    	* config.h.in (NO_HIDDEN_EXTERN_FUNC_IN_PIE): New.
    	* include/libc-symbols.h (__hidden_proto_hiddenattr): Add check
    	for PIC and NO_HIDDEN_EXTERN_FUNC_IN_PIE.
    	* sysdeps/i386/configure.ac (NO_HIDDEN_EXTERN_FUNC_IN_PIE): New
    	AC_DEFINE if multi-arch is enabled.
    	* sysdeps/i386/configure: Regenerated.

diff --git a/config.h.in b/config.h.in
index 26ed786..d397eea 100644
--- a/config.h.in
+++ b/config.h.in
@@ -86,6 +86,10 @@
 #undef	PI_STATIC_AND_HIDDEN
 
 /* Define this to disable the 'hidden_proto' et al macros in
+   include/libc-symbols.h that avoid PLT slots in PIE.  */
+#undef  NO_HIDDEN_EXTERN_FUNC_IN_PIE
+
+/* Define this to disable the 'hidden_proto' et al macros in
    include/libc-symbols.h that avoid PLT slots in the shared objects.  */
 #undef	NO_HIDDEN
 
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 10fd206..3881a2b 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -507,6 +507,7 @@ for linking")
 #else
 # ifndef __ASSEMBLER__
 #  if !defined SHARED && IS_IN (libc) && !defined LIBC_NONSHARED \
+      && (!defined PIC || !defined NO_HIDDEN_EXTERN_FUNC_IN_PIE) \
       && !defined NO_HIDDEN
 #   define __hidden_proto_hiddenattr(attrs...) \
   __attribute__ ((visibility ("hidden"), ##attrs))
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index 4d6685f..4cf968d 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -26,7 +26,7 @@ libc_compiler_builtin_inlined=no
 cat > conftest.c <<EOF
 int _start (void) { int a, b, c; __sync_val_compare_and_swap (&a, b, c); return 0; }
 EOF
-if ! { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+if ! { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
 		     -O0 -nostdlib -nostartfiles
 		     -S conftest.c -o - | fgrep "__sync_val_compare_and_swap"
 		     1>&5'
@@ -79,3 +79,8 @@ fi
 
 $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
 
+
+if test x"$multi_arch" != xno; then
+  $as_echo "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
+
+fi
diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac
index f7766ad..b598b12 100644
--- a/sysdeps/i386/configure.ac
+++ b/sysdeps/i386/configure.ac
@@ -48,3 +48,9 @@ fi
 dnl It is always possible to access static and hidden symbols in an
 dnl position independent way.
 AC_DEFINE(PI_STATIC_AND_HIDDEN)
+
+dnl When multi-arch is enabled, all external functions must be called
+dnl via PIC PLT in PIE, which requires setting up EBX register.
+if test x"$multi_arch" != xno; then
+  AC_DEFINE(NO_HIDDEN_EXTERN_FUNC_IN_PIE)
+fi

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

commit 26953cdecfd73b63352e1acd349671b4dbf4ec90
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 17 08:17:32 2017 -0700

    Add --enable-static-pie configure option to build static PIE
    
    Dynamic linker, ld.so, is a standalone program which can be loaded at
    any address.  This patch adds a configure option, --enable-static-pie,
    to embed the part of ld.so in static executable to create static position
    independent executable (static PIE).  A static PIE is similar to static
    executable, but can be loaded at any address without help from a dynamic
    linker.  When --enable-static-pie is used to configure glibc, libc.a is
    built as PIE and all static executables, including tests, are built as
    static PIE.  The resulting libc.a can be used together with GCC 8 or
    above to build static PIE with the compiler option, -static-pie.  But
    GCC 8 isn't required to build glibc with --enable-static-pie.  When an
    older GCC is used to build glibc with --enable-static-pie, proper input
    files are passed to linker to create static executables as static PIE,
    together with "-z text" to prevent dynamic relocations in read-only
    segments, which are allowed in static PIE.
    
    Static PIE can work on all architectures which support PIE, provided
    
    1. start.S is updated to check PIC instead SHARED for PIC code path and
    avoid dynamic relocation, when PIC is defined and SHARED isn't defined,
    to support static PIE.  Patches are submitted for aarch64, arm, hppa,
    m68k, microblaze and sparc.
    2. All assembly codes are updated check PIC instead SHARED for PIC code
    path to avoid dynamic relocations in read-only sections.
    3. All assembly codes are updated check SHARED instead PIC for static
    symbol name.  A patch is submitted for tile.
    4. elf_machine_load_address in dl-machine.h are updated to support static
    PIE.  Patches are submitted for aarch64, arm, hppa, ia64, m68k, microblaze,
    mips, nios2, powerpc, s390, sh, sparc and tile.
    
    NB: When glibc is built with GCC defaulted to PIE, libc.a is compiled
    with -fPIE, regardless if --enable-static-pie is used to configure glibc.
    When glibc is configured with --enable-static-pie, libc.a is compiled
    with -fPIE, regardless wether GCC defaults to PIE or not.  The same libc.a
    can be used to build both static executable and static PIE.  There is no
    need for separate PIE copy of libc.a.
    
    Linker requirements to build glibc with --enable-static-pie:
    
    1. Linker supports --no-dynamic-linker to remove PT_INTERP segment from
    static PIE.
    2. Linker can create working static PIE.  The x86-64 linker needs the
    fix for
    
    https://sourceware.org/bugzilla/show_bug.cgi?id=21782
    
    Binutils 2.29 or above are OK for x86-64.  But linker status for other
    targets need to be verified.
    
    Tested on i686 and x86-64.
    
    Build results of build-many-glibcs.py with --enable-static-pie with all
    patches for static PIE applied are
    
    PASS: glibcs-aarch64_be-linux-gnu build
    PASS: glibcs-aarch64-linux-gnu build
    PASS: glibcs-armeb-linux-gnueabi build
    PASS: glibcs-armeb-linux-gnueabi-be8 build
    PASS: glibcs-armeb-linux-gnueabihf build
    PASS: glibcs-armeb-linux-gnueabihf-be8 build
    PASS: glibcs-arm-linux-gnueabi build
    PASS: glibcs-arm-linux-gnueabihf build
    PASS: glibcs-hppa-linux-gnu build
    PASS: glibcs-i486-linux-gnu build
    PASS: glibcs-i586-linux-gnu build
    PASS: glibcs-i686-linux-gnu build
    PASS: glibcs-i686-linux-gnu-disable-multi-arch build
    PASS: glibcs-m68k-linux-gnu build
    PASS: glibcs-microblazeel-linux-gnu build
    PASS: glibcs-microblaze-linux-gnu build
    PASS: glibcs-mips64el-linux-gnu-n64 build
    PASS: glibcs-mips64el-linux-gnu-n64-nan2008 build
    PASS: glibcs-mips64el-linux-gnu-n64-nan2008-soft build
    PASS: glibcs-mips64el-linux-gnu-n64-soft build
    PASS: glibcs-mips64-linux-gnu-n64 build
    PASS: glibcs-mips64-linux-gnu-n64-nan2008 build
    PASS: glibcs-mips64-linux-gnu-n64-nan2008-soft build
    PASS: glibcs-mips64-linux-gnu-n64-soft build
    PASS: glibcs-nios2-linux-gnu build
    PASS: glibcs-powerpc64le-linux-gnu build
    PASS: glibcs-powerpc64-linux-gnu build
    PASS: glibcs-s390x-linux-gnu build
    PASS: glibcs-x86_64-linux-gnu build
    PASS: glibcs-x86_64-linux-gnu-disable-multi-arch build
    PASS: glibcs-x86_64-linux-gnu-x32 build
    
    FAIL: glibcs-alpha-linux-gnu build
    
    elf/sln is failed to link due to:
    
    assertion fail bfd/elf64-alpha.c:4125
    
    This is caused by linker bug and/or non-PIC code in PIE libc.a.
    
    FAIL: glibcs-ia64-linux-gnu build
    
    elf/sln is failed to link due to:
    
    libc.a(sched_yield.o): non-pic code with imm relocation against dynamic symbol `_dl_sysinfo'
    
    This is caused by non-PIC version of DO_CALL macro in ia64 sysdep.h.  PIE
    libc.a should use PIC version of DO_CALL, except during startup in static
    PIE.  An ia64 startup.h, similar to i386 startup.h, is needed to handle
    this.
    
    FAIL: glibcs-mips64el-linux-gnu-n32 build
    FAIL: glibcs-mips64el-linux-gnu-n32-nan2008 build
    FAIL: glibcs-mips64el-linux-gnu-n32-nan2008-soft build
    FAIL: glibcs-mips64el-linux-gnu-n32-soft build
    FAIL: glibcs-mips64-linux-gnu-n32 build
    FAIL: glibcs-mips64-linux-gnu-n32-nan2008 build
    FAIL: glibcs-mips64-linux-gnu-n32-nan2008-soft build
    FAIL: glibcs-mips64-linux-gnu-n32-soft build
    FAIL: glibcs-mipsel-linux-gnu build
    FAIL: glibcs-mipsel-linux-gnu-nan2008 build
    FAIL: glibcs-mipsel-linux-gnu-nan2008-soft build
    FAIL: glibcs-mipsel-linux-gnu-soft build
    FAIL: glibcs-mips-linux-gnu build
    FAIL: glibcs-mips-linux-gnu-nan2008 build
    FAIL: glibcs-mips-linux-gnu-nan2008-soft build
    FAIL: glibcs-mips-linux-gnu-soft build
    
    elf/sln is failed to link due to:
    
    crt1.o: relocation R_MIPS_HI16 against `_gp' can not be used when making a shared object; recompile with -fPIC
    
    This is caused by linker bug and/or non-PIC code in crt1.o.
    
    FAIL: glibcs-powerpc-linux-gnu build
    FAIL: glibcs-powerpc-linux-gnu-soft build
    FAIL: glibcs-powerpc-linux-gnuspe build
    FAIL: glibcs-powerpc-linux-gnuspe-e500v1 build
    
    elf/sln is failed to link due to:
    
    ld: read-only segment has dynamic relocations.
    
    This is caused by linker bug and/or non-PIC code in PIE libc.a.
    
    FAIL: glibcs-powerpc-linux-gnu-power4 build
    
    elf/sln is failed to link due to:
    
    findlocale.c:96:(.text+0x22c): @local call to ifunc memchr
    
    This is caused by linker bug and/or non-PIC code in PIE libc.a.
    
    FAIL: glibcs-s390-linux-gnu build
    
    elf/sln is failed to link due to:
    
    collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped
    
    assertion fail bfd/elflink.c:14242
    
    This is caused by linker bug and/or non-PIC code in PIE libc.a.
    
    FAIL: glibcs-sh3eb-linux-gnu build
    FAIL: glibcs-sh3-linux-gnu build
    FAIL: glibcs-sh4eb-linux-gnu build
    FAIL: glibcs-sh4eb-linux-gnu-soft build
    FAIL: glibcs-sh4-linux-gnu build
    FAIL: glibcs-sh4-linux-gnu-soft build
    
    elf/sln is failed to link due to:
    
    ld: read-only segment has dynamic relocations.
    
    This is caused by linker bug and/or non-PIC code in PIE libc.a.
    
    FAIL: glibcs-sparc64-linux-gnu build
    FAIL: glibcs-sparcv9-linux-gnu build
    
    elf/sln is failed to link due to:
    
    ld: read-only segment has dynamic relocations.
    
    This is caused by linker bug and/or non-PIC code in PIE libc.a.
    
    FAIL: glibcs-tilegxbe-linux-gnu build
    FAIL: glibcs-tilegxbe-linux-gnu-32 build
    FAIL: glibcs-tilegx-linux-gnu build
    FAIL: glibcs-tilegx-linux-gnu-32 build
    FAIL: glibcs-tilepro-linux-gnu build
    
    elf/sln is failed to link due to:
    
    ld: read-only segment has dynamic relocations.
    
    This is caused by linker bug and/or non-PIC code in PIE libc.a.
    
    	* INSTALL: Regenerated.
    	* Makeconfig (pic-default): Updated for --enable-static-pie.
    	(pie-default): New for --enable-static-pie.
    	(default-pie-ldflag): Likewise.
    	(+link-static-before-libc): Add $(default-pie-ldflag).
    	(+prectorT): Updated for --enable-static-pie.
    	(+postctorT): Likewise.
    	(CFLAGS-.o): Add $(pie-default).
    	(CFLAGS-.op): Likewise.
    	* NEWS: Mention --enable-static-pie.
    	* config.h.in (ENABLE_STATIC_PIE): New.
    	* configure.ac (--enable-static-pie): New configure option.
    	(have-no-dynamic-linker): New LIBC_CONFIG_VAR.
    	(have-static-pie): Likewise.
    	Enable static PIE if linker supports --no-dynamic-linker.
    	(ENABLE_STATIC_PIE): New AC_DEFINE.
    	(enable-static-pie): New LIBC_CONFIG_VAR.
    	* configure: Regenerated.
    	* csu/libc-start.c (LIBC_START_MAIN): Call _dl_relocate_static_pie
    	in libc.a.
    	* csu/libc-tls.c (__libc_setup_tls): Add main_map->l_addr to
    	initimage.
    	* elf/dl-support.c: Include "dynamic-link.h" and don't include
    	"get-dynamic-info.h" for --enable-static-pie.
    	(_dl_relocate_static_pie): New function for --enable-static-pie.
    	(STATIC_PIE_BOOTSTRAP): New for --enable-static-pie.
    	(BOOTSTRAP_MAP): Likewise.
    	(RESOLVE_MAP): Likewise.
    	* elf/dynamic-link.h (ELF_DURING_STARTUP): Also check
    	STATIC_PIE_BOOTSTRAP.
    	* elf/get-dynamic-info.h (elf_get_dynamic_info): Likewise.
    	* manual/install.texi: Document --enable-static-pie.
    	* sysdeps/generic/ldsodefs.h (_dl_relocate_static_pie): New.
    	* sysdeps/x86_64/configure.ac: Check if linker supports static PIE.
    	* sysdeps/x86_64/configure: Regenerated.

diff --git a/INSTALL b/INSTALL
index 4d9024c..55361a0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -106,6 +106,14 @@ will be used, and CFLAGS sets optimization options for the compiler.
      systems support shared libraries; you need ELF support and
      (currently) the GNU linker.
 
+'--enable-static-pie'
+     Build static executables, including tests, as position independent
+     executable (static PIE) which is similar to static executable, but
+     can be loaded at any address without help from a dynamic linker.
+     The resulting libc.a can be used with the GCC option, -static-pie,
+     which is available with GCC 8 or above, to create static PIE. Only
+     i686, x86-64 and x32 targets are verified to work.
+
 '--disable-profile'
      Don't build libraries with profiling information.  You may want to
      use this option if you don't plan to do profiling.
diff --git a/Makeconfig b/Makeconfig
index b51904b..b45209f 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -386,6 +386,16 @@ LDFLAGS.so += $(hashstyle-LDFLAGS)
 LDFLAGS-rtld += $(hashstyle-LDFLAGS)
 endif
 
+ifeq (yes,$(enable-static-pie))
+pic-default = -DPIC
+pie-default = $(pie-ccflag)
+ifeq (yes,$(have-static-pie))
+default-pie-ldflag = -static-pie
+else
+default-pie-ldflag = -Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
+endif
+endif
+
 # If lazy relocations are disabled, add the -z now flag.  Use
 # LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to
 # test modules.
@@ -435,6 +445,7 @@ endif
 # Command for statically linking programs with the C library.
 ifndef +link-static
 +link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \
+	      $(default-pie-ldflag) \
 	      $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F))  \
 	      $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
 	      $(+preinit) $(+prectorT) \
@@ -651,8 +662,13 @@ endif
 +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
 +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
 # Variants of the two previous definitions for statically linking programs.
+ifeq (yes,$(enable-static-pie))
++prectorT = $(+prectorS)
++postctorT = $(+postctorS)
+else
 +prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
 +postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
+endif
 csu-objpfx = $(common-objpfx)csu/
 elf-objpfx = $(common-objpfx)elf/
 
@@ -973,7 +989,7 @@ libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
 all-object-suffixes := .o .os .oS
 object-suffixes :=
 CPPFLAGS-.o = $(pic-default)
-CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
+CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) $(pie-default)
 libtype.o := lib%.a
 object-suffixes += .o
 ifeq (yes,$(build-shared))
@@ -998,7 +1014,7 @@ ifeq (yes,$(build-profile))
 all-object-suffixes += .op
 object-suffixes += .op
 CPPFLAGS-.op = -DPROF $(pic-default)
-CFLAGS-.op = -pg
+CFLAGS-.op = -pg $(pie-default)
 libtype.op = lib%_p.a
 endif
 
diff --git a/NEWS b/NEWS
index f582141..60f5def 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,12 @@ Version 2.27
 
 Major new features:
 
+* Add --enable-static-pie configure option to build static PIE.  The
+  resulting libc.a can be used with the GCC option, -static-pie, which
+  is available with GCC 8 or above, to create static position independent
+  executable (static PIE).  Only i686, x86-64 and x32 targets are verified
+  to work.
+
 * Optimized x86-64 asin, atan2, exp, expf, log, pow, atan, sin and tan
   with FMA, contributed by Arjan van de Ven and H.J. Lu from Intel.
 
diff --git a/config.h.in b/config.h.in
index 014fb4e..26ed786 100644
--- a/config.h.in
+++ b/config.h.in
@@ -236,6 +236,9 @@
 /* Build glibc with tunables support.  */
 #define HAVE_TUNABLES 0
 
+/* Define if static PIE is enabled.  */
+#define ENABLE_STATIC_PIE 0
+
 /* Some compiler options may now allow to use ebp in __asm__ (used mainly
    in i386 6 argument syscall issue).  */
 #define CAN_USE_REGISTER_ASM_EBP 0
diff --git a/configure b/configure
index 067d92d..cd5cf57 100755
--- a/configure
+++ b/configure
@@ -767,6 +767,7 @@ with_default_link
 enable_sanity_checks
 enable_shared
 enable_profile
+enable_static_pie
 enable_timezone_tools
 enable_hardcoded_path_in_tests
 enable_stackguard_randomization
@@ -1424,6 +1425,7 @@ Optional Features:
                           in special situations) [default=yes]
   --enable-shared         build shared library [default=yes if GNU ld]
   --enable-profile        build profiled library [default=no]
+  --enable-static-pie     build static executables as PIE [default=no]
   --disable-timezone-tools
                           do not install timezone tools [default=install]
   --enable-hardcoded-path-in-tests
@@ -3372,6 +3374,13 @@ else
   profile=no
 fi
 
+# Check whether --enable-static-pie was given.
+if test "${enable_static_pie+set}" = set; then :
+  enableval=$enable_static_pie; static_pie=$enableval
+else
+  static_pie=no
+fi
+
 # Check whether --enable-timezone-tools was given.
 if test "${enable_timezone_tools+set}" = set; then :
   enableval=$enable_timezone_tools; enable_timezone_tools=$enableval
@@ -5994,6 +6003,62 @@ fi
 $as_echo "$libc_linker_feature" >&6; }
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-dynamic-linker" >&5
+$as_echo_n "checking for linker that supports --no-dynamic-linker... " >&6; }
+libc_linker_feature=no
+if test x"$gnu_ld" = x"yes"; then
+  libc_linker_check=`$LD -v --help 2>/dev/null | grep "\--no-dynamic-linker"`
+  if test -n "$libc_linker_check"; then
+    cat > conftest.c <<EOF
+int _start (void) { return 42; }
+EOF
+    if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
+				-Wl,--no-dynamic-linker -nostdlib -nostartfiles
+				-fPIC -shared -o conftest.so conftest.c
+				1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+    then
+      libc_linker_feature=yes
+    fi
+    rm -f conftest*
+  fi
+fi
+if test $libc_linker_feature = yes; then
+  libc_cv_no_dynamic_linker=yes
+else
+  libc_cv_no_dynamic_linker=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
+$as_echo "$libc_linker_feature" >&6; }
+config_vars="$config_vars
+have-no-dynamic-linker = $libc_cv_no_dynamic_linker"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -static-pie" >&5
+$as_echo_n "checking for -static-pie... " >&6; }
+if ${libc_cv_static_pie+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -static-pie -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_static_pie=yes
+else
+  libc_cv_static_pie=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_static_pie" >&5
+$as_echo "$libc_cv_static_pie" >&6; }
+config_vars="$config_vars
+have-static-pie = $libc_cv_static_pie"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fpie" >&5
 $as_echo_n "checking for -fpie... " >&6; }
 if ${libc_cv_fpie+:} false; then :
@@ -6888,6 +6953,19 @@ fi
 $as_echo "$libc_cv_pie_default" >&6; }
 
 
+if test "$static_pie" = yes; then
+  # The linker must support --no-dynamic-linker.
+  if test "$libc_cv_no_dynamic_linker" != yes; then
+    as_fn_error $? "linker support for --no-dynamic-linker needed" "$LINENO" 5
+  fi
+  # Default to PIE.
+  libc_cv_pie_default=yes
+  $as_echo "#define ENABLE_STATIC_PIE 1" >>confdefs.h
+
+fi
+config_vars="$config_vars
+enable-static-pie = $static_pie"
+
 
 
 
diff --git a/configure.ac b/configure.ac
index d412104..09e1c7f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,6 +176,11 @@ AC_ARG_ENABLE([profile],
 			     [build profiled library @<:@default=no@:>@]),
 	      [profile=$enableval],
 	      [profile=no])
+AC_ARG_ENABLE([static-pie],
+	      AC_HELP_STRING([--enable-static-pie],
+			     [build static executables as PIE @<:@default=no@:>@]),
+	      [static_pie=$enableval],
+	      [static_pie=no])
 AC_ARG_ENABLE([timezone-tools],
 	      AC_HELP_STRING([--disable-timezone-tools],
 			     [do not install timezone tools @<:@default=install@:>@]),
@@ -1460,6 +1465,19 @@ LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
 		    [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
 AC_SUBST(libc_cv_z_execstack)
 
+LIBC_LINKER_FEATURE([--no-dynamic-linker],
+		    [-Wl,--no-dynamic-linker],
+		    [libc_cv_no_dynamic_linker=yes],
+		    [libc_cv_no_dynamic_linker=no])
+LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
+
+AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
+LIBC_TRY_CC_OPTION([-static-pie],
+		   [libc_cv_static_pie=yes],
+		   [libc_cv_static_pie=no])
+])
+LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
+
 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
 ])
@@ -1962,6 +1980,17 @@ fi
 rm -f conftest.*])
 AC_SUBST(libc_cv_pie_default)
 
+if test "$static_pie" = yes; then
+  # The linker must support --no-dynamic-linker.
+  if test "$libc_cv_no_dynamic_linker" != yes; then
+    AC_MSG_ERROR([linker support for --no-dynamic-linker needed])
+  fi
+  # Default to PIE.
+  libc_cv_pie_default=yes
+  AC_DEFINE(ENABLE_STATIC_PIE)
+fi
+LIBC_CONFIG_VAR([enable-static-pie], [$static_pie])
+
 AC_SUBST(profile)
 AC_SUBST(static_nss)
 
diff --git a/csu/libc-start.c b/csu/libc-start.c
index 24c63be..34dd125 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -141,6 +141,8 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
   __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;
 
 #ifndef SHARED
+  _dl_relocate_static_pie ();
+
   char **ev = &argv[argc + 1];
 
   __environ = ev;
diff --git a/csu/libc-tls.c b/csu/libc-tls.c
index 00138eb..1f8ddaf 100644
--- a/csu/libc-tls.c
+++ b/csu/libc-tls.c
@@ -114,6 +114,8 @@ __libc_setup_tls (void)
   size_t tcb_offset;
   const ElfW(Phdr) *phdr;
 
+  struct link_map *main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
+
   /* Look through the TLS segment if there is any.  */
   if (_dl_phdr != NULL)
     for (phdr = _dl_phdr; phdr < &_dl_phdr[_dl_phnum]; ++phdr)
@@ -122,7 +124,7 @@ __libc_setup_tls (void)
 	  /* Remember the values we need.  */
 	  memsz = phdr->p_memsz;
 	  filesz = phdr->p_filesz;
-	  initimage = (void *) phdr->p_vaddr;
+	  initimage = (void *) phdr->p_vaddr + main_map->l_addr;
 	  align = phdr->p_align;
 	  if (phdr->p_align > max_align)
 	    max_align = phdr->p_align;
@@ -163,8 +165,6 @@ __libc_setup_tls (void)
   _dl_static_dtv[0].counter = (sizeof (_dl_static_dtv) / sizeof (_dl_static_dtv[0])) - 2;
   // _dl_static_dtv[1].counter = 0;		would be needed if not already done
 
-  struct link_map *main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
-
   /* Initialize the TLS block.  */
 #if TLS_TCB_AT_TP
   _dl_static_dtv[2].pointer.val = ((char *) tlsblock + tcb_offset
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 5e3de90..150ec00 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -26,7 +26,11 @@
 #include <sys/param.h>
 #include <stdint.h>
 #include <ldsodefs.h>
-#include <dl-machine.h>
+#if ENABLE_STATIC_PIE
+# include "dynamic-link.h"
+#else
+# include <dl-machine.h>
+#endif
 #include <libc-lock.h>
 #include <dl-cache.h>
 #include <dl-librecon.h>
@@ -199,7 +203,9 @@ const ElfW(Ehdr) *_dl_sysinfo_dso;
 
 struct link_map *_dl_sysinfo_map;
 
-# include "get-dynamic-info.h"
+# if !ENABLE_STATIC_PIE
+#  include "get-dynamic-info.h"
+# endif
 #endif
 #include "setup-vdso.h"
 
@@ -302,6 +308,40 @@ _dl_aux_init (ElfW(auxv_t) *av)
 }
 #endif
 
+#if ENABLE_STATIC_PIE
+/* Relocate static executable with PIE.  */
+
+void
+_dl_relocate_static_pie (void)
+{
+# define STATIC_PIE_BOOTSTRAP
+# define BOOTSTRAP_MAP (&_dl_main_map)
+# define RESOLVE_MAP(sym, version, flags) BOOTSTRAP_MAP
+# include "dynamic-link.h"
+
+  /* Figure out the run-time load addres of static PIE.  */
+  _dl_main_map.l_addr = elf_machine_load_address ();
+
+  /* Skip if this is a non-PIE static executable.  */
+  if (!_dl_main_map.l_addr)
+    return;
+
+  /* Read our own dynamic section and fill in the info array.  */
+  _dl_main_map.l_ld = ((void *) _dl_main_map.l_addr
+		       + elf_machine_dynamic ());
+  elf_get_dynamic_info (&_dl_main_map, NULL);
+
+# ifdef ELF_MACHINE_BEFORE_RTLD_RELOC
+  ELF_MACHINE_BEFORE_RTLD_RELOC (_dl_main_map.l_info);
+# endif
+
+  /* Relocate ourselves so we can do normal function calls and
+     data access using the global offset table.  */
+  ELF_DYNAMIC_RELOCATE (&_dl_main_map, 0, 0, 0);
+  _dl_main_map.l_relocated = 1;
+}
+#endif
+
 
 void
 _dl_non_dynamic_init (void)
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index ebea756..6278649 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -94,7 +94,7 @@ elf_machine_lazy_rel (struct link_map *map,
 
 #ifdef RESOLVE_MAP
 
-# ifdef RTLD_BOOTSTRAP
+# if defined RTLD_BOOTSTRAP || defined STATIC_PIE_BOOTSTRAP
 #  define ELF_DURING_STARTUP (1)
 # else
 #  define ELF_DURING_STARTUP (0)
diff --git a/elf/get-dynamic-info.h b/elf/get-dynamic-info.h
index 7525c3a..eb26d23 100644
--- a/elf/get-dynamic-info.h
+++ b/elf/get-dynamic-info.h
@@ -38,7 +38,7 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
   typedef Elf64_Xword d_tag_utype;
 #endif
 
-#ifndef RTLD_BOOTSTRAP
+#if !defined RTLD_BOOTSTRAP && !defined STATIC_PIE_BOOTSTRAP
   if (dyn == NULL)
     return;
 #endif
@@ -139,9 +139,11 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
   /* Only the bind now flags are allowed.  */
   assert (info[VERSYMIDX (DT_FLAGS_1)] == NULL
 	  || (info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val & ~DF_1_NOW) == 0);
+  /* Flags must not be set for ld.so.  */
   assert (info[DT_FLAGS] == NULL
 	  || (info[DT_FLAGS]->d_un.d_val & ~DF_BIND_NOW) == 0);
-  /* Flags must not be set for ld.so.  */
+#endif
+#if defined RTLD_BOOTSTRAP || defined STATIC_PIE_BOOTSTRAP
   assert (info[DT_RUNPATH] == NULL);
   assert (info[DT_RPATH] == NULL);
 #else
diff --git a/manual/install.texi b/manual/install.texi
index 35948b1..54df6ab 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -136,6 +136,14 @@ Don't build shared libraries even if it is possible.  Not all systems
 support shared libraries; you need ELF support and (currently) the GNU
 linker.
 
+@item --enable-static-pie
+Build static executables, including tests, as position independent
+executable (static PIE) which is similar to static executable, but can
+be loaded at any address without help from a dynamic linker.  The
+resulting libc.a can be used with the GCC option, -static-pie, which
+is available with GCC 8 or above, to create static PIE.  Only i686, x86-64
+and x32 targets are verified to work.
+
 @item --disable-profile
 Don't build libraries with profiling information.  You may want to use
 this option if you don't plan to do profiling.
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 5efae2d..dbcc1ec 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1048,6 +1048,13 @@ extern void _dl_determine_tlsoffset (void) attribute_hidden;
    stack protector, among other things).  */
 void __libc_setup_tls (void);
 
+# if ENABLE_STATIC_PIE
+/* Relocate static executable with PIE.  */
+void _dl_relocate_static_pie (void) attribute_hidden;
+# else
+#  define _dl_relocate_static_pie()
+# endif
+
 /* Initialization of libpthread for statically linked applications.
    If libpthread is not linked in, this is an empty function.  */
 void __pthread_initialize_minimal (void) weak_function;
diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
index efef46b..8ee15b8 100644
--- a/sysdeps/x86_64/configure
+++ b/sysdeps/x86_64/configure
@@ -85,6 +85,39 @@ if test x"$build_mathvec" = xnotset; then
   build_mathvec=yes
 fi
 
+if test "$static_pie" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker static PIE support" >&5
+$as_echo_n "checking for linker static PIE support... " >&6; }
+if ${libc_cv_ld_static_pie+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.s <<\EOF
+	.text
+	.global _start
+	.weak foo
+_start:
+	leaq	foo(%rip), %rax
+EOF
+  libc_cv_pie_option="-Wl,-pie"
+  if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp $libc_cv_pie_option conftest.s 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    libc_cv_ld_static_pie=yes
+  else
+    libc_cv_ld_static_pie=no
+  fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ld_static_pie" >&5
+$as_echo "$libc_cv_ld_static_pie" >&6; }
+  if test "$libc_cv_ld_static_pie" != yes; then
+    as_fn_error $? "linker support for static PIE needed" "$LINENO" 5
+  fi
+fi
+
 $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
 
 
diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
index fa86e95..53e4a82 100644
--- a/sysdeps/x86_64/configure.ac
+++ b/sysdeps/x86_64/configure.ac
@@ -44,6 +44,31 @@ if test x"$build_mathvec" = xnotset; then
   build_mathvec=yes
 fi
 
+dnl Check if linker supports static PIE with the fix for
+dnl
+dnl https://sourceware.org/bugzilla/show_bug.cgi?id=21782
+dnl
+if test "$static_pie" = yes; then
+  AC_CACHE_CHECK(for linker static PIE support, libc_cv_ld_static_pie, [dnl
+cat > conftest.s <<\EOF
+	.text
+	.global _start
+	.weak foo
+_start:
+	leaq	foo(%rip), %rax
+EOF
+  libc_cv_pie_option="-Wl,-pie"
+  if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp $libc_cv_pie_option conftest.s 1>&AS_MESSAGE_LOG_FD); then
+    libc_cv_ld_static_pie=yes
+  else
+    libc_cv_ld_static_pie=no
+  fi
+rm -f conftest*])
+  if test "$libc_cv_ld_static_pie" != yes; then
+    AC_MSG_ERROR([linker support for static PIE needed])
+  fi
+fi
+
 dnl It is always possible to access static and hidden symbols in an
 dnl position independent way.
 AC_DEFINE(PI_STATIC_AND_HIDDEN)

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

commit e69fe23f7999b9b2f1f2477b831c043b4412215e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Sep 29 01:09:48 2017 -0700

    ld.so: Replace (&bootstrap_map) with BOOTSTRAP_MAP
    
    (&_dl_main_map) is used instead of (&bootstrap_map) to bootstrap static
    PIE.  Define BOOTSTRAP_MAP with (&_dl_main_map) to avoid hardcode to
    (&bootstrap_map).
    
    	* elf/rtld.c (BOOTSTRAP_MAP): New.
    	(RESOLVE_MAP): Replace (&bootstrap_map) with BOOTSTRAP_MAP.
    	* sysdeps/hppa/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
    	Likewise.
    	* sysdeps/ia64/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
    	Likewise.
    	* sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
    	Likewise.

diff --git a/elf/rtld.c b/elf/rtld.c
index d8e75c0..90505ae 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -454,7 +454,8 @@ _dl_start (void *arg)
      Since ld.so must not have any undefined symbols the result
      is trivial: always the map of ld.so itself.  */
 #define RTLD_BOOTSTRAP
-#define RESOLVE_MAP(sym, version, flags) (&bootstrap_map)
+#define BOOTSTRAP_MAP (&bootstrap_map)
+#define RESOLVE_MAP(sym, version, flags) BOOTSTRAP_MAP
 #include "dynamic-link.h"
 
   if (HP_TIMING_INLINE && HP_SMALL_TIMING_AVAIL)
diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h
index e24bd25..acfb9fc 100644
--- a/sysdeps/hppa/dl-machine.h
+++ b/sysdeps/hppa/dl-machine.h
@@ -62,7 +62,7 @@ __hppa_init_bootstrap_fdesc_table (struct link_map *map)
 }
 
 #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info)		\
-	__hppa_init_bootstrap_fdesc_table (&bootstrap_map);	\
+	__hppa_init_bootstrap_fdesc_table (BOOTSTRAP_MAP);	\
 	_dl_fptr_init();
 
 /* Return nonzero iff ELF header is compatible with the running host.  */
diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h
index 8d0d3c9..b56f1c8 100644
--- a/sysdeps/ia64/dl-machine.h
+++ b/sysdeps/ia64/dl-machine.h
@@ -45,7 +45,7 @@ __ia64_init_bootstrap_fdesc_table (struct link_map *map)
 }
 
 #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info)		\
-	__ia64_init_bootstrap_fdesc_table (&bootstrap_map);
+	__ia64_init_bootstrap_fdesc_table (BOOTSTRAP_MAP);
 
 /* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int __attribute__ ((unused))
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index 8e9f685..b4fee49 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -195,7 +195,7 @@ elf_machine_load_address (void)
    fiddles with global data.  */
 #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info)			\
 do {									\
-  struct link_map *map = &bootstrap_map;				\
+  struct link_map *map = BOOTSTRAP_MAP;					\
   ElfW(Sym) *sym;							\
   ElfW(Addr) *got;							\
   int i, n;								\

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

commit 8369d216dcc0e192e0e1243d9dad443e68f13f06
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:12:08 2017 -0700

    Hide internal __get_sol function [BZ #18822]
    
    Hide internal __get_sol function to allow direct access within libc.so
    and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* sysdeps/unix/sysv/linux/getsourcefilter.c: Include
    	"getsourcefilter.h".
    	* sysdeps/unix/sysv/linux/getsourcefilter.h: New file.
    	* sysdeps/unix/sysv/linux/setsourcefilter.c: Include
    	"getsourcefilter.h".
    	(__get_sol): Removed.

diff --git a/ChangeLog b/ChangeLog
index 33177f2..e5edb86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* sysdeps/unix/sysv/linux/getsourcefilter.c: Include
+	"getsourcefilter.h".
+	* sysdeps/unix/sysv/linux/getsourcefilter.h: New file.
+	* sysdeps/unix/sysv/linux/setsourcefilter.c: Include
+	"getsourcefilter.h".
+	(__get_sol): Removed.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* elf/dl-iteratephdr.c (hidden_proto (__dl_iterate_phdr)): Moved
 	to ...
 	* include/link.h (hidden_proto (__dl_iterate_phdr)): Here.
diff --git a/sysdeps/unix/sysv/linux/getsourcefilter.c b/sysdeps/unix/sysv/linux/getsourcefilter.c
index 806cb16..1465d69 100644
--- a/sysdeps/unix/sysv/linux/getsourcefilter.c
+++ b/sysdeps/unix/sysv/linux/getsourcefilter.c
@@ -31,6 +31,7 @@
 #include <netrose/rose.h>
 #include <sys/param.h>
 #include <sys/socket.h>
+#include "getsourcefilter.h"
 
 
 static const struct
diff --git a/sysdeps/unix/sysv/linux/getsourcefilter.h b/sysdeps/unix/sysv/linux/getsourcefilter.h
new file mode 100644
index 0000000..ac49290
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getsourcefilter.h
@@ -0,0 +1,20 @@
+/* __get_sol function prototype.
+   Copyright (C) 2017 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/>.  */
+
+/* Defined in getsourcefilter.c.  */
+extern int __get_sol (int af, socklen_t len) attribute_hidden;
diff --git a/sysdeps/unix/sysv/linux/setsourcefilter.c b/sysdeps/unix/sysv/linux/setsourcefilter.c
index b4160ff..ade424b 100644
--- a/sysdeps/unix/sysv/linux/setsourcefilter.c
+++ b/sysdeps/unix/sysv/linux/setsourcefilter.c
@@ -24,10 +24,7 @@
 #include <stdint.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
-
-
-/* Defined in getsourcefilter.c.  */
-extern int __get_sol (int af, socklen_t len);
+#include "getsourcefilter.h"
 
 
 int

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

commit a0aef7830eb0698f72129b647be8c00cdf0c7938
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:09:20 2017 -0700

    Move hidden_proto (__dl_iterate_phdr) to include/link.h [BZ #18822]
    
    __dl_iterate_phdr is hidden and should be accessed directly within
    libc.so and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* elf/dl-iteratephdr.c (hidden_proto (__dl_iterate_phdr)): Moved
    	to ...
    	* include/link.h (hidden_proto (__dl_iterate_phdr)): Here.

diff --git a/ChangeLog b/ChangeLog
index 396cf74..33177f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* elf/dl-iteratephdr.c (hidden_proto (__dl_iterate_phdr)): Moved
+	to ...
+	* include/link.h (hidden_proto (__dl_iterate_phdr)): Here.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* sysdeps/unix/sysv/linux/getpt.c (__bsd_getpt): Add
 	attribute_hidden.
 
diff --git a/elf/dl-iteratephdr.c b/elf/dl-iteratephdr.c
index ddd5bde..88473e7 100644
--- a/elf/dl-iteratephdr.c
+++ b/elf/dl-iteratephdr.c
@@ -28,7 +28,6 @@ cancel_handler (void *arg __attribute__((unused)))
   __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
 }
 
-hidden_proto (__dl_iterate_phdr)
 int
 __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
 				    size_t size, void *data), void *data)
diff --git a/include/link.h b/include/link.h
index eeb5f4d..3e1b2ae 100644
--- a/include/link.h
+++ b/include/link.h
@@ -341,6 +341,7 @@ struct link_map
 extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
 					       size_t size, void *data),
 			      void *data);
+hidden_proto (__dl_iterate_phdr)
 
 /* We use this macro to refer to ELF macros independent of the native
    wordsize.  `ELFW(R_TYPE)' is used in place of `ELF32_R_TYPE' or

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

commit 3ee8209be761210dc6a8f121fd79231e7f364a9b
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:08:25 2017 -0700

    Hide internal __bsd_getpt function [BZ #18822]
    
    Hide internal __bsd_getpt function to allow direct access within
    libc.so and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* sysdeps/unix/sysv/linux/getpt.c (__bsd_getpt): Add
    	attribute_hidden.

diff --git a/ChangeLog b/ChangeLog
index 8a09d16..396cf74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* sysdeps/unix/sysv/linux/getpt.c (__bsd_getpt): Add
+	attribute_hidden.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* libio/iolibio.h (__fopen_maybe_mmap): Add attribute_hidden.
 
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
diff --git a/sysdeps/unix/sysv/linux/getpt.c b/sysdeps/unix/sysv/linux/getpt.c
index a92b8f9..da3df47 100644
--- a/sysdeps/unix/sysv/linux/getpt.c
+++ b/sysdeps/unix/sysv/linux/getpt.c
@@ -31,7 +31,7 @@
 #define _PATH_DEVPTS _PATH_DEV "pts"
 
 /* Prototype for function that opens BSD-style master pseudo-terminals.  */
-int __bsd_getpt (void);
+extern int __bsd_getpt (void) attribute_hidden;
 
 /* Open a master pseudo terminal and return its file descriptor.  */
 int

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

commit 6036fc38bf50d61ac5f09a435ce4622b586238ed
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:07:30 2017 -0700

    Hide internal __fopen_maybe_mmap function [BZ #18822]
    
    Hide internal __fopen_maybe_mmap function to allow direct access within
    libc.so and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* libio/iolibio.h (__fopen_maybe_mmap): Add attribute_hidden.

diff --git a/ChangeLog b/ChangeLog
index ccdc1c8..8a09d16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* libio/iolibio.h (__fopen_maybe_mmap): Add attribute_hidden.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/search.h (__tdestroy): Add libc_hidden_proto.
 	* misc/tsearch.c (__tdestroy): Add libc_hidden_def.
 
diff --git a/libio/iolibio.h b/libio/iolibio.h
index 754d8b0..0185e68 100644
--- a/libio/iolibio.h
+++ b/libio/iolibio.h
@@ -25,7 +25,7 @@ extern _IO_FILE *_IO_new_fopen (const char*, const char*);
 extern _IO_FILE *_IO_fopen64 (const char*, const char*);
 extern _IO_FILE *__fopen_internal (const char*, const char*, int)
 	attribute_hidden;
-extern _IO_FILE *__fopen_maybe_mmap (_IO_FILE *) __THROW;
+extern _IO_FILE *__fopen_maybe_mmap (_IO_FILE *) __THROW attribute_hidden;
 extern int _IO_fprintf (_IO_FILE*, const char*, ...);
 extern int _IO_fputs (const char*, _IO_FILE*);
 libc_hidden_proto (_IO_fputs)

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

commit fe84fed04800bc5becb9fba84db98f58007e77f3
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:06:43 2017 -0700

    Hide internal __tdestroy function [BZ #18822]
    
    Hide internal __tdestroy function to allow direct access within libc.so
    and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* include/search.h (__tdestroy): Add libc_hidden_proto.
    	* misc/tsearch.c (__tdestroy): Add libc_hidden_def.

diff --git a/ChangeLog b/ChangeLog
index 2b486b1..ccdc1c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/search.h (__tdestroy): Add libc_hidden_proto.
+	* misc/tsearch.c (__tdestroy): Add libc_hidden_def.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/assert.h (__assert_fail_base): Add attribute_hidden.
 
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
diff --git a/include/search.h b/include/search.h
index a941959..e176930 100644
--- a/include/search.h
+++ b/include/search.h
@@ -24,5 +24,6 @@ libc_hidden_proto (__tdelete)
 extern void __twalk (const void *__root, __action_fn_t action);
 libc_hidden_proto (__twalk)
 extern void __tdestroy (void *__root, __free_fn_t freefct);
+libc_hidden_proto (__tdestroy)
 #endif
 #endif
diff --git a/misc/tsearch.c b/misc/tsearch.c
index aef9c7c..cdc401a 100644
--- a/misc/tsearch.c
+++ b/misc/tsearch.c
@@ -745,4 +745,5 @@ __tdestroy (void *vroot, __free_fn_t freefct)
   if (root != NULL)
     tdestroy_recurse (root, freefct);
 }
+libc_hidden_def (__tdestroy)
 weak_alias (__tdestroy, tdestroy)

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

commit 048dd6813f36c31fa21871d840a0b62f1c3a590f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:06:00 2017 -0700

    Hide internal __assert_fail_base function [BZ #18822]
    
    Hide internal __assert_fail_base function to allow direct access within
    libc.so and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* include/assert.h (__assert_fail_base): Add attribute_hidden.

diff --git a/ChangeLog b/ChangeLog
index 7a6cb4a..2b486b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/assert.h (__assert_fail_base): Add attribute_hidden.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* sysdeps/unix/sysv/linux/include/sys/sysinfo.h (__sysinfo): Add
 	attribute_hidden.
 
diff --git a/include/assert.h b/include/assert.h
index c452667..c0f7e1a 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -18,7 +18,7 @@ extern void __assert_perror_fail (int __errnum, const char *__file,
 extern void __assert_fail_base (const char *fmt, const char *assertion,
 				const char *file, unsigned int line,
 				const char *function)
-     __THROW  __attribute__ ((__noreturn__));
+     __THROW  __attribute__ ((__noreturn__)) attribute_hidden;
 
 # if IS_IN (libc) || IS_IN (rtld)
 hidden_proto (__assert_fail)

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

commit 6e342af6e7399c96246c6174802e84d46a176ffa
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:05:10 2017 -0700

    Hide internal __sysinfo function [BZ #18822]
    
    Hide internal __sysinfo function to allow direct access within libc.so and
    libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* sysdeps/unix/sysv/linux/include/sys/sysinfo.h (__sysinfo): Add
    	attribute_hidden.

diff --git a/ChangeLog b/ChangeLog
index 9397cdf..7a6cb4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* sysdeps/unix/sysv/linux/include/sys/sysinfo.h (__sysinfo): Add
+	attribute_hidden.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/signal.h (__kill): Add libc_hidden_proto.
 	(__sigblock): Likewise.
 	(__sigprocmask): Likewise.
diff --git a/sysdeps/unix/sysv/linux/include/sys/sysinfo.h b/sysdeps/unix/sysv/linux/include/sys/sysinfo.h
index 1fa4969..084e203 100644
--- a/sysdeps/unix/sysv/linux/include/sys/sysinfo.h
+++ b/sysdeps/unix/sysv/linux/include/sys/sysinfo.h
@@ -23,7 +23,7 @@
 
 # ifndef _ISOMAC
 
-extern __typeof (sysinfo) __sysinfo __THROW;
+extern __typeof (sysinfo) __sysinfo __THROW attribute_hidden;
 
 # endif /* _ISOMAC */
 #endif /* sys/sysinfo.h */

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

commit 6a088436d4c04b8081e86f9e856f10fba97d0612
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:04:26 2017 -0700

    Hide internal signal functions [BZ #18822]
    
    Hide internal signal functions to allow direct access within libc.so and
    libc.a without using GOT nor PLT.
    
    __GI___kill and __GI___sigaltstack are defined when syscalls.list is
    used to generate them.  Otherwise libc_hidden_def is needed explicitly.
    
    	[BZ #18822]
    	* include/signal.h (__kill): Add libc_hidden_proto.
    	(__sigblock): Likewise.
    	(__sigprocmask): Likewise.
    	(__sigaltstack): Likewise.
    	* signal/kill.c (__kill): Add libc_hidden_def.
    	* signal/sigblock.c (__sigblock): Likewise.
    	* signal/sigprocmask.c (__sigprocmask): Likewise.
    	* sysdeps/mach/hurd/kill.c (__kill): Likewise.
    	* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
    	* sysdeps/mach/hurd/sigprocmask.c (__sigprocmask): Likewise.
    	* sysdeps/posix/sigblock.c (__sigblock): Likewise.
    	* sysdeps/unix/sysv/linux/alpha/sigprocmask.c (__sigprocmask):
    	Likewise.
    	* sysdeps/unix/sysv/linux/ia64/sigprocmask.c (__sigprocmask):
    	Likewise.
    	* sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
    	(__sigprocmask): Likewise.
    	* sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask):
    	Likewise.
    	* /sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
    	(__sigprocmask): Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/sigprocmask.c (__sigprocmask):
    	Likewise.

diff --git a/ChangeLog b/ChangeLog
index dcf1c0d..9397cdf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,33 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/signal.h (__kill): Add libc_hidden_proto.
+	(__sigblock): Likewise.
+	(__sigprocmask): Likewise.
+	(__sigaltstack): Likewise.
+	* signal/kill.c (__kill): Add libc_hidden_def.
+	* signal/sigblock.c (__sigblock): Likewise.
+	* signal/sigprocmask.c (__sigprocmask): Likewise.
+	* sysdeps/mach/hurd/kill.c (__kill): Likewise.
+	* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
+	* sysdeps/mach/hurd/sigprocmask.c (__sigprocmask): Likewise.
+	* sysdeps/posix/sigblock.c (__sigblock): Likewise.
+	* sysdeps/unix/sysv/linux/alpha/sigprocmask.c (__sigprocmask):
+	Likewise.
+	* sysdeps/unix/sysv/linux/ia64/sigprocmask.c (__sigprocmask):
+	Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
+	(__sigprocmask): Likewise.
+	* sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask):
+	Likewise.
+	* /sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
+	(__sigprocmask): Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sigprocmask.c (__sigprocmask):
+	Likewise.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/string.h (__strsep): Add libc_hidden_proto.
 	* string/strsep.c (__strsep): Add libc_hidden_def.
 
diff --git a/include/signal.h b/include/signal.h
index 61ad422..7cbe64b 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -17,13 +17,16 @@ libc_hidden_proto (_sys_siglist)
 /* Now define the internal interfaces.  */
 extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
 extern int __kill (__pid_t __pid, int __sig);
+libc_hidden_proto (__kill)
 extern int __sigaction (int __sig, const struct sigaction *__restrict __act,
 			struct sigaction *__restrict __oact);
 libc_hidden_proto (__sigaction)
 extern int __sigblock (int __mask);
+libc_hidden_proto (__sigblock)
 extern int __sigsetmask (int __mask);
 extern int __sigprocmask (int __how,
 			  const sigset_t *__set, sigset_t *__oset);
+libc_hidden_proto (__sigprocmask)
 extern int __sigsuspend (const sigset_t *__set);
 libc_hidden_proto (__sigsuspend)
 extern int __sigwait (const sigset_t *__set, int *__sig);
@@ -40,6 +43,7 @@ extern int __sigreturn (struct sigcontext *__scp);
 #endif
 extern int __sigaltstack (const stack_t *__ss,
 			  stack_t *__oss);
+libc_hidden_proto (__sigaltstack)
 extern int __libc_sigaction (int sig, const struct sigaction *act,
 			     struct sigaction *oact);
 libc_hidden_proto (__libc_sigaction)
diff --git a/signal/kill.c b/signal/kill.c
index c7591b1..66f85d1 100644
--- a/signal/kill.c
+++ b/signal/kill.c
@@ -30,4 +30,5 @@ __kill (int pid, int sig)
 }
 stub_warning (kill)
 
+libc_hidden_def (__kill)
 weak_alias (__kill, kill)
diff --git a/signal/sigblock.c b/signal/sigblock.c
index a8be9db..fca370a 100644
--- a/signal/sigblock.c
+++ b/signal/sigblock.c
@@ -27,4 +27,5 @@ __sigblock (int mask)
 }
 stub_warning (sigblock)
 
+libc_hidden_def (__sigblock)
 weak_alias (__sigblock, sigblock)
diff --git a/signal/sigprocmask.c b/signal/sigprocmask.c
index afcf5a1..ca9bb55 100644
--- a/signal/sigprocmask.c
+++ b/signal/sigprocmask.c
@@ -44,4 +44,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
    and we don't want warnings for every use of abort on
    a system without safe signals.  */
 
+libc_hidden_def (__sigprocmask)
 weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/mach/hurd/kill.c b/sysdeps/mach/hurd/kill.c
index 2d556dd..5360bb5 100644
--- a/sysdeps/mach/hurd/kill.c
+++ b/sysdeps/mach/hurd/kill.c
@@ -146,4 +146,5 @@ __kill (pid_t pid, int sig)
   return delivered ? 0 : __hurd_fail (err ?: ESRCH);
 }
 
+libc_hidden_def (__kill)
 weak_alias (__kill, kill)
diff --git a/sysdeps/mach/hurd/sigaltstack.c b/sysdeps/mach/hurd/sigaltstack.c
index 4fba69e..3fde510 100644
--- a/sysdeps/mach/hurd/sigaltstack.c
+++ b/sysdeps/mach/hurd/sigaltstack.c
@@ -57,4 +57,5 @@ __sigaltstack (const stack_t *argss, stack_t *oss)
 
   return 0;
 }
+libc_hidden_def (__sigaltstack)
 weak_alias (__sigaltstack, sigaltstack)
diff --git a/sysdeps/mach/hurd/sigprocmask.c b/sysdeps/mach/hurd/sigprocmask.c
index a4ebe58..70b9a10 100644
--- a/sysdeps/mach/hurd/sigprocmask.c
+++ b/sysdeps/mach/hurd/sigprocmask.c
@@ -80,4 +80,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
   return 0;
 }
 
+libc_hidden_def (__sigprocmask)
 weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/posix/sigblock.c b/sysdeps/posix/sigblock.c
index 1f86864..ab59f29 100644
--- a/sysdeps/posix/sigblock.c
+++ b/sysdeps/posix/sigblock.c
@@ -35,4 +35,5 @@ __sigblock (int mask)
   return sigset_get_old_mask (&oset);
 }
 
+libc_hidden_def (__sigblock)
 weak_alias (__sigblock, sigblock)
diff --git a/sysdeps/unix/sysv/linux/alpha/sigprocmask.c b/sysdeps/unix/sysv/linux/alpha/sigprocmask.c
index 39a07de..ebec70c 100644
--- a/sysdeps/unix/sysv/linux/alpha/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/alpha/sigprocmask.c
@@ -54,4 +54,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
   return 0;
 }
 
+libc_hidden_def (__sigprocmask)
 weak_alias (__sigprocmask, sigprocmask);
diff --git a/sysdeps/unix/sysv/linux/ia64/sigprocmask.c b/sysdeps/unix/sysv/linux/ia64/sigprocmask.c
index 7e62438..920c5fd 100644
--- a/sysdeps/unix/sysv/linux/ia64/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/ia64/sigprocmask.c
@@ -36,4 +36,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
      real size of the user-level sigset_t.  */
   return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
 }
+libc_hidden_def (__sigprocmask)
 weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
index 4cbbc8e..a8010e7 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
@@ -34,4 +34,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
      real size of the user-level sigset_t.  */
   return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
 }
+libc_hidden_def (__sigprocmask)
 weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c
index e39e5f6..d0b8e04 100644
--- a/sysdeps/unix/sysv/linux/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/sigprocmask.c
@@ -53,4 +53,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
 
   return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
 }
+libc_hidden_def (__sigprocmask)
 weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c b/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
index c2205d0..ef7d7fe 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
@@ -30,4 +30,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
      real size of the user-level sigset_t.  */
   return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
 }
+libc_hidden_def (__sigprocmask)
 weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c b/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c
index a87ad10..1610ddf 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c
@@ -35,4 +35,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
      real size of the user-level sigset_t.  */
   return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
 }
+libc_hidden_def (__sigprocmask)
 weak_alias (__sigprocmask, sigprocmask)

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

commit 78cf1d74d28c9312d888dea1ad3de01d38c5fc4a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:03:28 2017 -0700

    Hide internal __strsep function [BZ #18822]
    
    Hide internal __strsep function to allow direct access within libc.so and
    libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* include/string.h (__strsep): Add libc_hidden_proto.
    	* string/strsep.c (__strsep): Add libc_hidden_def.

diff --git a/ChangeLog b/ChangeLog
index 6ee7fd4..dcf1c0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/string.h (__strsep): Add libc_hidden_proto.
+	* string/strsep.c (__strsep): Add libc_hidden_def.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* posix/spawn_int.h (__posix_spawn_file_actions_realloc): Add
 	attribute_hidden.
 	(__spawni): Likewise.
diff --git a/include/string.h b/include/string.h
index 069efd0..968d6fe 100644
--- a/include/string.h
+++ b/include/string.h
@@ -12,6 +12,7 @@ extern size_t __strnlen (const char *__string, size_t __maxlen)
      __attribute_pure__;
 
 extern char *__strsep (char **__stringp, const char *__delim);
+libc_hidden_proto (__strsep)
 
 extern int __strverscmp (const char *__s1, const char *__s2)
      __attribute_pure__;
diff --git a/string/strsep.c b/string/strsep.c
index 7091234..b610365 100644
--- a/string/strsep.c
+++ b/string/strsep.c
@@ -46,4 +46,5 @@ __strsep (char **stringp, const char *delim)
 }
 weak_alias (__strsep, strsep)
 strong_alias (__strsep, __strsep_g)
+libc_hidden_def (__strsep)
 libc_hidden_def (__strsep_g)

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

commit 85b358949d506ddc7c35301e7ae1316d2036a736
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:02:41 2017 -0700

    Hide __posix_spawn_file_actions_realloc/__spawni [BZ #18822]
    
    Hide internal __posix_spawn_file_actions_realloc and /__spawni functions
    to allow direct access within libc.so and libc.a without using GOT nor
    PLT.
    
    	[BZ #18822]
    	* posix/spawn_int.h (__posix_spawn_file_actions_realloc): Add
    	attribute_hidden.
    	(__spawni): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 21d5d6a..6ee7fd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* posix/spawn_int.h (__posix_spawn_file_actions_realloc): Add
+	attribute_hidden.
+	(__spawni): Likewise.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/sys/mman.h (__mremap): Add libc_hidden_proto.
 	* sysdeps/unix/sysv/linux/m68k/mremap.S (__mremap): Add
 	libc_hidden_def.
diff --git a/posix/spawn_int.h b/posix/spawn_int.h
index 6ada827..01bf603 100644
--- a/posix/spawn_int.h
+++ b/posix/spawn_int.h
@@ -57,12 +57,13 @@ struct __spawn_action
 #define SPAWN_XFLAGS_TRY_SHELL	0x2
 
 extern int __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *
-					       file_actions);
+					       file_actions)
+     attribute_hidden;
 
 extern int __spawni (pid_t *pid, const char *path,
 		     const posix_spawn_file_actions_t *file_actions,
 		     const posix_spawnattr_t *attrp, char *const argv[],
-		     char *const envp[], int xflags);
+		     char *const envp[], int xflags) attribute_hidden;
 
 /* Return true if FD falls into the range valid for file descriptors.
    The check in this form is mandated by POSIX.  */

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

commit 225f7eec85b83ad38a1c92dbb16a843732a25899
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:01:43 2017 -0700

    Hide internal __mremap function [BZ #18822]
    
    Hide internal __mremap function to allow direct access within libc.so and
    libc.a without using GOT nor PLT.
    
    __GI___mremap is defined when sysdeps/unix/syscalls.list is used to
    generate mremap.  Otherwise libc_hidden_def is needed explicitly.
    
    	[BZ #18822]
    	* include/sys/mman.h (__mremap): Add libc_hidden_proto.
    	* sysdeps/unix/sysv/linux/m68k/mremap.S (__mremap): Add
    	libc_hidden_def.

diff --git a/ChangeLog b/ChangeLog
index 79489d7..21d5d6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/sys/mman.h (__mremap): Add libc_hidden_proto.
+	* sysdeps/unix/sysv/linux/m68k/mremap.S (__mremap): Add
+	libc_hidden_def.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/malloc.h (__malloc_check_init): Add attribute_hidden.
 
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
diff --git a/include/sys/mman.h b/include/sys/mman.h
index 8b996fc..503edaa 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -20,6 +20,7 @@ libc_hidden_proto (__madvise)
 /* This one is Linux specific.  */
 extern void *__mremap (void *__addr, size_t __old_len,
 		       size_t __new_len, int __flags, ...);
+libc_hidden_proto (__mremap)
 
 # if IS_IN (rtld)
 #  include <dl-mman.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/mremap.S b/sysdeps/unix/sysv/linux/m68k/mremap.S
index 01be848..5cb7c1b 100644
--- a/sysdeps/unix/sysv/linux/m68k/mremap.S
+++ b/sysdeps/unix/sysv/linux/m68k/mremap.S
@@ -25,4 +25,5 @@ PSEUDO (__mremap, mremap, 5)
 	move.l %d0, %a0
 	rts
 PSEUDO_END (__mremap)
+libc_hidden_def (__mremap)
 weak_alias (__mremap, mremap)

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

commit 372fe247b11eb4079f93f11f3f20d14bc6c2c57f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 16:00:05 2017 -0700

    Hide internal __malloc_check_init function [BZ #18822]
    
    Hide internal __malloc_check_init function to allow direct access within
    libc.so and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* include/malloc.h (__malloc_check_init): Add attribute_hidden.

diff --git a/ChangeLog b/ChangeLog
index c302e26..79489d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/malloc.h (__malloc_check_init): Add attribute_hidden.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/sys/ioctl.h (__ioctl): Add libc_hidden_proto.
 	* misc/ioctl.c (__ioctl): Add libc_hidden_def.
 	* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
diff --git a/include/malloc.h b/include/malloc.h
index 70d32c7..d4cd9a5 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -9,6 +9,8 @@
 /* Nonzero if the malloc is already initialized.  */
 extern int __malloc_initialized attribute_hidden;
 
+extern __typeof (__malloc_check_init) __malloc_check_init attribute_hidden;
+
 struct malloc_state;
 typedef struct malloc_state *mstate;
 

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

commit 9e5ee8b839175b7f48d2e64e87d1e3da8fa6458f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 15:58:52 2017 -0700

    Hide internal __ioctl function [BZ #18822]
    
    Hide internal __ioctl function to allow direct access within libc.so and
    libc.a without using GOT nor PLT.
    
    __GI___ioctl is defined when sysdeps/unix/syscalls.list is used to
    generate ioctl.  Otherwise libc_hidden_def is needed explicitly.
    
    	[BZ #18822]
    	* include/sys/ioctl.h (__ioctl): Add libc_hidden_proto.
    	* misc/ioctl.c (__ioctl): Add libc_hidden_def.
    	* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
    	* sysdeps/unix/sysv/linux/aarch64/ioctl.S (__ioctl): Likewise.
    	* sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S (__ioctl):
    	Likewise.
    	* sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise.
    	* sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S (__ioctl): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 970bc5f..c302e26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,18 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/sys/ioctl.h (__ioctl): Add libc_hidden_proto.
+	* misc/ioctl.c (__ioctl): Add libc_hidden_def.
+	* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
+	* sysdeps/unix/sysv/linux/aarch64/ioctl.S (__ioctl): Likewise.
+	* sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S (__ioctl):
+	Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise.
+	* sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S (__ioctl): Likewise.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* intl/gettextP.h (__dcngettext): Add attribute_hidden.
 	(__dcigettext): Likewise.
 
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
index bfc6909..dd7c3c7 100644
--- a/include/sys/ioctl.h
+++ b/include/sys/ioctl.h
@@ -5,6 +5,7 @@
 
 /* Now define the internal interfaces.  */
 extern int __ioctl (int __fd, unsigned long int __request, ...);
+libc_hidden_proto (__ioctl)
 
 # endif /* !_ISOMAC */
 #endif
diff --git a/misc/ioctl.c b/misc/ioctl.c
index 9b90102..7e1c8cc 100644
--- a/misc/ioctl.c
+++ b/misc/ioctl.c
@@ -28,4 +28,5 @@ __ioctl (int fd, unsigned long int request, ...)
 }
 stub_warning (ioctl)
 
+libc_hidden_def (__ioctl)
 weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
index 7ce521c..d6b4583 100644
--- a/sysdeps/mach/hurd/ioctl.c
+++ b/sysdeps/mach/hurd/ioctl.c
@@ -323,4 +323,5 @@ __ioctl (int fd, unsigned long int request, ...)
     }
 }
 
+libc_hidden_def (__ioctl)
 weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ioctl.S b/sysdeps/unix/sysv/linux/aarch64/ioctl.S
index 866d6ef..61b3804 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ioctl.S
+++ b/sysdeps/unix/sysv/linux/aarch64/ioctl.S
@@ -28,4 +28,5 @@ ENTRY(__ioctl)
 	ret
 PSEUDO_END (__ioctl)
 
+libc_hidden_def (__ioctl)
 weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S b/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
index ee5d11d..54d1866 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
@@ -38,4 +38,5 @@ L(error):
 
 PSEUDO_END (__ioctl)
 
+libc_hidden_def (__ioctl)
 weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/linux/powerpc/ioctl.c b/sysdeps/unix/sysv/linux/powerpc/ioctl.c
index 1437d1d..9efccbd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ioctl.c
+++ b/sysdeps/unix/sysv/linux/powerpc/ioctl.c
@@ -61,4 +61,5 @@ __ioctl (int fd, unsigned long int request, ...)
 
   return result;
 }
+libc_hidden_def (__ioctl)
 weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S b/sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S
index e2bf44c..43f9563 100644
--- a/sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S
+++ b/sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S
@@ -38,4 +38,5 @@ ENTRY (__ioctl)
 	BNEZ r1, 0f
 	jrp lr
 PSEUDO_END (__ioctl)
+libc_hidden_def (__ioctl)
 weak_alias (__ioctl, ioctl)

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

commit 2ff16592d8a6b873467c9348f609738973217288
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 15:58:05 2017 -0700

    Mark internal intl functions with attribute_hidden [BZ #18822]
    
    Mark internal intl functions with attribute_hidden to allow direct
    access within libc.so and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* intl/gettextP.h (__dcngettext): Add attribute_hidden.
    	(__dcigettext): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 4851dc7..970bc5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* intl/gettextP.h (__dcngettext): Add attribute_hidden.
+	(__dcigettext): Likewise.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/sys/sysinfo.h (__get_nprocs_conf): Add
 	libc_hidden_proto.
 	(__get_nprocs): Likewise.
diff --git a/intl/gettextP.h b/intl/gettextP.h
index 75b203a..d0af470 100644
--- a/intl/gettextP.h
+++ b/intl/gettextP.h
@@ -49,11 +49,12 @@ extern char *__dngettext (const char *__domainname,
 			  unsigned long int n);
 extern char *__dcngettext (const char *__domainname,
 			   const char *__msgid1, const char *__msgid2,
-			   unsigned long int __n, int __category);
+			   unsigned long int __n, int __category)
+     attribute_hidden;
 extern char *__dcigettext (const char *__domainname,
 			   const char *__msgid1, const char *__msgid2,
 			   int __plural, unsigned long int __n,
-			   int __category);
+			   int __category) attribute_hidden;
 extern char *__textdomain (const char *__domainname);
 extern char *__bindtextdomain (const char *__domainname,
 			       const char *__dirname);

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

commit b5648377d923d790dd7e995d79d480066b25e6bb
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 15:57:00 2017 -0700

    Hide internal sysinfo functions [BZ #18822]
    
    Hide internal sysinfo functions to allow direct access within libc.so
    and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* include/sys/sysinfo.h (__get_nprocs_conf): Add
    	libc_hidden_proto.
    	(__get_nprocs): Likewise.
    	(__get_phys_pages): Likewise.
    	(__get_avphys_pages): Likewise.
    	(__get_child_max): Add attribute_hidden.
    	* misc/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def.
    	(__get_nprocs): Likewise.
    	(__get_phys_pages): Likewise.
    	(__get_avphys_pages): Likewise.
    	* sysdeps/mach/getsysstats.c (__get_nprocs_conf): Add
    	libc_hidden_def.
    	(__get_nprocs): Likewise.
    	(__get_phys_pages): Likewise.
    	(__get_avphys_pages): Likewise.
    	* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Add
    	libc_hidden_def.
    	(__get_nprocs_conf): Likewise.
    	(__get_phys_pages): Likewise.
    	(__get_avphys_pages): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 8117cc1..4851dc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,30 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/sys/sysinfo.h (__get_nprocs_conf): Add
+	libc_hidden_proto.
+	(__get_nprocs): Likewise.
+	(__get_phys_pages): Likewise.
+	(__get_avphys_pages): Likewise.
+	(__get_child_max): Add attribute_hidden.
+	* misc/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def.
+	(__get_nprocs): Likewise.
+	(__get_phys_pages): Likewise.
+	(__get_avphys_pages): Likewise.
+	* sysdeps/mach/getsysstats.c (__get_nprocs_conf): Add
+	libc_hidden_def.
+	(__get_nprocs): Likewise.
+	(__get_phys_pages): Likewise.
+	(__get_avphys_pages): Likewise.
+	* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Add
+	libc_hidden_def.
+	(__get_nprocs_conf): Likewise.
+	(__get_phys_pages): Likewise.
+	(__get_avphys_pages): Likewise.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_open): Add
 	attribute_hidden.
 	(__netlink_close): Likewise.
diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h
index c33eae2..7388356 100644
--- a/include/sys/sysinfo.h
+++ b/include/sys/sysinfo.h
@@ -7,18 +7,22 @@
 
 /* Return number of configured processors.  */
 extern int __get_nprocs_conf (void);
+libc_hidden_proto (__get_nprocs_conf)
 
 /* Return number of available processors.  */
 extern int __get_nprocs (void);
+libc_hidden_proto (__get_nprocs)
 
 /* Return number of physical pages of memory in the system.  */
 extern long int __get_phys_pages (void);
+libc_hidden_proto (__get_phys_pages)
 
 /* Return number of available physical pages of memory in the system.  */
 extern long int __get_avphys_pages (void);
+libc_hidden_proto (__get_avphys_pages)
 
 /* Return maximum number of processes this real user ID can have.  */
-extern long int __get_child_max (void);
+extern long int __get_child_max (void) attribute_hidden;
 
 # endif /* !_ISOMAC */
 #endif /* sys/sysinfo.h */
diff --git a/misc/getsysstats.c b/misc/getsysstats.c
index d25770e..cbad87a 100644
--- a/misc/getsysstats.c
+++ b/misc/getsysstats.c
@@ -26,6 +26,7 @@ __get_nprocs_conf (void)
   /* We don't know how to determine the number.  Simply return always 1.  */
   return 1;
 }
+libc_hidden_def (__get_nprocs_conf)
 weak_alias (__get_nprocs_conf, get_nprocs_conf)
 
 link_warning (get_nprocs_conf, "warning: get_nprocs_conf will always return 1")
@@ -38,6 +39,7 @@ __get_nprocs (void)
   /* We don't know how to determine the number.  Simply return always 1.  */
   return 1;
 }
+libc_hidden_def (__get_nprocs)
 weak_alias (__get_nprocs, get_nprocs)
 
 link_warning (get_nprocs, "warning: get_nprocs will always return 1")
@@ -50,6 +52,7 @@ __get_phys_pages (void)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (__get_phys_pages)
 weak_alias (__get_phys_pages, get_phys_pages)
 
 stub_warning (get_phys_pages)
@@ -62,6 +65,7 @@ __get_avphys_pages (void)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (__get_avphys_pages)
 weak_alias (__get_avphys_pages, get_avphys_pages)
 
 stub_warning (get_avphys_pages)
diff --git a/sysdeps/mach/getsysstats.c b/sysdeps/mach/getsysstats.c
index 0dacab0..3aabd61 100644
--- a/sysdeps/mach/getsysstats.c
+++ b/sysdeps/mach/getsysstats.c
@@ -39,6 +39,7 @@ __get_nprocs_conf (void)
 
   return hbi.max_cpus;
 }
+libc_hidden_def (__get_nprocs_conf)
 weak_alias (__get_nprocs_conf, get_nprocs_conf)
 
 /* Return the number of processors currently available on the system. */
@@ -58,6 +59,7 @@ __get_nprocs (void)
 
   return hbi.avail_cpus;
 }
+libc_hidden_def (__get_nprocs)
 weak_alias (__get_nprocs, get_nprocs)
 
 /* Return the number of physical pages on the system. */
@@ -77,6 +79,7 @@ __get_phys_pages (void)
 
   return hbi.memory_size / __vm_page_size;
 }
+libc_hidden_def (__get_phys_pages)
 weak_alias (__get_phys_pages, get_phys_pages)
 
 /* Return the number of available physical pages */
@@ -102,4 +105,5 @@ __get_avphys_pages (void)
 
   return vs.free_count;
 }
+libc_hidden_def (__get_avphys_pages)
 weak_alias (__get_avphys_pages, get_avphys_pages)
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index d02c86d..c245b3c 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -226,6 +226,7 @@ __get_nprocs (void)
 
   return result;
 }
+libc_hidden_def (__get_nprocs)
 weak_alias (__get_nprocs, get_nprocs)
 
 
@@ -279,6 +280,7 @@ __get_nprocs_conf (void)
 
   return result;
 }
+libc_hidden_def (__get_nprocs_conf)
 weak_alias (__get_nprocs_conf, get_nprocs_conf)
 
 
@@ -320,6 +322,7 @@ __get_phys_pages (void)
   __sysinfo (&info);
   return sysinfo_mempages (info.totalram, info.mem_unit);
 }
+libc_hidden_def (__get_phys_pages)
 weak_alias (__get_phys_pages, get_phys_pages)
 
 long int
@@ -330,4 +333,5 @@ __get_avphys_pages (void)
   __sysinfo (&info);
   return sysinfo_mempages (info.freeram, info.mem_unit);
 }
+libc_hidden_def (__get_avphys_pages)
 weak_alias (__get_avphys_pages, get_avphys_pages)

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

commit 0389a6aaae6d07f69de5b42345293ec578337de2
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 15:56:04 2017 -0700

    Mark internal netlink functions with attribute_hidden [BZ #18822]
    
    Mark internal netlink functions with attribute_hidden to allow direct
    access within libc.so and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_open): Add
    	attribute_hidden.
    	(__netlink_close): Likewise.
    	(__netlink_free_handle): Likewise.
    	(__netlink_request): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 9ede6b7..8117cc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_open): Add
+	attribute_hidden.
+	(__netlink_close): Likewise.
+	(__netlink_free_handle): Likewise.
+	(__netlink_request): Likewise.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/rpc/rpc.h (__rpc_thread_variables): Add
 	attribute_hidden.
 	(__rpc_thread_svc_cleanup): Likewise.
diff --git a/sysdeps/unix/sysv/linux/netlinkaccess.h b/sysdeps/unix/sysv/linux/netlinkaccess.h
index 66bbbe6..f4973e2 100644
--- a/sysdeps/unix/sysv/linux/netlinkaccess.h
+++ b/sysdeps/unix/sysv/linux/netlinkaccess.h
@@ -44,10 +44,12 @@ struct netlink_handle
 };
 
 
-extern int __netlink_open (struct netlink_handle *h);
-extern void __netlink_close (struct netlink_handle *h);
-extern void __netlink_free_handle (struct netlink_handle *h);
-extern int __netlink_request (struct netlink_handle *h, int type);
+extern int __netlink_open (struct netlink_handle *h) attribute_hidden;
+extern void __netlink_close (struct netlink_handle *h) attribute_hidden;
+extern void __netlink_free_handle (struct netlink_handle *h)
+     attribute_hidden;
+extern int __netlink_request (struct netlink_handle *h, int type)
+     attribute_hidden;
 
 /* Terminate the process if RESULT is an invalid recvmsg result for
    the netlink socket FD.  */

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

commit d48354d86087ba63acb7e2b20fb604c0b6ba4352
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 15:54:51 2017 -0700

    Mark internal rpc functions with attribute_hidden [BZ #18822]
    
    Mark internal rpc functions with attribute_hidden to allow direct
    access within libc.so and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* include/rpc/rpc.h (__rpc_thread_variables): Add
    	attribute_hidden.
    	(__rpc_thread_svc_cleanup): Likewise.
    	(__rpc_thread_clnt_cleanup): Likewise.
    	(__rpc_thread_key_cleanup): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 56b44ea..9ede6b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/rpc/rpc.h (__rpc_thread_variables): Add
+	attribute_hidden.
+	(__rpc_thread_svc_cleanup): Likewise.
+	(__rpc_thread_clnt_cleanup): Likewise.
+	(__rpc_thread_key_cleanup): Likewise.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/sys/uio.h (__readv): Add libc_hidden_proto.
 	(__writev): Likewise.
 	* misc/readv.c (__readv): Add libc_hidden_def.
diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
index 60c7896..1fb925e 100644
--- a/include/rpc/rpc.h
+++ b/include/rpc/rpc.h
@@ -41,10 +41,10 @@ struct rpc_thread_variables {
 };
 
 extern struct rpc_thread_variables *__rpc_thread_variables(void)
-     __attribute__ ((const));
-extern void __rpc_thread_svc_cleanup (void);
-extern void __rpc_thread_clnt_cleanup (void);
-extern void __rpc_thread_key_cleanup (void);
+     __attribute__ ((const)) attribute_hidden;
+extern void __rpc_thread_svc_cleanup (void) attribute_hidden;
+extern void __rpc_thread_clnt_cleanup (void) attribute_hidden;
+extern void __rpc_thread_key_cleanup (void) attribute_hidden;
 
 extern void __rpc_thread_destroy (void);
 

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

commit d6daff12617290d4dfb499ed8425d33a48d844ba
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 15:53:52 2017 -0700

    Hide __readv and __writev [BZ #18822]
    
    Hide internal __readv and __writev functions to allow direct access
    within libc.so and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* include/sys/uio.h (__readv): Add libc_hidden_proto.
    	(__writev): Likewise.
    	* misc/readv.c (__readv): Add libc_hidden_def.
    	* misc/writev.c (__writev): Likewise.
    	* sysdeps/posix/readv.c (__readv): Likewise.
    	* sysdeps/posix/writev.c (__writev): Likewise.
    	* sysdeps/unix/sysv/linux/readv.c: Include <sys/uio.h>.
    	(__readv): Likewise.
    	* sysdeps/unix/sysv/linux/writev.c: Include <sys/uio.h>.
    	(__writev): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 3726fac..56b44ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,20 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/sys/uio.h (__readv): Add libc_hidden_proto.
+	(__writev): Likewise.
+	* misc/readv.c (__readv): Add libc_hidden_def.
+	* misc/writev.c (__writev): Likewise.
+	* sysdeps/posix/readv.c (__readv): Likewise.
+	* sysdeps/posix/writev.c (__writev): Likewise.
+	* sysdeps/unix/sysv/linux/readv.c: Include <sys/uio.h>.
+	(__readv): Likewise.
+	* sysdeps/unix/sysv/linux/writev.c: Include <sys/uio.h>.
+	(__writev): Likewise.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/regex.h (__re_compile_fastmap): Add attribute_hidden.
 	(__regcomp): Add libc_hidden_proto.
 	(__regexec): Likewise.
diff --git a/include/sys/uio.h b/include/sys/uio.h
index 20860bf..204c4b9 100644
--- a/include/sys/uio.h
+++ b/include/sys/uio.h
@@ -5,8 +5,10 @@
 /* Now define the internal interfaces.  */
 extern ssize_t __readv (int __fd, const struct iovec *__iovec,
 			int __count);
+libc_hidden_proto (__readv)
 extern ssize_t __writev (int __fd, const struct iovec *__iovec,
 			 int __count);
+libc_hidden_proto (__writev)
 
 /* Used for p{read,write}{v64}v2 implementation.  */
 libc_hidden_proto (preadv)
diff --git a/misc/readv.c b/misc/readv.c
index 064f885..9ad94d3 100644
--- a/misc/readv.c
+++ b/misc/readv.c
@@ -30,6 +30,7 @@ __readv (int fd, const struct iovec *vector, int count)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (__readv)
 weak_alias (__readv, readv)
 
 stub_warning (readv)
diff --git a/misc/writev.c b/misc/writev.c
index c8d222e..8bd2edd 100644
--- a/misc/writev.c
+++ b/misc/writev.c
@@ -30,6 +30,7 @@ __writev (int fd, const struct iovec *vector, int count)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (__writev)
 weak_alias (__writev, writev)
 
 stub_warning (writev)
diff --git a/sysdeps/posix/readv.c b/sysdeps/posix/readv.c
index 5b0c124..2875c76 100644
--- a/sysdeps/posix/readv.c
+++ b/sysdeps/posix/readv.c
@@ -88,4 +88,5 @@ __readv (int fd, const struct iovec *vector, int count)
 
   return bytes_read;
 }
+libc_hidden_def (__readv)
 weak_alias (__readv, readv)
diff --git a/sysdeps/posix/writev.c b/sysdeps/posix/writev.c
index 7ce1deb..89d4630 100644
--- a/sysdeps/posix/writev.c
+++ b/sysdeps/posix/writev.c
@@ -88,4 +88,5 @@ __writev (int fd, const struct iovec *vector, int count)
 
   return bytes_written;
 }
+libc_hidden_def (__writev)
 weak_alias (__writev, writev)
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
index 142a0a9..e471300 100644
--- a/sysdeps/unix/sysv/linux/readv.c
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <unistd.h>
+#include <sys/uio.h>
 #include <sysdep-cancel.h>
 
 ssize_t
@@ -24,4 +25,5 @@ __readv (int fd, const struct iovec *iov, int iovcnt)
 {
   return SYSCALL_CANCEL (readv, fd, iov, iovcnt);
 }
+libc_hidden_def (__readv)
 weak_alias (__readv, readv)
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
index 1b56cbb..2495fd9 100644
--- a/sysdeps/unix/sysv/linux/writev.c
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <unistd.h>
+#include <sys/uio.h>
 #include <sysdep-cancel.h>
 
 ssize_t
@@ -24,4 +25,5 @@ __writev (int fd, const struct iovec *iov, int iovcnt)
 {
   return SYSCALL_CANCEL (writev, fd, iov, iovcnt);
 }
+libc_hidden_def (__writev)
 weak_alias (__writev, writev)

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

commit b68f8620561d7658b475eb512978d3c33d8a4547
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 15:52:56 2017 -0700

    Hide internal regex functions [BZ #18822]
    
    Hide internal regex functions to allow direct access within libc.so and
    libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* include/regex.h (__re_compile_fastmap): Add attribute_hidden.
    	(__regcomp): Add libc_hidden_proto.
    	(__regexec): Likewise.
    	(__regfree): Likewise.
    	* posix/regcomp.c (__regcomp): Add libc_hidden_def.
    	(__regfree): Likewise.
    	* posix/regexec.c (__regexec): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 4ee5740..3726fac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,17 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/regex.h (__re_compile_fastmap): Add attribute_hidden.
+	(__regcomp): Add libc_hidden_proto.
+	(__regexec): Likewise.
+	(__regfree): Likewise.
+	* posix/regcomp.c (__regcomp): Add libc_hidden_def.
+	(__regfree): Likewise.
+	* posix/regexec.c (__regexec): Likewise.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/utmp.h (__updwtmp): Add libc_hidden_proto.
 	(__getutent): Likewise.
 	(__getutid): Likewise.
diff --git a/include/regex.h b/include/regex.h
index fd4beef..24eca2c 100644
--- a/include/regex.h
+++ b/include/regex.h
@@ -8,7 +8,8 @@ extern reg_syntax_t __re_set_syntax (reg_syntax_t syntax);
 extern const char *__re_compile_pattern (const char *pattern, size_t length,
 					 struct re_pattern_buffer *buffer);
 
-extern int __re_compile_fastmap (struct re_pattern_buffer *buffer);
+extern int __re_compile_fastmap (struct re_pattern_buffer *buffer)
+     attribute_hidden;
 
 extern int __re_search (struct re_pattern_buffer *buffer, const char *string,
 			int length, int start, int range,
@@ -33,13 +34,16 @@ extern void __re_set_registers
    unsigned num_regs, regoff_t *starts, regoff_t *ends);
 
 extern int __regcomp (regex_t *__preg, const char *__pattern, int __cflags);
+libc_hidden_proto (__regcomp)
 
 extern int __regexec (const regex_t *__preg, const char *__string,
 		      size_t __nmatch, regmatch_t __pmatch[], int __eflags);
+libc_hidden_proto (__regexec)
 
 extern size_t __regerror (int __errcode, const regex_t *__preg,
 			  char *__errbuf, size_t __errbuf_size);
 
 extern void __regfree (regex_t *__preg);
+libc_hidden_proto (__regfree)
 #endif
 #endif
diff --git a/posix/regcomp.c b/posix/regcomp.c
index a5b4613..871ae2f 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -517,6 +517,7 @@ regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags)
   return (int) ret;
 }
 #ifdef _LIBC
+libc_hidden_def (__regcomp)
 weak_alias (__regcomp, regcomp)
 #endif
 
@@ -644,6 +645,7 @@ regfree (regex_t *preg)
   preg->translate = NULL;
 }
 #ifdef _LIBC
+libc_hidden_def (__regfree)
 weak_alias (__regfree, regfree)
 #endif
 
diff --git a/posix/regexec.c b/posix/regexec.c
index f46b1f7..a96d86d 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -224,6 +224,8 @@ regexec (const regex_t *__restrict preg, const char *__restrict string,
 }
 
 #ifdef _LIBC
+libc_hidden_def (__regexec)
+
 # include <shlib-compat.h>
 versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
 

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

commit 59c04e67631d370738b80923d42d4d1539d8f95f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 15:51:44 2017 -0700

    Mark internal utmp functions with attribute_hidden [BZ #18822]
    
    Mark internal utmp functions with attribute_hidden to allow direct
    access within libc.so and libc.a without using GOT nor PLT.
    
    	[BZ #18822]
    	* include/utmp.h (__updwtmp): Add libc_hidden_proto.
    	(__getutent): Likewise.
    	(__getutid): Likewise.
    	(__getutline): Likewise.
    	(__pututline): Likewise.
    	(__getutent_r): Likewise.
    	(__getutid_r): Likewise.
    	(__getutline_r): Likewise.
    	(__utmpname): Add attribute_hidden.
    	(__setutent): Likewise.
    	(__endutent): Likewise.
    	* login/getutent.c (__getutent): Add libc_hidden_def.
    	* login/getutent_r.c (__getutent_r): Likewise.
    	(__pututline): Likewise.
    	* login/getutid.c (__getutid): Likewise.
    	* login/getutid_r.c (__getutid_r): Likewise.
    	* login/getutline.c (__getutline): Likewise.
    	* login/getutline_r.c (__getutline_r): Likewise.
    	* login/updwtmp.c (__updwtmp): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 628b114..4ee5740 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,29 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/utmp.h (__updwtmp): Add libc_hidden_proto.
+	(__getutent): Likewise.
+	(__getutid): Likewise.
+	(__getutline): Likewise.
+	(__pututline): Likewise.
+	(__getutent_r): Likewise.
+	(__getutid_r): Likewise.
+	(__getutline_r): Likewise.
+	(__utmpname): Add attribute_hidden.
+	(__setutent): Likewise.
+	(__endutent): Likewise.
+	* login/getutent.c (__getutent): Add libc_hidden_def.
+	* login/getutent_r.c (__getutent_r): Likewise.
+	(__pututline): Likewise.
+	* login/getutid.c (__getutid): Likewise.
+	* login/getutid_r.c (__getutid_r): Likewise.
+	* login/getutline.c (__getutline): Likewise.
+	* login/getutline_r.c (__getutline_r): Likewise.
+	* login/updwtmp.c (__updwtmp): Likewise.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/dirent.h (__opendir): Always add attribute_hidden.
 	(__fdopendir): Likewise.
 	(__closedir): Likewise.
diff --git a/include/utmp.h b/include/utmp.h
index 6b2e262..374184e 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -5,18 +5,26 @@
 
 /* Now define the internal interfaces.  */
 extern void __updwtmp (const char *__wtmp_file, const struct utmp *__utmp);
-extern int __utmpname (const char *__file);
+libc_hidden_proto (__updwtmp)
+extern int __utmpname (const char *__file) attribute_hidden;
 extern struct utmp *__getutent (void);
-extern void __setutent (void);
-extern void __endutent (void);
+libc_hidden_proto (__getutent)
+extern void __setutent (void) attribute_hidden;
+extern void __endutent (void) attribute_hidden;
 extern struct utmp *__getutid (const struct utmp *__id);
+libc_hidden_proto (__getutid)
 extern struct utmp *__getutline (const struct utmp *__line);
+libc_hidden_proto (__getutline)
 extern struct utmp *__pututline (const struct utmp *__utmp_ptr);
+libc_hidden_proto (__pututline)
 extern int __getutent_r (struct utmp *__buffer, struct utmp **__result);
+libc_hidden_proto (__getutent_r)
 extern int __getutid_r (const struct utmp *__id, struct utmp *__buffer,
 			struct utmp **__result);
+libc_hidden_proto (__getutid_r)
 extern int __getutline_r (const struct utmp *__line,
 			  struct utmp *__buffer, struct utmp **__result);
+libc_hidden_proto (__getutline_r)
 
 libutil_hidden_proto (login_tty)
 
diff --git a/login/getutent.c b/login/getutent.c
index 114f7db..2f6ccf0 100644
--- a/login/getutent.c
+++ b/login/getutent.c
@@ -41,4 +41,5 @@ __getutent (void)
 
   return result;
 }
+libc_hidden_def (__getutent)
 weak_alias (__getutent, getutent)
diff --git a/login/getutent_r.c b/login/getutent_r.c
index 62272a2..1b126f0 100644
--- a/login/getutent_r.c
+++ b/login/getutent_r.c
@@ -151,6 +151,7 @@ __getutent_r (struct utmp *buffer, struct utmp **result)
 
   return retval;
 }
+libc_hidden_def (__getutent_r)
 weak_alias (__getutent_r, getutent_r)
 
 
@@ -167,6 +168,7 @@ __pututline (const struct utmp *data)
 
   return buffer;
 }
+libc_hidden_def (__pututline)
 weak_alias (__pututline, pututline)
 
 
diff --git a/login/getutid.c b/login/getutid.c
index 003bc65..62924f0 100644
--- a/login/getutid.c
+++ b/login/getutid.c
@@ -39,4 +39,5 @@ __getutid (const struct utmp *id)
 
   return result;
 }
+libc_hidden_def (__getutid)
 weak_alias (__getutid, getutid)
diff --git a/login/getutid_r.c b/login/getutid_r.c
index f823013..36ddbb2 100644
--- a/login/getutid_r.c
+++ b/login/getutid_r.c
@@ -59,4 +59,5 @@ __getutid_r (const struct utmp *id, struct utmp *buffer, struct utmp **result)
   return -1;
 #endif
 }
+libc_hidden_def (__getutid_r)
 weak_alias (__getutid_r, getutid_r)
diff --git a/login/getutline.c b/login/getutline.c
index f5291e8..636b8fe 100644
--- a/login/getutline.c
+++ b/login/getutline.c
@@ -40,4 +40,5 @@ __getutline (const struct utmp *line)
 
   return result;
 }
+libc_hidden_def (__getutline)
 weak_alias (__getutline, getutline)
diff --git a/login/getutline_r.c b/login/getutline_r.c
index 1a6f168..3adc3d0 100644
--- a/login/getutline_r.c
+++ b/login/getutline_r.c
@@ -42,4 +42,5 @@ __getutline_r (const struct utmp *line, struct utmp *buffer,
 
   return retval;
 }
+libc_hidden_def (__getutline_r)
 weak_alias (__getutline_r, getutline_r)
diff --git a/login/updwtmp.c b/login/updwtmp.c
index 7788614..3fcbaf6 100644
--- a/login/updwtmp.c
+++ b/login/updwtmp.c
@@ -31,4 +31,5 @@ __updwtmp (const char *wtmp_file, const struct utmp *utmp)
 
   (*__libc_utmp_file_functions.updwtmp) (file_name, utmp);
 }
+libc_hidden_def (__updwtmp)
 weak_alias (__updwtmp, updwtmp)

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

commit 4587a421c54a8912b3e24913c7e1501293042b40
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 1 15:50:56 2017 -0700

    Mark internal dirent functions with attribute_hidden [BZ #18822]
    
    Mark internal dirent functions with attribute_hidden to allow direct
    access within libc.so and libc.a without using GOT nor PLT.  __readdir64
    is hidden with libc_hidden_proto and libc_hidden_def since the exported
    readdir64 is an alias of __readdir64.
    
    	[BZ #18822]
    	* include/dirent.h (__opendir): Always add attribute_hidden.
    	(__fdopendir): Likewise.
    	(__closedir): Likewise.
    	(__readdir): Likewise.
    	(__readdir64): Add libc_hidden_proto.
    	* sysdeps/mach/hurd/readdir64.c (__readdir64): Add libc_hidden_def.
    	* sysdeps/unix/sysv/linux/i386/readdir64.c (__readdir64): Likewise.
    	* sysdeps/unix/sysv/linux/readdir64.c (__readdir64): Likewise.
    	* sysdeps/unix/sysv/linux/wordsize-64/readdir.c (__GI___readdir64):
    	New alias.

diff --git a/ChangeLog b/ChangeLog
index 98d572b..628b114 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,20 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/dirent.h (__opendir): Always add attribute_hidden.
+	(__fdopendir): Likewise.
+	(__closedir): Likewise.
+	(__readdir): Likewise.
+	(__readdir64): Add libc_hidden_proto.
+	* sysdeps/mach/hurd/readdir64.c (__readdir64): Add libc_hidden_def.
+	* sysdeps/unix/sysv/linux/i386/readdir64.c (__readdir64): Likewise.
+	* sysdeps/unix/sysv/linux/readdir64.c (__readdir64): Likewise.
+	* sysdeps/unix/sysv/linux/wordsize-64/readdir.c (__GI___readdir64):
+	New alias.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/aliases.h (__getaliasbyname_r): Add attribute_hidden.
 	* include/netdb.h (__gethostbyaddr_r): Likewise.
 	(__gethostbyname_r): Likewise.
diff --git a/include/dirent.h b/include/dirent.h
index d7dbf83..6fcc2f3 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -15,12 +15,13 @@ struct scandir_cancel_struct
 };
 
 /* Now define the internal interfaces.  */
-extern DIR *__opendir (const char *__name);
+extern DIR *__opendir (const char *__name) attribute_hidden;
 extern DIR *__opendirat (int dfd, const char *__name) attribute_hidden;
-extern DIR *__fdopendir (int __fd);
-extern int __closedir (DIR *__dirp);
-extern struct dirent *__readdir (DIR *__dirp);
+extern DIR *__fdopendir (int __fd) attribute_hidden;
+extern int __closedir (DIR *__dirp) attribute_hidden;
+extern struct dirent *__readdir (DIR *__dirp) attribute_hidden;
 extern struct dirent64 *__readdir64 (DIR *__dirp);
+libc_hidden_proto (__readdir64)
 extern int __readdir_r (DIR *__dirp, struct dirent *__entry,
 			struct dirent **__result);
 extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry,
@@ -77,10 +78,6 @@ libc_hidden_proto (__scandirat)
 libc_hidden_proto (scandirat64)
 
 #  if IS_IN (rtld)
-extern __typeof (__closedir) __closedir attribute_hidden;
-extern __typeof (__fdopendir) __fdopendir attribute_hidden;
-extern __typeof (__readdir) __readdir attribute_hidden;
-extern __typeof (__readdir64) __readdir64 attribute_hidden;
 extern __typeof (__rewinddir) __rewinddir attribute_hidden;
 #  endif
 # endif
diff --git a/sysdeps/mach/hurd/readdir64.c b/sysdeps/mach/hurd/readdir64.c
index f422fcf..bad0bcb 100644
--- a/sysdeps/mach/hurd/readdir64.c
+++ b/sysdeps/mach/hurd/readdir64.c
@@ -98,4 +98,5 @@ __readdir64 (DIR *dirp)
   return dp;
 }
 
+libc_hidden_def (__readdir64)
 weak_alias (__readdir64, readdir64)
diff --git a/sysdeps/unix/sysv/linux/i386/readdir64.c b/sysdeps/unix/sysv/linux/i386/readdir64.c
index da3defd..013bb25 100644
--- a/sysdeps/unix/sysv/linux/i386/readdir64.c
+++ b/sysdeps/unix/sysv/linux/i386/readdir64.c
@@ -27,6 +27,7 @@
 #undef __GETDENTS
 #undef DIRENT_TYPE
 
+libc_hidden_def (__readdir64)
 versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
 
 #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
index 224f53d..6d154fe 100644
--- a/sysdeps/unix/sysv/linux/readdir64.c
+++ b/sysdeps/unix/sysv/linux/readdir64.c
@@ -4,4 +4,5 @@
 
 #include <sysdeps/posix/readdir.c>
 
+libc_hidden_def (__readdir64)
 weak_alias (__readdir64, readdir64)
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/readdir.c b/sysdeps/unix/sysv/linux/wordsize-64/readdir.c
index e197d93..0d57988 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/readdir.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/readdir.c
@@ -3,5 +3,6 @@
 #include <sysdeps/posix/readdir.c>
 #undef __readdir64
 strong_alias (__readdir, __readdir64)
+strong_alias (__readdir, __GI___readdir64)
 #undef readdir64
 weak_alias (__readdir, readdir64)

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


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]