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 master updated. glibc-2.26-31-g1e8e527


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, master has been updated
       via  1e8e527dd9718eaebe8417b73befb0c821b7b327 (commit)
      from  e13daad7ac81968e9aaa4a87497f898bb15f4ef8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

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

commit 1e8e527dd9718eaebe8417b73befb0c821b7b327
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Aug 4 12:59:35 2017 -0700

    i386: Support static PIE in start.S
    
    Since start.o may be compiled as PIC, we should check PIC instead of
    SHARED.  Also avoid dynamic relocation against main in static PIE since
    _start is the entry point before the executable is relocated.
    
    	* sysdeps/i386/start.S (_start): Check Check PIC instead of
    	SHARED.  Avoid dynamic relocation against main in static PIE.

diff --git a/ChangeLog b/ChangeLog
index 8291f6e..acfcdcc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-08-04  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/i386/start.S (_start): Check Check PIC instead of
+	SHARED.  Avoid dynamic relocation against main in static PIE.
+
+2017-08-04  H.J. Lu  <hongjiu.lu@intel.com>
+
 	[BZ #21815]
 	* elf/Makefile (CFLAGS-tst-prelink.c): New.
 	(LDFLAGS-tst-prelink): Likewise.
diff --git a/sysdeps/i386/start.S b/sysdeps/i386/start.S
index ccb1e2b..375a93c 100644
--- a/sysdeps/i386/start.S
+++ b/sysdeps/i386/start.S
@@ -81,7 +81,7 @@ _start:
 	pushl %edx		/* Push address of the shared library
 				   termination function.  */
 
-#ifdef SHARED
+#ifdef PIC
 	/* Load PIC register.  */
 	call 1f
 	addl $_GLOBAL_OFFSET_TABLE_, %ebx
@@ -95,7 +95,14 @@ _start:
 	pushl %ecx		/* Push second argument: argv.  */
 	pushl %esi		/* Push first argument: argc.  */
 
+# ifdef SHARED
 	pushl main@GOT(%ebx)
+# else
+	/* Avoid relocation in static PIE since _start is called before
+	   it is relocated.  */
+	leal main@GOTOFF(%ebx), %eax
+	pushl %eax
+# endif
 
 	/* Call the user's main function, and exit with its value.
 	   But let the libc call main.    */
@@ -117,7 +124,7 @@ _start:
 
 	hlt			/* Crash if somehow `exit' does return.  */
 
-#ifdef SHARED
+#ifdef PIC
 1:	movl	(%esp), %ebx
 	ret
 #endif

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

Summary of changes:
 ChangeLog            |    5 +++++
 sysdeps/i386/start.S |   11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)


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]