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.9000-1120-g3d1d792


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  3d1d79283e6de4f7c434cb67fb53a4fd28359669 (commit)
      from  52a713fdd0a30e1bd79818e2e3c4ab44ddca1a94 (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=3d1d79283e6de4f7c434cb67fb53a4fd28359669

commit 3d1d79283e6de4f7c434cb67fb53a4fd28359669
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Dec 19 18:43:04 2017 +0000

    aarch64: fix static pie enabled libc when main is in a shared library
    
    In the static pie enabled libc, crt1.o uses the same position independent
    code as rcrt1.o and crt1.o is used instead of Scrt1.o when -no-pie
    executables are linked.  When main is not defined in the executable, but
    in a shared library crt1.o is currently broken, it assumes main is local.
    (glibc has a test for this but i missed it in my previous testing.)
    
    To make both rcrt1.o and crt1.o happy with the same code, a wrapper is
    introduced around main: with this crt1.o works with extern main symbol
    while rcrt1.o does not depend on GOT relocations. (The change only
    affects static pie enabled libc. Further simplification of start.S is
    possible in the future by using the same approach for Scrt1.o too.)
    
    	* aarch64/start.S (_start): Use __wrap_main.
    	(__wrap_main): New local symbol.

diff --git a/ChangeLog b/ChangeLog
index 971257a..da74352 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-12  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+	* aarch64/start.S (_start): Use __wrap_main.
+	(__wrap_main): New local symbol.
+
 2018-01-12  Dmitry V. Levin  <ldv@altlinux.org>
 
 	[BZ #22679]
diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
index 9f3b418..bad000f 100644
--- a/sysdeps/aarch64/start.S
+++ b/sysdeps/aarch64/start.S
@@ -71,8 +71,8 @@ _start:
         adrp    x4, :got:__libc_csu_fini
 	ldr     PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]
 # else
-	adrp	x0, main
-	add	x0, x0, :lo12:main
+	adrp	x0, __wrap_main
+	add	x0, x0, :lo12:__wrap_main
 	adrp	x3, __libc_csu_init
 	add	x3, x3, :lo12:__libc_csu_init
 	adrp	x4, __libc_csu_fini
@@ -94,6 +94,15 @@ _start:
 	/* should never get here....*/
 	bl	abort
 
+#if defined PIC && !defined SHARED
+	/* When main is not defined in the executable but in a shared library
+	   then a wrapper is needed in crt1.o of the static-pie enabled libc,
+	   because crt1.o and rcrt1.o share code and the later must avoid the
+	   use of GOT relocations before __libc_start_main is called.  */
+__wrap_main:
+	b	main
+#endif
+
 	/* Define a symbol for the first piece of initialized data.  */
 	.data
 	.globl __data_start

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

Summary of changes:
 ChangeLog               |    5 +++++
 sysdeps/aarch64/start.S |   13 +++++++++++--
 2 files changed, 16 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]