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.9000-1009-g7e29e9f


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  7e29e9f2beed0a108951f1b4c7543fe39ff1da1a (commit)

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

commit 7e29e9f2beed0a108951f1b4c7543fe39ff1da1a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Dec 18 14:05:07 2017 -0800

    Replece LDFLAGS-* = $(no-pie-ldflag) with tst-*-no-pie = yes [BZ #22630]
    
    After
    
    commit 9d7a3741c9e59eba87fb3ca6b9f979befce07826
    Author: H.J. Lu <hjl.tools@gmail.com>
    Date:   Fri Dec 15 16:59:33 2017 -0800
    
        Add --enable-static-pie configure option to build static PIE [BZ #19574]
    
    and
    
    commit 00c714df398b63934540d95ce3792596f7a94a6c
    Author: H.J. Lu <hjl.tools@gmail.com>
    Date:   Mon Dec 18 12:24:26 2017 -0800
    
        Pass -no-pie to GCC only if GCC defaults to PIE [BZ #22614]
    
    $(no-pie-ldflag) is no longer effective since no-pie-ldflag is defined
    to -no-pie only if GCC defaults to PIE.  When --enable-static-pie is
    used to configure glibc build and GCC doesn't default to PIE. no-pie-ldflag
    is undefined and these tests:
    
    elf/Makefile:LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
    elf/Makefile:LDFLAGS-tst-prelink = $(no-pie-ldflag)
    elf/Makefile:LDFLAGS-tst-main1 = $(no-pie-ldflag)
    gmon/Makefile:LDFLAGS-tst-gmon := $(no-pie-ldflag)
    
    may fail to link.  This patch replaces "-pie" with
    
    $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie)
    
    and repleces
    
    LDFLAGS-* = $(no-pie-ldflag)
    
    with
    
    tst-*-no-pie = yes
    
    so that tst-dlopen-aout, tst-prelink, tst-main1 and tst-gmon are always
    built as non-PIE, with and without --enable-static-pie, regardless if
    GCC defaults to PIE or non-PIE.
    
    Tested with build-many-glibcs.py without --enable-static-pie as well as
    with --enable-static-pie for x86_64, x32 and i686.
    
    	[BZ #22630]
    	* Makeconfig (link-pie-before-libc): Replace -pie with
    	$(if $($(@F)-no-pie),$(no-pie-ldflag),-pie).
    	* elf/Makefile (LDFLAGS-tst-dlopen-aout): Removed.
    	(tst-dlopen-aout-no-pie): New.
    	(LDFLAGS-tst-prelink): Removed.
    	(tst-prelink-no-pie): New.
    	(LDFLAGS-tst-main1): Removed.
    	(tst-main1-no-pie): New.
    	* gmon/Makefile (LDFLAGS-tst-gmon): Removed.
    	(tst-gmon-no-pie): New.

diff --git a/Makeconfig b/Makeconfig
index 80c498e..34bed97 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -413,7 +413,8 @@ link-extra-libs-tests = $(libsupport)
 
 # Command for linking PIE programs with the C library.
 ifndef +link-pie
-+link-pie-before-libc = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
++link-pie-before-libc = $(CC) $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
+	     -Wl,-O1 -nostdlib -nostartfiles -o $@ \
 	     $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
 	     $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
 	     $(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \
diff --git a/elf/Makefile b/elf/Makefile
index 47c3d23..a987614 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -195,7 +195,7 @@ tests-internal += loadtest unload unload2 circleload1 \
 	 tst-ptrguard1 tst-stackguard1
 ifeq ($(build-hardcoded-path-in-tests),yes)
 tests += tst-dlopen-aout
-LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
+tst-dlopen-aout-no-pie = yes
 endif
 test-srcs = tst-pathopt
 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
@@ -369,7 +369,7 @@ ifeq ($(have-glob-dat-reloc),yes)
 tests += tst-prelink
 # Don't compile tst-prelink.c with PIE for GLOB_DAT relocation.
 CFLAGS-tst-prelink.c += -fno-pie
-LDFLAGS-tst-prelink = $(no-pie-ldflag)
+tst-prelink-no-pie = yes
 ifeq ($(run-built-tests),yes)
 tests-special += $(objpfx)tst-prelink-cmp.out
 endif
@@ -1433,6 +1433,6 @@ $(objpfx)tst-debug1mod1.so: $(objpfx)testobj1.so
 
 $(objpfx)tst-main1: $(objpfx)tst-main1mod.so
 CRT-tst-main1 := $(csu-objpfx)crt1.o
-LDFLAGS-tst-main1 = $(no-pie-ldflag)
+tst-main1-no-pie = yes
 LDLIBS-tst-main1 = $(libsupport)
 tst-main1mod.so-no-z-defs = yes
diff --git a/gmon/Makefile b/gmon/Makefile
index 29e7467..6d0c620 100644
--- a/gmon/Makefile
+++ b/gmon/Makefile
@@ -49,7 +49,7 @@ endif
 CFLAGS-mcount.c := -fno-omit-frame-pointer
 
 CFLAGS-tst-gmon.c := -fno-omit-frame-pointer -pg
-LDFLAGS-tst-gmon := $(no-pie-ldflag)
+tst-gmon-no-pie = yes
 CRT-tst-gmon := $(csu-objpfx)gcrt1.o
 tst-gmon-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon.data
 ifeq ($(run-built-tests),yes)

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

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

    Add --enable-static-pie variants to x86_64, x32 and i686
    
    Since the default GCC and binutils versions used by build-many-glibcs.py,
    which are GCC 7 branch and binutils 2.29 branch, this patch adds
    --enable-static-pie glibc variants to x86_64, x32 and i686.
    
    Tested with build-many-glibcs.py.
    
    	* scripts/build-many-glibcs.py (Context.add_all_configs): Add
    	--enable-static-pie variants to x86_64, x32 and i686.

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 5453000..b317d59 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -368,6 +368,15 @@ class Context(object):
                                 {'arch': 'i686', 'ccopts': '-m32 -march=i686'}],
                         extra_glibcs=[{'variant': 'disable-multi-arch',
                                        'cfg': ['--disable-multi-arch']},
+                                      {'variant': 'static-pie',
+                                       'cfg': ['--enable-static-pie']},
+                                      {'variant': 'x32-static-pie',
+                                       'ccopts': '-mx32',
+                                       'cfg': ['--enable-static-pie']},
+                                      {'variant': 'static-pie',
+                                       'arch': 'i686',
+                                       'ccopts': '-m32 -march=i686',
+                                       'cfg': ['--enable-static-pie']},
                                       {'variant': 'disable-multi-arch',
                                        'arch': 'i686',
                                        'ccopts': '-m32 -march=i686',

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

commit 27ea6ee71a7319eabe18a133bbbd6da43caf74db
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=4a3b974ab7a5d90b16dcee699f52046905edd9a4

commit 4a3b974ab7a5d90b16dcee699f52046905edd9a4
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=13e37fa5bb1ad8714270a012fa646969238589ef

commit 13e37fa5bb1ad8714270a012fa646969238589ef
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.

diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 7106afb..cfcc4d9 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,19 @@ elf_machine_load_address (void)
 	3: .long _dl_start@GOTOFF\n\
 	2: mov r2,%0"
        : "=r" (addr) : : "r0", "r1", "r2");
+#else
+  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=4844933a9a0b3d36759fdcecf63f7d679dc9cf3c

commit 4844933a9a0b3d36759fdcecf63f7d679dc9cf3c
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.
    	* 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..da6817e 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,16 @@ elf_machine_load_address (void)
 	   "   al    1,0(1)\n"
 	   "   sl    %0,_dl_start@GOT(1)"
 	   : "=&d" (addr) : : "1" );
+#else
+  __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..5ef1c60 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -63,11 +63,19 @@ 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
+  __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=bfbc0341f3a05dd0c8940743d3dad60ea1226295

commit bfbc0341f3a05dd0c8940743d3dad60ea1226295
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Dec 1 09:49:25 2017 -0800

    nios2: Don't use MIN in dl-machine.h
    
    MIN is used, but param.h may not be included, so expand its single use
    inline.
    
    	* sysdeps/nios2/dl-machine.h (elf_machine_rela): Expand MIN.

diff --git a/sysdeps/nios2/dl-machine.h b/sysdeps/nios2/dl-machine.h
index b5fdd9b..67d8c89 100644
--- a/sysdeps/nios2/dl-machine.h
+++ b/sysdeps/nios2/dl-machine.h
@@ -271,7 +271,8 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 				strtab + refsym->st_name);
             }
           memcpy (reloc_addr_arg, (void *) value,
-                  MIN (sym->st_size, refsym->st_size));
+		  sym->st_size < refsym->st_size
+		  ? sym->st_size : refsym->st_size);
           break;
 	case R_NIOS2_GLOB_DAT:
 	case R_NIOS2_JUMP_SLOT:

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


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]