gcc/libgcc
H.J. Lu 428b381275 Add --enable-default-pie option to GCC configure
Add --enable-default-pie option to configure GCC to generate PIE by
default.

gcc/

	* Makefile.in (COMPILER): Add @NO_PIE_CFLAGS@.
	(BUILD_CFLAGS): Likewise.
	(BUILD_CXXFLAGS): Likewise.
	(LINKER): Add @NO_PIE_FLAG@.
	(BUILD_LDFLAGS): Likewise.
	(libgcc.mvars): Set NO_PIE_CFLAGS to -fno-PIE for
	--enable-default-pie.
	* common.opt (fPIE): Initialize to -1.
	(fpie): Likewise.
	(no-pie): New option.
	(pie): Replace "Negative(shared)" with "Negative(no-pie)".
	* configure.ac: Add --enable-default-pie.
	(NO_PIE_CFLAGS): New.  Check if -fno-PIE works.  AC_SUBST.
	(NO_PIE_FLAG): New.  Check if -no-pie works.  AC_SUBST.
	* defaults.h (DEFAULT_FLAG_PIE): New.  Default PIE to -fPIE.
	* gcc.c (NO_PIE_SPEC): New.
	(PIE_SPEC): Likewise.
	(NO_FPIE1_SPEC): Likewise.
	(FPIE1_SPEC): Likewise.
	(NO_FPIE2_SPEC): Likewise.
	(FPIE2_SPEC): Likewise.
	(NO_FPIE2_SPEC): Likewise.
	(FPIE_SPEC): Likewise.
	(NO_FPIE_SPEC): Likewise.
	(NO_FPIC1_SPEC): Likewise.
	(FPIC1_SPEC): Likewise.
	(NO_FPIC2_SPEC): Likewise.
	(FPIC2_SPEC): Likewise.
	(NO_FPIC2_SPEC): Likewise.
	(FPIC_SPEC): Likewise.
	(NO_FPIC_SPEC): Likewise.
	(NO_FPIE1_AND_FPIC1_SPEC): Likewise.
	(FPIE1_OR_FPIC1_SPEC): Likewise.
	(NO_FPIE2_AND_FPIC2_SPEC): Likewise.
	(FPIE2_OR_FPIC2_SPEC): Likewise.
	(NO_FPIE_AND_FPIC_SPEC): Likewise.
	(FPIE_OR_FPIC_SPEC): Likewise.
	(LD_PIE_SPEC): Likewise.
	(LINK_PIE_SPEC): Handle -no-pie.  Use PIE_SPEC and LD_PIE_SPEC.
	* opts.c (finish_options): Update opts->x_flag_pie if it is -1.
	* config/darwin.h (PIE_SPEC): Renamed to ...
	(DARWIN_PIE_SPEC): This.
	(LINK_SPEC): Replace PIE_SPEC with DARWIN_PIE_SPEC.
	* config/darwin9.h (PIE_SPEC): Renamed to ...
	(DARWIN_PIE_SPEC): This.
	* config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Use
	PIE_SPEC and NO_PIE_SPEC if HAVE_LD_PIE is defined.
	* config/openbsd.h (ASM_SPEC): Use FPIE1_OR_FPIC1_SPEC and
	FPIE2_OR_FPIC2_SPEC.
	* config/m68k/netbsd-elf.h (ASM_SPEC): Likewise.
	* config/m68k/openbsd.h (ASM_SPEC): Likewise.
	* gcc/config/sol2.h (ASM_PIC_SPEC): Likewise.
	* config/arm/freebsd.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise.
	* config/arm/netbsd-elf.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise.
	* config/arm/semi.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise.
	* config/cris/linux.h (CRIS_ASM_SUBTARGET_SPEC): Likewise.
	* config/m32r/m32r.h (ASM_SPEC): Likewise.
	* config/m68k/uclinux.h (DRIVER_SELF_SPECS): Likewise.
	* config/rs6000/linux64.h (ASM_SPEC32): Likewise.
	* config/rs6000/sysv4.h (ASM_SPEC): Likewise.
	* config/sparc/freebsd.h (ASM_SPEC): Likewise.
	* config/sparc/linux.h (ASM_SPEC): Likewise.
	* config/sparc/linux64.h (ASM_SPEC): Likewise.
	* config/sparc/netbsd-elf.h (ASM_SPEC): Likewise.
	* config/sparc/openbsd64.h (ASM_SPEC): Likewise.
	* config/sparc/sp-elf.h (ASM_SPEC): Likewise.
	* config/sparc/sp64-elf.h (ASM_SPEC): Likewise.
	* config/sparc/sparc.h (ASM_SPEC): Likewise.
	* config/sparc/sysv4.h (ASM_SPEC): Likewise.
	* config/sparc/vxworks.h (ASM_SPEC): Likewise.
	* config/c6x/elf-common.h (ASM_SPEC): Use NO_FPIC2_SPEC,
	FPIC2_SPEC, FPIC1_SPEC and FPIC2_SPEC.
	* config/c6x/uclinux-elf.h (LINK_SPEC): Use FPIE_SPEC.
	* config/frv/frv.h (DRIVER_SELF_SPECS): Use FPIC_SPEC,
	NO_FPIC_SPEC and NO_FPIE1_AND_FPIC1_SPEC.
	(ASM_SPEC): Use FPIE1_OR_FPIC1_SPEC and FPIE2_OR_FPIC2_SPEC.
	* config/m68k/m68k.h (ASM_PCREL_SPEC): Use FPIC_SPEC and
	NO_FPIC_SPEC.
	* config/mips/gnu-user.h (NO_SHARED_SPECS): Use
	NO_FPIE_AND_FPIC_SPEC.
	* config/mips/vxworks.h (SUBTARGET_ASM_SPEC): Use FPIC_SPEC.
	* config/rs6000/freebsd64.h (ASM_SPEC32): Likewise.
	* config/rs6000/vxworks.h (ASM_SPEC): Likewise.
	* config/vax/linux.h (ASM_SPEC): Likewise.
	* doc/install.texi: Document --enable-default-pie.
	* doc/invoke.texi: Document -no-pie.
	* config.in: Regenerated.
	* configure: Likewise.

gcc/ada/

	* gcc-interface/Makefile.in (TOOLS_LIBS): Add @NO_PIE_FLAG@.

libgcc/

	* Makefile.in (CRTSTUFF_CFLAGS): Add $(NO_PIE_CFLAGS).

From-SVN: r223796
2015-05-27 19:36:55 -07:00
..
config config.host (i[34567]86-*-freebsd*, [...]): Set md_unwind_header 2015-05-27 10:14:10 -06:00
soft-fp
ChangeLog Add --enable-default-pie option to GCC configure 2015-05-27 19:36:55 -07:00
config.host config.host (i[34567]86-*-freebsd*, [...]): Set md_unwind_header 2015-05-27 10:14:10 -06:00
config.in sjlj.m4: New file. 2015-05-13 21:15:31 +00:00
configure sjlj.m4: New file. 2015-05-13 21:15:31 +00:00
configure.ac sjlj.m4: New file. 2015-05-13 21:15:31 +00:00
crtstuff.c Update copyright years. 2015-01-05 13:33:28 +01:00
dfp-bit.c Update copyright years. 2015-01-05 13:33:28 +01:00
dfp-bit.h Update copyright years. 2015-01-05 13:33:28 +01:00
divmod.c Update copyright years. 2015-01-05 13:33:28 +01:00
empty.mk
emutls.c Update copyright years. 2015-01-05 13:33:28 +01:00
enable-execute-stack-empty.c
enable-execute-stack-mprotect.c Update copyright years. 2015-01-05 13:33:28 +01:00
find-symver.awk Update copyright years. 2015-01-05 13:33:28 +01:00
fixed-bit.c Update copyright years. 2015-01-05 13:33:28 +01:00
fixed-bit.h Update copyright years. 2015-01-05 13:33:28 +01:00
fixed-obj.mk
floatunsidf.c
floatunsisf.c
floatunsitf.c
floatunsixf.c
fp-bit.c Update copyright years. 2015-01-05 13:33:28 +01:00
fp-bit.h Update copyright years. 2015-01-05 13:33:28 +01:00
gbl-ctors.h Update copyright years. 2015-01-05 13:33:28 +01:00
gen-fixed.sh
generic-morestack-thread.c Update copyright years. 2015-01-05 13:33:28 +01:00
generic-morestack.c rs6000-common.c (TARGET_SUPPORTS_SPLIT_STACK): Define. 2015-05-20 10:56:28 +09:30
generic-morestack.h Update copyright years. 2015-01-05 13:33:28 +01:00
gstdint.h
gthr-posix.h Update copyright years. 2015-01-05 13:33:28 +01:00
gthr-single.h gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use empty do-while loop as macro body to avoid warnings. 2015-04-15 09:29:12 -06:00
gthr.h Update copyright years. 2015-01-05 13:33:28 +01:00
libgcc2.c Update copyright years. 2015-01-05 13:33:28 +01:00
libgcc2.h Update copyright years. 2015-01-05 13:33:28 +01:00
libgcc-std.ver.in Update copyright years. 2015-01-05 13:33:28 +01:00
libgcov-driver-system.c re PR gcov-profile/61889 (gcov-tool.c uses nftw, ftw.h) 2015-02-10 15:13:13 +01:00
libgcov-driver.c Update copyright years. 2015-01-05 13:33:28 +01:00
libgcov-interface.c Update copyright years. 2015-01-05 13:33:28 +01:00
libgcov-merge.c Update copyright years. 2015-01-05 13:33:28 +01:00
libgcov-profiler.c Update copyright years. 2015-01-05 13:33:28 +01:00
libgcov-util.c libgcov-util.c: Add space between string literal and macro name. 2015-05-12 16:40:49 +02:00
libgcov.h Update copyright years. 2015-01-05 13:33:28 +01:00
Makefile.in Add --enable-default-pie option to GCC configure 2015-05-27 19:36:55 -07:00
memcmp.c
memcpy.c
memmove.c
memset.c
mkheader.sh Update copyright years. 2015-01-05 13:33:28 +01:00
mkmap-flat.awk Update copyright years. 2015-01-05 13:33:28 +01:00
mkmap-symver.awk Update copyright years. 2015-01-05 13:33:28 +01:00
offloadstuff.c Update copyright years. 2015-01-05 13:33:28 +01:00
shared-object.mk
siditi-object.mk
static-object.mk
sync.c Update copyright years. 2015-01-05 13:33:28 +01:00
udivmod.c Update copyright years. 2015-01-05 13:33:28 +01:00
udivmodsi4.c Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-arm-common.inc Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-c.c Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-compat.c Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-compat.h Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-dw2-fde-compat.c Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-dw2-fde-dip.c unwind fix for musl 2015-04-22 14:20:01 +00:00
unwind-dw2-fde.c Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-dw2-fde.h unwind-dw2-fde.h (last_fde): Use "(const fde *)" instead of "(char *)" to avoid qualifier warning by 'xgcc'... 2015-01-22 09:22:31 -07:00
unwind-dw2.c Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-dw2.h Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-generic.h Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-pe.h Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-seh.c Update copyright years. 2015-01-05 13:33:28 +01:00
unwind-sjlj.c Update copyright years. 2015-01-05 13:33:28 +01:00
unwind.inc Update copyright years. 2015-01-05 13:33:28 +01:00
vtv_end_preinit.c Update copyright years. 2015-01-05 13:33:28 +01:00
vtv_end.c Update copyright years. 2015-01-05 13:33:28 +01:00
vtv_start_preinit.c Update copyright years. 2015-01-05 13:33:28 +01:00
vtv_start.c Update copyright years. 2015-01-05 13:33:28 +01:00