Browse Source

gcc + glibc package update from upstream el7

Signed-off-by: basebuilder_pel7ppc64bebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64bebuilder0 6 years ago
parent
commit
84f24d821e
  1. 506
      SOURCES/cloog-0.18.0-ppc64le-config.patch
  2. 1064
      SOURCES/fastjar-0.97-aarch64-config.patch
  3. 6
      SOURCES/fastjar-0.97-filename0.patch
  4. 4
      SOURCES/fastjar-0.97-len1.patch
  5. 498
      SOURCES/fastjar-0.97-ppc64le-config.patch
  6. 10
      SOURCES/fastjar-0.97-segfault.patch
  7. 40
      SOURCES/fastjar-CVE-2010-0831.patch
  8. 14
      SOURCES/fastjar-man.patch
  9. 9
      SOURCES/gcc48-aarch64-ada.patch
  10. 5
      SOURCES/gcc48-aarch64-async-unw-tables.patch
  11. 212
      SOURCES/gcc48-aarch64-unwind-opt.patch
  12. 26
      SOURCES/gcc48-cloog-dl.patch
  13. 8
      SOURCES/gcc48-cloog-dl2.patch
  14. 10
      SOURCES/gcc48-color-auto.patch
  15. 34
      SOURCES/gcc48-hack.patch
  16. 12
      SOURCES/gcc48-i386-libgomp.patch
  17. 12
      SOURCES/gcc48-java-nomulti.patch
  18. 112
      SOURCES/gcc48-libgo-p224.patch
  19. 806
      SOURCES/gcc48-libgomp-20160715.patch
  20. 7
      SOURCES/gcc48-libgomp-omp_h-multilib.patch
  21. 24
      SOURCES/gcc48-libtool-no-rpath.patch
  22. 10
      SOURCES/gcc48-no-add-needed.patch
  23. 4
      SOURCES/gcc48-ppc32-retaddr.patch
  24. 48
      SOURCES/gcc48-pr28865.patch
  25. 22
      SOURCES/gcc48-pr38757.patch
  26. 16
      SOURCES/gcc48-pr52714.patch
  27. 30
      SOURCES/gcc48-pr53477.patch
  28. 120
      SOURCES/gcc48-pr56564.patch
  29. 2
      SOURCES/gcc48-pr62258.patch
  30. 28
      SOURCES/gcc48-pr63293.patch
  31. 3
      SOURCES/gcc48-pr65142.patch
  32. 4
      SOURCES/gcc48-pr66731.patch
  33. 16
      SOURCES/gcc48-pr66840.patch
  34. 50
      SOURCES/gcc48-pr67281.patch
  35. 6
      SOURCES/gcc48-pr68680.patch
  36. 6
      SOURCES/gcc48-pr69116.patch
  37. 8
      SOURCES/gcc48-pr69644.patch
  38. 4
      SOURCES/gcc48-pr70549.patch
  39. 87
      SOURCES/gcc48-pr72717.patch
  40. 2
      SOURCES/gcc48-pr72747.patch
  41. 8
      SOURCES/gcc48-pr72863.patch
  42. 12
      SOURCES/gcc48-pr77375.patch
  43. 8
      SOURCES/gcc48-pr77767.patch
  44. 2
      SOURCES/gcc48-pr78064.patch
  45. 13
      SOURCES/gcc48-pr78378.patch
  46. 54
      SOURCES/gcc48-pr78416.patch
  47. 2
      SOURCES/gcc48-pr78796.patch
  48. 22
      SOURCES/gcc48-pr78875.patch
  49. 8
      SOURCES/gcc48-pr79439.patch
  50. 2
      SOURCES/gcc48-pr79969.patch
  51. 16
      SOURCES/gcc48-pr80129.patch
  52. 8
      SOURCES/gcc48-pr80362.patch
  53. 4
      SOURCES/gcc48-pr80692.patch
  54. 67
      SOURCES/gcc48-pr81395.patch
  55. 12
      SOURCES/gcc48-pr82274.patch
  56. 74
      SOURCES/gcc48-rh1180633.patch
  57. 10
      SOURCES/gcc48-rh1243366.patch
  58. 22
      SOURCES/gcc48-rh1278872.patch
  59. 2
      SOURCES/gcc48-rh1296211.patch
  60. 120
      SOURCES/gcc48-rh1304449.patch
  61. 22
      SOURCES/gcc48-rh1312436.patch
  62. 12
      SOURCES/gcc48-rh1344807.patch
  63. 6
      SOURCES/gcc48-rh1369183.patch
  64. 40
      SOURCES/gcc48-rh1402585.patch
  65. 28
      SOURCES/gcc48-rh1468546.patch
  66. 16
      SOURCES/gcc48-rh1469384.patch
  67. 12
      SOURCES/gcc48-rh1469697-1.patch
  68. 9
      SOURCES/gcc48-rh1469697-10.patch
  69. 68
      SOURCES/gcc48-rh1469697-11.patch
  70. 13
      SOURCES/gcc48-rh1469697-12.patch
  71. 6
      SOURCES/gcc48-rh1469697-13.patch
  72. 10
      SOURCES/gcc48-rh1469697-14.patch
  73. 74
      SOURCES/gcc48-rh1469697-15.patch
  74. 68
      SOURCES/gcc48-rh1469697-16.patch
  75. 8
      SOURCES/gcc48-rh1469697-17.patch
  76. 104
      SOURCES/gcc48-rh1469697-18.patch
  77. 30
      SOURCES/gcc48-rh1469697-19.patch
  78. 36
      SOURCES/gcc48-rh1469697-2.patch
  79. 14
      SOURCES/gcc48-rh1469697-20.patch
  80. 24
      SOURCES/gcc48-rh1469697-21.patch
  81. 22
      SOURCES/gcc48-rh1469697-22.patch
  82. 18
      SOURCES/gcc48-rh1469697-23.patch
  83. 84
      SOURCES/gcc48-rh1469697-3.patch
  84. 72
      SOURCES/gcc48-rh1469697-4.patch
  85. 7
      SOURCES/gcc48-rh1469697-5.patch
  86. 37
      SOURCES/gcc48-rh1469697-6.patch
  87. 30
      SOURCES/gcc48-rh1469697-7.patch
  88. 55
      SOURCES/gcc48-rh1469697-8.patch
  89. 94
      SOURCES/gcc48-rh1469697-9.patch
  90. 20
      SOURCES/gcc48-rh1482762.patch
  91. 34
      SOURCES/gcc48-rh1487434.patch
  92. 8
      SOURCES/gcc48-rh1491395.patch
  93. 6
      SOURCES/gcc48-rh1535655-1.patch
  94. 76
      SOURCES/gcc48-rh1535655-2.patch
  95. 170
      SOURCES/gcc48-rh1535655-3.patch
  96. 141
      SOURCES/gcc48-rh1535655-4.patch
  97. 20
      SOURCES/gcc48-rh1535655-5.patch
  98. 16
      SOURCES/gcc48-rh1535655-6.patch
  99. 38
      SOURCES/gcc48-rh1537828-1.patch
  100. 91
      SOURCES/gcc48-rh1537828-10.patch
  101. Some files were not shown because too many files have changed in this diff Show More

506
SOURCES/cloog-0.18.0-ppc64le-config.patch

@ -3,36 +3,36 @@ @@ -3,36 +3,36 @@
@@ -1312,7 +1312,7 @@
rm -rf conftest*
;;

-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -1326,7 +1326,10 @@
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -1345,7 +1348,10 @@
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
--- cloog-0.18.0/autoconf/config.sub.jj 2013-10-11 09:27:45.000000000 +0200
+++ cloog-0.18.0/autoconf/config.sub 2014-04-10 10:38:39.000000000 +0200
@@ -1,24 +1,18 @@
@ -79,8 +79,8 @@ @@ -79,8 +79,8 @@
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").


-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
@ -90,12 +90,12 @@ @@ -90,12 +90,12 @@
@@ -73,9 +68,7 @@ Report bugs and patches to <config-patch
version="\
GNU config.sub ($timestamp)

-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -123,7 +116,7 @@ esac
@ -108,214 +108,214 @@ @@ -108,214 +108,214 @@
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
@@ -156,7 +149,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze)
+ -apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
os=
basic_machine=$1
;;
@@ -259,10 +252,12 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
- | be32 | be64 \
+ | arc | arceb \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | be32 | be64 \
| bfin \
| bfin \
- | c4x | clipper \
+ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
@@ -270,10 +265,11 @@ case $basic_machine in
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -291,16 +287,17 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
- | nios | nios2 \
+ | nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
| ns16k | ns32k \
| open8 \
- | or32 \
+ | or1k | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
@@ -328,7 +325,7 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -370,13 +367,13 @@ case $basic_machine in
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
- | clipper-* | craynv-* | cydra-* \
+ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
@@ -385,11 +382,13 @@ case $basic_machine in
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -407,12 +406,13 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
@@ -788,11 +788,15 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
basic_machine=ns32k-utek
os=-sysv
;;
- microblaze)
+ microblaze*)
basic_machine=microblaze-xilinx
;;
basic_machine=microblaze-xilinx
;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
mingw32)
mingw32)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
os=-mingw32
;;
mingw32ce)
@@ -828,7 +832,7 @@ case $basic_machine in
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-msys
;;
mvs)
os=-msys
;;
mvs)
@@ -1019,7 +1023,11 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
basic_machine=i586-unknown
os=-pw32
;;
- rdos)
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
basic_machine=i386-pc
os=-rdos
;;
basic_machine=i386-pc
os=-rdos
;;
@@ -1346,21 +1354,21 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* \
+ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -openbsd* | -solidbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1492,9 +1500,6 @@ case $os in
-aros*)
os=-aros
;;
-aros*)
os=-aros
;;
- -kaos*)
- os=-kaos
- ;;
-zvmoe)
os=-zvmoe
;;
-zvmoe)
os=-zvmoe
;;
@@ -1543,6 +1548,9 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
c4x-* | tic4x-*)
os=-coff
;;
+ c8051-*)
+ os=-elf
+ ;;
hexagon-*)
os=-elf
;;
hexagon-*)
os=-elf
;;
@@ -1586,6 +1594,9 @@ case $basic_machine in
mips*-*)
os=-elf
;;
mips*-*)
os=-elf
;;
+ or1k-*)
+ os=-elf
+ ;;
or32-*)
os=-coff
;;
or32-*)
os=-coff
;;
--- cloog-0.18.0/autoconf/config.guess.jj 2013-10-11 09:27:45.000000000 +0200
+++ cloog-0.18.0/autoconf/config.guess 2014-04-10 10:38:36.000000000 +0200
@@ -1,14 +1,12 @@
@ -325,10 +325,10 @@ @@ -325,10 +325,10 @@
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright 1992-2013 Free Software Foundation, Inc.

-timestamp='2012-02-10'
+timestamp='2013-06-10'

# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
@ -360,24 +360,24 @@ @@ -360,24 +360,24 @@
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+

me=`echo "$0" | sed -e 's,.*/,,'`

@@ -54,9 +50,7 @@ version="\
GNU config.guess ($timestamp)

Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` |
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
@ -400,68 +400,68 @@ @@ -400,68 +400,68 @@
+esac
+
# Note: order is significant - the case branches are not exclusive.

case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -200,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+ exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -302,7 +321,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -801,6 +820,9 @@ EOF
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
@@ -852,21 +874,21 @@ EOF
exit ;;
exit ;;
*:GNU:*:*)
# the GNU system
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -879,59 +901,54 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
@ -469,46 +469,46 @@ @@ -469,46 +469,46 @@
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
fi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
exit ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
exit ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
i*86:Linux:*:*)
- LIBC=gnu
- eval $set_cc_for_build
@ -520,58 +520,58 @@ @@ -520,58 +520,58 @@
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
eval $set_cc_for_build
@@ -950,54 +967,63 @@ EOF
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
;;
+ or1k:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
or32:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
+ echo sparc-unknown-linux-${LIBC}
exit ;;
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
+ echo hppa64-unknown-linux-${LIBC}
exit ;;
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+ *) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
esac
exit ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
+ echo powerpc64-unknown-linux-${LIBC}
exit ;;
exit ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
+ echo powerpc-unknown-linux-${LIBC}
@ -581,55 +581,55 @@ @@ -581,55 +581,55 @@
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-unknown-linux-${LIBC}
exit ;;
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-gnu
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1201,6 +1227,9 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
echo i586-pc-haiku
exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1227,19 +1256,21 @@ EOF
exit ;;
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- i386)
- eval $set_cc_for_build
@ -658,22 +658,22 @@ @@ -658,22 +658,22 @@
+ esac
+ fi
+ fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1256,7 +1287,7 @@ EOF
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
+ NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@@ -1330,9 +1361,6 @@ EOF
exit ;;
exit ;;
esac

-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
@ -685,33 +685,33 @@ @@ -685,33 +685,33 @@
@@ -6383,7 +6383,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;

-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -1326,7 +1326,10 @@
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -1345,7 +1348,10 @@
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)

1064
SOURCES/fastjar-0.97-aarch64-config.patch

File diff suppressed because it is too large Load Diff

6
SOURCES/fastjar-0.97-filename0.patch

@ -5,9 +5,9 @@ @@ -5,9 +5,9 @@
--- fastjar-0.97/jartool.c 6 Sep 2009 22:16:00 -0000 1.59
+++ fastjar-0.97/jartool.c 1 Mar 2010 15:38:43 -0000 1.60
@@ -790,6 +790,7 @@ int read_entries (int fd)
progname, jarfile);
return 1;
}
progname, jarfile);
return 1;
}
+ ze->filename[len] = '\0';
len = UNPACK_UB4(header, CEN_EFLEN);
len += UNPACK_UB4(header, CEN_COMLEN);

4
SOURCES/fastjar-0.97-len1.patch

@ -7,10 +7,10 @@ @@ -7,10 +7,10 @@
+++ fastjar-0.97/jartool.c 2009-12-22 06:48:09.309530000 -0500
@@ -1257,7 +1257,7 @@ int add_file_to_jar(int jfd, int ffd, co
exit_on_error("write");

/* write the file name to the zip file */
- if (1 == write(jfd, fname, file_name_length))
+ if (-1 == write(jfd, fname, file_name_length))
exit_on_error("write");

if(verbose){

498
SOURCES/fastjar-0.97-ppc64le-config.patch

@ -3,36 +3,36 @@ @@ -3,36 +3,36 @@
@@ -1263,7 +1263,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;

-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -1277,7 +1277,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -1296,7 +1299,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
--- fastjar-0.97/config.sub.jj 2014-04-10 20:40:53.000000000 +0200
+++ fastjar-0.97/config.sub 2014-04-10 10:38:39.000000000 +0200
@@ -1,24 +1,18 @@
@ -79,8 +79,8 @@ @@ -79,8 +79,8 @@
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").


-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
@ -90,12 +90,12 @@ @@ -90,12 +90,12 @@
@@ -73,9 +68,7 @@ Report bugs and patches to <config-patch
version="\
GNU config.sub ($timestamp)

-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -123,7 +116,7 @@ esac
@ -108,214 +108,214 @@ @@ -108,214 +108,214 @@
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
@@ -156,7 +149,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze)
+ -apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
os=
basic_machine=$1
;;
@@ -259,10 +252,12 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
- | be32 | be64 \
+ | arc | arceb \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | be32 | be64 \
| bfin \
| bfin \
- | c4x | clipper \
+ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
@@ -270,10 +265,11 @@ case $basic_machine in
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -291,16 +287,17 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
- | nios | nios2 \
+ | nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
| ns16k | ns32k \
| open8 \
- | or32 \
+ | or1k | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
@@ -328,7 +325,7 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -370,13 +367,13 @@ case $basic_machine in
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
- | clipper-* | craynv-* | cydra-* \
+ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
@@ -385,11 +382,13 @@ case $basic_machine in
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -407,12 +406,13 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
@@ -788,11 +788,15 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
basic_machine=ns32k-utek
os=-sysv
;;
- microblaze)
+ microblaze*)
basic_machine=microblaze-xilinx
;;
basic_machine=microblaze-xilinx
;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
mingw32)
mingw32)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
os=-mingw32
;;
mingw32ce)
@@ -828,7 +832,7 @@ case $basic_machine in
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-msys
;;
mvs)
os=-msys
;;
mvs)
@@ -1019,7 +1023,11 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
basic_machine=i586-unknown
os=-pw32
;;
- rdos)
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
basic_machine=i386-pc
os=-rdos
;;
basic_machine=i386-pc
os=-rdos
;;
@@ -1346,21 +1354,21 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* \
+ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -openbsd* | -solidbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1492,9 +1500,6 @@ case $os in
-aros*)
os=-aros
;;
-aros*)
os=-aros
;;
- -kaos*)
- os=-kaos
- ;;
-zvmoe)
os=-zvmoe
;;
-zvmoe)
os=-zvmoe
;;
@@ -1543,6 +1548,9 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
c4x-* | tic4x-*)
os=-coff
;;
+ c8051-*)
+ os=-elf
+ ;;
hexagon-*)
os=-elf
;;
hexagon-*)
os=-elf
;;
@@ -1586,6 +1594,9 @@ case $basic_machine in
mips*-*)
os=-elf
;;
mips*-*)
os=-elf
;;
+ or1k-*)
+ os=-elf
+ ;;
or32-*)
os=-coff
;;
or32-*)
os=-coff
;;
--- fastjar-0.97/config.guess.jj 2014-04-10 20:40:53.000000000 +0200
+++ fastjar-0.97/config.guess 2014-04-10 10:38:36.000000000 +0200
@@ -1,14 +1,12 @@
@ -325,10 +325,10 @@ @@ -325,10 +325,10 @@
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright 1992-2013 Free Software Foundation, Inc.

-timestamp='2012-06-10'
+timestamp='2013-06-10'

# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
@ -360,24 +360,24 @@ @@ -360,24 +360,24 @@
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+

me=`echo "$0" | sed -e 's,.*/,,'`

@@ -54,9 +50,7 @@ version="\
GNU config.guess ($timestamp)

Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` |
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
@ -400,68 +400,68 @@ @@ -400,68 +400,68 @@
+esac
+
# Note: order is significant - the case branches are not exclusive.

case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -200,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+ exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -302,7 +321,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -801,6 +820,9 @@ EOF
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
@@ -852,21 +874,21 @@ EOF
exit ;;
exit ;;
*:GNU:*:*)
# the GNU system
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -879,59 +901,54 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
@ -469,46 +469,46 @@ @@ -469,46 +469,46 @@
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
fi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
exit ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
exit ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
i*86:Linux:*:*)
- LIBC=gnu
- eval $set_cc_for_build
@ -520,58 +520,58 @@ @@ -520,58 +520,58 @@
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
eval $set_cc_for_build
@@ -950,54 +967,63 @@ EOF
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
;;
+ or1k:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
or32:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
+ echo sparc-unknown-linux-${LIBC}
exit ;;
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
+ echo hppa64-unknown-linux-${LIBC}
exit ;;
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+ *) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
esac
exit ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
+ echo powerpc64-unknown-linux-${LIBC}
exit ;;
exit ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
+ echo powerpc-unknown-linux-${LIBC}
@ -581,55 +581,55 @@ @@ -581,55 +581,55 @@
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-unknown-linux-${LIBC}
exit ;;
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-gnu
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1201,6 +1227,9 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
echo i586-pc-haiku
exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1227,19 +1256,21 @@ EOF
exit ;;
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- i386)
- eval $set_cc_for_build
@ -658,13 +658,13 @@ @@ -658,13 +658,13 @@
+ esac
+ fi
+ fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1330,9 +1361,6 @@ EOF
exit ;;
exit ;;
esac

-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
@ -676,33 +676,33 @@ @@ -676,33 +676,33 @@
@@ -6918,7 +6918,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;

-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6936,7 +6936,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6955,7 +6958,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)

10
SOURCES/fastjar-0.97-segfault.patch

@ -8,18 +8,18 @@ @@ -8,18 +8,18 @@
@@ -820,6 +820,10 @@ int make_manifest(int jfd, const char *m
int mod_time; /* file modification time */
struct zipentry *ze;

+ current_time = time(NULL);
+ if(current_time == (time_t)-1)
+ exit_on_error("time");
+
mod_time = unix2dostime(&current_time);

mod_time = unix2dostime(&current_time);
/* If we are creating a new manifest, create a META-INF directory entry */
@@ -828,10 +832,6 @@ int make_manifest(int jfd, const char *m

memset((file_header + 12), '\0', 16); /*clear mod time, crc, size fields*/

- current_time = time(NULL);
- if(current_time == (time_t)-1)
- exit_on_error("time");

40
SOURCES/fastjar-CVE-2010-0831.patch

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
@@ -1730,7 +1730,17 @@ int extract_jar(int fd, const char **fil
struct stat sbuf;
int depth = 0;

- tmp_buff = malloc(sizeof(char) * strlen((const char *)filename));
+ if(*filename == '/'){
+ fprintf(stderr, "Absolute path names are not allowed.\n");
@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
+ fprintf(stderr, "Out of memory.\n");
+ exit(EXIT_FAILURE);
+ }

for(;;){
const ub1 *idx = (const unsigned char *)strchr((const char *)start, '/');
@@ -1738,25 +1748,28 @@ int extract_jar(int fd, const char **fil
@ -35,25 +35,25 @@ @@ -35,25 +35,25 @@
continue;
}
- start = idx + 1;

- strncpy(tmp_buff, (const char *)filename, (idx - filename));
- tmp_buff[(idx - filename)] = '\0';
+ memcpy(tmp_buff + (start - filename), (const char *)start, (idx - start));
+ tmp_buff[idx - filename] = '\0';

#ifdef DEBUG
#ifdef DEBUG
printf("checking the existance of %s\n", tmp_buff);
#endif
- if(strcmp(tmp_buff, "..") == 0){
+ if(idx - start == 2 && memcmp(start, "..", 2) == 0){
--depth;
if (depth < 0){
fprintf(stderr, "Traversal to parent directories during unpacking!\n");
exit(EXIT_FAILURE);
}
--depth;
if (depth < 0){
fprintf(stderr, "Traversal to parent directories during unpacking!\n");
exit(EXIT_FAILURE);
}
- } else if (strcmp(tmp_buff, ".") != 0)
+ } else if (idx - start != 1 || *start != '.')
++depth;
++depth;
+
+ start = idx + 1;
+
@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
if(errno != ENOENT)
exit_on_error("stat");
@@ -1765,6 +1778,7 @@ int extract_jar(int fd, const char **fil
#ifdef DEBUG
#ifdef DEBUG
printf("Directory exists\n");
#endif
+ tmp_buff[idx - filename] = '/';
@ -71,32 +71,32 @@ @@ -71,32 +71,32 @@
@@ -1781,10 +1795,11 @@ int extract_jar(int fd, const char **fil
if(verbose && handle)
printf("%10s: %s/\n", "created", tmp_buff);

+ tmp_buff[idx - filename] = '/';
}

/* only a directory */
- if(strlen((const char *)start) == 0)
+ if(*start == '\0')
dir = TRUE;

#ifdef DEBUG
#ifdef DEBUG
@@ -1792,7 +1807,7 @@ int extract_jar(int fd, const char **fil
#endif

/* If the entry was just a directory, don't write to file, etc */
- if(strlen((const char *)start) == 0)
+ if(*start == '\0')
f_fd = -1;

free(tmp_buff);
@@ -1876,7 +1891,8 @@ int extract_jar(int fd, const char **fil
exit(EXIT_FAILURE);
}

- close(f_fd);
+ if (f_fd != -1)
+ close(f_fd);

if(verbose && dir == FALSE && handle)
printf("%10s: %s\n",

14
SOURCES/fastjar-man.patch

@ -6,22 +6,22 @@ @@ -6,22 +6,22 @@
--- fastjar-0.97/Makefile.am.jj 2008-10-16 04:24:55.000000000 -0400
+++ fastjar-0.97/Makefile.am 2010-06-21 09:29:41.021398000 -0400
@@ -39,7 +39,7 @@ EXTRA_DIST = \
texi2pod.pl

texi2pod.pl
TEXI2POD = perl $(srcdir)/texi2pod.pl
-POD2MAN = pod2man --center="GNU" --release=@VERSION@
+POD2MAN = pod2man --center="GNU" --release=@VERSION@ --date=$(shell sed -n '1s/ .*//p' <$(srcdir)/ChangeLog)

.pod.1:
-($(POD2MAN) --section=1 $< > $(@).T$$$$ && \
-($(POD2MAN) --section=1 $< > $(@).T$$$$ && \
--- fastjar-0.97/Makefile.in.jj 2008-10-16 04:15:16.000000000 -0400
+++ fastjar-0.97/Makefile.in 2010-06-21 09:30:15.882810000 -0400
@@ -515,7 +515,7 @@ EXTRA_DIST = \
texi2pod.pl

texi2pod.pl
TEXI2POD = perl $(srcdir)/texi2pod.pl
-POD2MAN = pod2man --center="GNU" --release=@VERSION@
+POD2MAN = pod2man --center="GNU" --release=@VERSION@ --date=$(shell sed -n '1s/ .*//p' <$(srcdir)/ChangeLog)

#SPLINT_FLAGS=-I . -I $(srcdir)/lib -I $(srcdir) -DHAVE_CONFIG_H +posixlib +weak
SPLINT_FLAGS = -I . -I $(srcdir)/lib -I $(srcdir) -DHAVE_CONFIG_H -DPRIx32= -warnposix +weak

9
SOURCES/gcc48-aarch64-ada.patch

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
@@ -2123,6 +2123,44 @@ ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
LIBRARY_VERSION := $(LIB_VERSION)
endif

+# AArch64 Linux
+ifeq ($(strip $(filter-out aarch64% linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
@@ -562,7 +562,9 @@ __gnat_error_handler (int sig, siginfo_t *si ATTRIBUTE_UNUSED, void *ucontext)
Raise_From_Signal_Handler (exception, msg);
}

-#if defined (i386) || defined (__x86_64__) || defined (__powerpc__)
+#if defined (i386) || defined (__x86_64__) || defined (__powerpc__) \
+ || defined (__aarch64__)
@ -67,7 +67,7 @@ @@ -67,7 +67,7 @@
@@ -603,7 +605,7 @@ __gnat_install_handler (void)
handled properly, avoiding a SEGV generation from stack usage by the
handler itself. */

-#if defined (i386) || defined (__x86_64__) || defined (__powerpc__)
+#ifdef HAVE_GNAT_ALTERNATE_STACK
stack_t stack;
@ -91,5 +91,6 @@ @@ -91,5 +91,6 @@
-typedef struct {const char *Array; String_Template *Bounds; }
- __attribute ((aligned (sizeof (char *) * 2))) Fat_Pointer;
+typedef struct {const char *Array; String_Template *Bounds; } Fat_Pointer;

/* Types for Node/Entity Kinds: */

5
SOURCES/gcc48-aarch64-async-unw-tables.patch

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
@@ -39,6 +39,9 @@
#undef TARGET_OPTION_OPTIMIZATION_TABLE
#define TARGET_OPTION_OPTIMIZATION_TABLE aarch_option_optimization_table

+#undef TARGET_OPTION_INIT_STRUCT
+#define TARGET_OPTION_INIT_STRUCT aarch64_option_init_struct
+
@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
@@ -47,6 +50,16 @@ static const struct default_options aarch_option_optimization_table[] =
{ OPT_LEVELS_NONE, 0, NULL, 0 }
};

+/* Implement TARGET_OPTION_INIT_STRUCT. */
+
+static void
@ -32,3 +32,4 @@ @@ -32,3 +32,4 @@
+
/* Implement TARGET_HANDLE_OPTION.
This function handles the target specific options for CPU/target selection.

212
SOURCES/gcc48-aarch64-unwind-opt.patch

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
--- gcc/config/aarch64/aarch64.c 2014-07-15 02:27:16.000000000 -0700
+++ gcc/config/aarch64/aarch64.c 2014-08-21 12:52:44.190455860 -0700
@@ -1603,24 +1603,23 @@ aarch64_register_saved_on_entry (int reg

static void
aarch64_save_or_restore_fprs (int start_offset, int increment,
- bool restore, rtx base_rtx)
@ -22,38 +22,38 @@ @@ -22,38 +22,38 @@
unsigned regno2;
rtx insn;
rtx (*gen_mem_ref)(enum machine_mode, rtx) = (frame_pointer_needed)? gen_frame_mem : gen_rtx_MEM;

-
for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++)
{
if (aarch64_register_saved_on_entry (regno))
{
{
- rtx mem;
+ rtx mem, reg1;
mem = gen_mem_ref (DFmode,
plus_constant (Pmode,
base_rtx,
start_offset));
mem = gen_mem_ref (DFmode,
plus_constant (Pmode,
base_rtx,
start_offset));
+ reg1 = gen_rtx_REG (DFmode, regno);

for (regno2 = regno + 1;
regno2 <= V31_REGNUM
for (regno2 = regno + 1;
regno2 <= V31_REGNUM
@@ -1632,54 +1631,51 @@ aarch64_save_or_restore_fprs (int start_
if (regno2 <= V31_REGNUM &&
aarch64_register_saved_on_entry (regno2))
{
if (regno2 <= V31_REGNUM &&
aarch64_register_saved_on_entry (regno2))
{
- rtx mem2;
+ rtx mem2, reg2;
/* Next highest register to be saved. */
mem2 = gen_mem_ref (DFmode,
plus_constant
(Pmode,
base_rtx,
start_offset + increment));
/* Next highest register to be saved. */
mem2 = gen_mem_ref (DFmode,
plus_constant
(Pmode,
base_rtx,
start_offset + increment));
+ reg2 = gen_rtx_REG (DFmode, regno2);
+
if (restore == false)
{
if (restore == false)
{
- insn = emit_insn
- ( gen_store_pairdf (mem, gen_rtx_REG (DFmode, regno),
- mem2, gen_rtx_REG (DFmode, regno2)));
@ -65,9 +65,9 @@ @@ -65,9 +65,9 @@
+ frame-related if explicitly marked. */
+ RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0, 1)) = 1;
+ RTX_FRAME_RELATED_P (insn) = 1;
}
else
{
}
else
{
- insn = emit_insn
- ( gen_load_pairdf (gen_rtx_REG (DFmode, regno), mem,
- gen_rtx_REG (DFmode, regno2), mem2));
@ -77,41 +77,41 @@ @@ -77,41 +77,41 @@
+ emit_insn (gen_load_pairdf (reg1, mem, reg2, mem2));
+ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg1, *cfi_ops);
+ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg2, *cfi_ops);
}

}
- /* The first part of a frame-related parallel insn
- is always assumed to be relevant to the frame
- calculations; subsequent parts, are only
- frame-related if explicitly marked. */
- RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0,
- 1)) = 1;
regno = regno2;
start_offset += increment * 2;
}
else
{
if (restore == false)
regno = regno2;
start_offset += increment * 2;
}
else
{
if (restore == false)
- insn = emit_move_insn (mem, gen_rtx_REG (DFmode, regno));
+ {
+ insn = emit_move_insn (mem, reg1);
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
else
{
else
{
- insn = emit_move_insn (gen_rtx_REG (DFmode, regno), mem);
- add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (DImode, regno));
+ emit_move_insn (reg1, mem);
+ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg1, *cfi_ops);
}
start_offset += increment;
}
}
start_offset += increment;
}
- RTX_FRAME_RELATED_P (insn) = 1;
}
}
}
-
}


@@ -1687,13 +1683,14 @@ aarch64_save_or_restore_fprs (int start_
restore's have to happen. */
static void
@ -132,34 +132,34 @@ @@ -132,34 +132,34 @@
@@ -1702,11 +1699,13 @@ aarch64_save_or_restore_callee_save_regi
{
if (aarch64_register_saved_on_entry (regno))
{
{
- rtx mem;
+ rtx mem, reg1;
+
mem = gen_mem_ref (Pmode,
plus_constant (Pmode,
base_rtx,
start_offset));
mem = gen_mem_ref (Pmode,
plus_constant (Pmode,
base_rtx,
start_offset));
+ reg1 = gen_rtx_REG (DImode, regno);

for (regno2 = regno + 1;
regno2 <= limit
for (regno2 = regno + 1;
regno2 <= limit
@@ -1718,56 +1717,54 @@ aarch64_save_or_restore_callee_save_regi
if (regno2 <= limit &&
aarch64_register_saved_on_entry (regno2))
{
if (regno2 <= limit &&
aarch64_register_saved_on_entry (regno2))
{
- rtx mem2;
+ rtx mem2, reg2;
/* Next highest register to be saved. */
mem2 = gen_mem_ref (Pmode,
plus_constant
(Pmode,
base_rtx,
start_offset + increment));
/* Next highest register to be saved. */
mem2 = gen_mem_ref (Pmode,
plus_constant
(Pmode,
base_rtx,
start_offset + increment));
+ reg2 = gen_rtx_REG (DImode, regno2);
+
if (restore == false)
{
if (restore == false)
{
- insn = emit_insn
- ( gen_store_pairdi (mem, gen_rtx_REG (DImode, regno),
- mem2, gen_rtx_REG (DImode, regno2)));
@ -171,9 +171,9 @@ @@ -171,9 +171,9 @@
+ frame-related if explicitly marked. */
+ RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0, 1)) = 1;
+ RTX_FRAME_RELATED_P (insn) = 1;
}
else
{
}
else
{
- insn = emit_insn
- ( gen_load_pairdi (gen_rtx_REG (DImode, regno), mem,
- gen_rtx_REG (DImode, regno2), mem2));
@ -183,66 +183,66 @@ @@ -183,66 +183,66 @@
+ emit_insn (gen_load_pairdi (reg1, mem, reg2, mem2));
+ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg1, *cfi_ops);
+ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg2, *cfi_ops);
}

}
- /* The first part of a frame-related parallel insn
- is always assumed to be relevant to the frame
- calculations; subsequent parts, are only
- frame-related if explicitly marked. */
- RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0,
- 1)) = 1;
regno = regno2;
start_offset += increment * 2;
}
else
{
if (restore == false)
regno = regno2;
start_offset += increment * 2;
}
else
{
if (restore == false)
- insn = emit_move_insn (mem, gen_rtx_REG (DImode, regno));
+ {
+ insn = emit_move_insn (mem, reg1);
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
else
{
else
{
- insn = emit_move_insn (gen_rtx_REG (DImode, regno), mem);
- add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (DImode, regno));
+ emit_move_insn (reg1, mem);
+ *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg1, *cfi_ops);
}
start_offset += increment;
}
}
start_offset += increment;
}
- RTX_FRAME_RELATED_P (insn) = 1;
}
}
}

- aarch64_save_or_restore_fprs (start_offset, increment, restore, base_rtx);
-
+ aarch64_save_or_restore_fprs (start_offset, increment, restore,
+ base_rtx, cfi_ops);
}

/* AArch64 stack frames generated by this compiler look like:
@@ -1966,7 +1963,7 @@ aarch64_expand_prologue (void)
}

}
aarch64_save_or_restore_callee_save_registers
- (fp_offset + cfun->machine->frame.hardfp_offset, 0);
+ (fp_offset + cfun->machine->frame.hardfp_offset, 0, NULL);
}

/* when offset >= 512,
@@ -1991,6 +1988,7 @@ aarch64_expand_epilogue (bool for_sibcal
HOST_WIDE_INT fp_offset;
rtx insn;
rtx cfa_reg;
+ rtx cfi_ops = NULL;

aarch64_layout_frame ();
original_frame_size = get_frame_size () + cfun->machine->saved_varargs_size;
@@ -2035,15 +2033,17 @@ aarch64_expand_epilogue (bool for_sibcal
insn = emit_insn (gen_add3_insn (stack_pointer_rtx,
hard_frame_pointer_rtx,
GEN_INT (- fp_offset)));
hard_frame_pointer_rtx,
GEN_INT (- fp_offset)));
+ /* CFA should be calculated from the value of SP from now on. */
+ add_reg_note (insn, REG_CFA_ADJUST_CFA,
+ gen_rtx_SET (VOIDmode, stack_pointer_rtx,
@ -254,26 +254,26 @@ @@ -254,26 +254,26 @@
- from the value of SP from now on. */
cfa_reg = stack_pointer_rtx;
}

aarch64_save_or_restore_callee_save_registers
- (fp_offset + cfun->machine->frame.hardfp_offset, 1);
+ (fp_offset + cfun->machine->frame.hardfp_offset, 1, &cfi_ops);

/* Restore the frame pointer and lr if the frame pointer is needed. */
if (offset > 0)
@@ -2051,6 +2051,8 @@ aarch64_expand_epilogue (bool for_sibcal
if (frame_pointer_needed)
{
rtx mem_fp, mem_lr;
{
rtx mem_fp, mem_lr;
+ rtx reg_fp = hard_frame_pointer_rtx;
+ rtx reg_lr = gen_rtx_REG (DImode, LR_REGNUM);

if (fp_offset)
{
if (fp_offset)
{
@@ -2063,52 +2065,36 @@ aarch64_expand_epilogue (bool for_sibcal
stack_pointer_rtx,
fp_offset
+ UNITS_PER_WORD));
stack_pointer_rtx,
fp_offset
+ UNITS_PER_WORD));
- insn = emit_insn (gen_load_pairdi (hard_frame_pointer_rtx,
- mem_fp,
- gen_rtx_REG (DImode,
@ -283,10 +283,10 @@ @@ -283,10 +283,10 @@
+
+ insn = emit_insn (gen_add2_insn (stack_pointer_rtx,
+ GEN_INT (offset)));
}
else
{
insn = emit_insn (gen_loadwb_pairdi_di
}
else
{
insn = emit_insn (gen_loadwb_pairdi_di
- (stack_pointer_rtx,
- stack_pointer_rtx,
- hard_frame_pointer_rtx,
@ -294,7 +294,7 @@ @@ -294,7 +294,7 @@
- GEN_INT (offset),
+ (stack_pointer_rtx, stack_pointer_rtx,
+ reg_fp, reg_lr, GEN_INT (offset),
GEN_INT (GET_MODE_SIZE (DImode) + offset)));
GEN_INT (GET_MODE_SIZE (DImode) + offset)));
- RTX_FRAME_RELATED_P (XVECEXP (PATTERN (insn), 0, 2)) = 1;
- add_reg_note (insn, REG_CFA_ADJUST_CFA,
- (gen_rtx_SET (Pmode, stack_pointer_rtx,
@ -317,16 +317,16 @@ @@ -317,16 +317,16 @@
- insn = emit_insn (gen_add2_insn (stack_pointer_rtx,
- GEN_INT (offset)));
- RTX_FRAME_RELATED_P (insn) = 1;
}
}
+ cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg_fp, cfi_ops);
+ cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg_lr, cfi_ops);
}
}
else
{
insn = emit_insn (gen_add2_insn (stack_pointer_rtx,
GEN_INT (offset)));
{
insn = emit_insn (gen_add2_insn (stack_pointer_rtx,
GEN_INT (offset)));
- RTX_FRAME_RELATED_P (insn) = 1;
}
}
+ cfi_ops = alloc_reg_note (REG_CFA_ADJUST_CFA,
+ gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ plus_constant (Pmode, cfa_reg,
@ -337,6 +337,6 @@ @@ -337,6 +337,6 @@
}
+ else
+ gcc_assert (cfi_ops == NULL);

/* Stack adjustment for exception handler. */
if (crtl->calls_eh_return)

26
SOURCES/gcc48-cloog-dl.patch

@ -3,16 +3,16 @@ @@ -3,16 +3,16 @@
@@ -1022,7 +1022,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
# and the system's installed libraries.
LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
$(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
$(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
-BACKENDLIBS = $(CLOOGLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
+BACKENDLIBS = $(if $(CLOOGLIBS),-ldl) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
$(ZLIB)
$(ZLIB)
# Any system libraries needed just for GNAT.
SYSLIBS = @GNAT_LIBEXC@
@@ -3442,6 +3442,15 @@ $(common_out_object_file): $(common_out_
$(DIAGNOSTIC_CORE_H) $(FLAGS_H) $(OPTS_H) $(TM_H) $(TM_P_H) $(MACHMODE_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
$< $(OUTPUT_OPTION)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
$< $(OUTPUT_OPTION)
+
+graphite%.o : \
+ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
@@ -22,6 +22,369 @@ along with GCC; see the file COPYING3.
#ifndef GCC_GRAPHITE_POLY_H
#define GCC_GRAPHITE_POLY_H

+#include <isl/aff.h>
+#include <isl/schedule.h>
+#include <isl/ilp.h>
@ -395,14 +395,14 @@ @@ -395,14 +395,14 @@
+#define stmt_user (*cloog_pointers__.p_stmt_user)
+
typedef struct poly_dr *poly_dr_p;

typedef struct poly_bb *poly_bb_p;
--- gcc/graphite.c.jj 2012-12-13 11:31:00.000000000 +0100
+++ gcc/graphite.c 2012-12-14 13:40:44.155136961 +0100
@@ -66,6 +66,34 @@ along with GCC; see the file COPYING3.

CloogState *cloog_state;

+__typeof (cloog_pointers__) cloog_pointers__;
+
+static bool
@ -432,12 +432,12 @@ @@ -432,12 +432,12 @@
+}
+
/* Print global statistics to FILE. */

static void
@@ -264,6 +292,15 @@ graphite_transform_loops (void)
if (parallelized_function_p (cfun->decl))
return;

+ if (number_of_loops () <= 1)
+ return;
+
@ -454,7 +454,7 @@ @@ -454,7 +454,7 @@
+++ gcc/graphite-clast-to-gimple.c 2012-12-14 13:27:47.196519858 +0100
@@ -910,7 +910,7 @@ compute_bounds_for_loop (struct clast_fo
from STMT_FOR. */

static tree
-type_for_clast_for (struct clast_for *stmt_for, ivs_params_p ip)
+type_for_clast_for (struct clast_for *stmt_fora, ivs_params_p ip)
@ -464,11 +464,11 @@ @@ -464,11 +464,11 @@
@@ -918,8 +918,8 @@ type_for_clast_for (struct clast_for *st
mpz_init (bound_one);
mpz_init (bound_two);

- lb_type = type_for_clast_expr (stmt_for->LB, ip, bound_one, bound_two);
- ub_type = type_for_clast_expr (stmt_for->UB, ip, bound_one, bound_two);
+ lb_type = type_for_clast_expr (stmt_fora->LB, ip, bound_one, bound_two);
+ ub_type = type_for_clast_expr (stmt_fora->UB, ip, bound_one, bound_two);

mpz_clear (bound_one);
mpz_clear (bound_two);

8
SOURCES/gcc48-cloog-dl2.patch

@ -10,21 +10,21 @@ @@ -10,21 +10,21 @@
@@ -107,6 +107,8 @@ static bool no_backend;
/* Length of line when printing switch values. */
#define MAX_LINE 75

+const char **toplev_main_argv;
+
/* Decoded options, and number of such options. */
struct cl_decoded_option *save_decoded_options;
unsigned int save_decoded_options_count;
@@ -1909,6 +1911,8 @@ toplev_main (int argc, char **argv)

expandargv (&argc, &argv);

+ toplev_main_argv = CONST_CAST2 (const char **, char **, argv);
+
/* Initialization of GCC's environment, and diagnostics. */
general_init (argv[0]);

--- gcc/graphite.c.jj 2010-12-01 10:24:32.000000000 -0500
+++ gcc/graphite.c 2010-12-01 11:46:07.832118193 -0500
@@ -72,11 +72,39 @@ __typeof (cloog_pointers__) cloog_pointe

10
SOURCES/gcc48-color-auto.patch

@ -10,19 +10,19 @@ @@ -10,19 +10,19 @@
+++ gcc/common.opt 2013-09-20 10:00:00.935823900 +0200
@@ -1037,7 +1037,7 @@ Common Alias(fdiagnostics-color=,always,
;

fdiagnostics-color=
-Common Joined RejectNegative Var(flag_diagnostics_show_color) Enum(diagnostic_color_rule) Init(DIAGNOSTICS_COLOR_NO)
+Common Joined RejectNegative Var(flag_diagnostics_show_color) Enum(diagnostic_color_rule) Init(DIAGNOSTICS_COLOR_AUTO)
-fdiagnostics-color=[never|always|auto] Colorize diagnostics

; Required for these enum values.
--- gcc/toplev.c.jj 2013-09-09 11:32:39.000000000 +0200
+++ gcc/toplev.c 2013-09-20 10:10:08.198721005 +0200
@@ -1229,10 +1229,8 @@ process_options (void)

maximum_field_alignment = initial_max_fld_align * BITS_PER_UNIT;

- /* Default to -fdiagnostics-color=auto if GCC_COLORS is in the environment,
- otherwise default to -fdiagnostics-color=never. */
- if (!global_options_set.x_flag_diagnostics_show_color
@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
+ if (!global_options_set.x_flag_diagnostics_show_color)
pp_show_color (global_dc->printer)
= colorize_init (DIAGNOSTICS_COLOR_AUTO);

--- gcc/doc/invoke.texi.jj 2013-09-18 12:06:50.000000000 +0200
+++ gcc/doc/invoke.texi 2013-09-20 10:09:29.079904455 +0200
@@ -3046,8 +3046,7 @@ a message which is too long to fit on a

34
SOURCES/gcc48-hack.patch

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
@@ -66,18 +66,40 @@ libsubdir := $(libdir)/gcc/$(target_nonc
ADA_RTS_DIR=$(GCC_DIR)/ada/rts$(subst /,_,$(MULTISUBDIR))
ADA_RTS_SUBDIR=./rts$(subst /,_,$(MULTISUBDIR))

+DEFAULTMULTIFLAGS :=
+ifeq ($(MULTISUBDIR),)
+targ:=$(subst -, ,$(target))
@ -47,11 +47,11 @@ @@ -47,11 +47,11 @@
"TRACE=$(TRACE)" \
@@ -88,7 +110,7 @@ LIBADA_FLAGS_TO_PASS = \
"exeext=.exeext.should.not.be.used " \
'CC=the.host.compiler.should.not.be.needed' \
"GCC_FOR_TARGET=$(CC)" \
'CC=the.host.compiler.should.not.be.needed' \
"GCC_FOR_TARGET=$(CC)" \
- "CFLAGS=$(CFLAGS)"
+ "CFLAGS=$(CFLAGS) $(DEFAULTMULTIFLAGS)"

# Rules to build gnatlib.
.PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared osconstool
--- gcc/ada/sem_util.adb (revision 161677)
@ -63,35 +63,35 @@ @@ -63,35 +63,35 @@
- Comp_Type : Entity_Id;
+ Comp_Type : Entity_Id := Empty;
Is_Array_Aggr : Boolean;

begin
--- config-ml.in.jj 2010-06-30 09:50:44.000000000 +0200
+++ config-ml.in 2010-07-02 21:24:17.994211151 +0200
@@ -516,6 +516,8 @@ multi-do:
ADAFLAGS="$(ADAFLAGS) $${flags}" \
prefix="$(prefix)" \
exec_prefix="$(exec_prefix)" \
ADAFLAGS="$(ADAFLAGS) $${flags}" \
prefix="$(prefix)" \
exec_prefix="$(exec_prefix)" \
+ mandir="$(mandir)" \
+ infodir="$(infodir)" \
GCJFLAGS="$(GCJFLAGS) $${flags}" \
GOCFLAGS="$(GOCFLAGS) $${flags}" \
CXXFLAGS="$(CXXFLAGS) $${flags}" \
GCJFLAGS="$(GCJFLAGS) $${flags}" \
GOCFLAGS="$(GOCFLAGS) $${flags}" \
CXXFLAGS="$(CXXFLAGS) $${flags}" \
--- libjava/Makefile.am.jj 2010-07-09 11:17:33.729604090 +0200
+++ libjava/Makefile.am 2010-07-09 13:16:41.894375641 +0200
@@ -710,7 +710,8 @@ if USE_LIBGCJ_BC
## later.
@echo Installing dummy lib libgcj_bc.so.1.0.0; \
rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
@echo Installing dummy lib libgcj_bc.so.1.0.0; \
rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
- mv $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
+ $(INSTALL) $(INSTALL_STRIP_FLAG) $(here)/.libs/libgcj_bc.so $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
+ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0; \
$(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
-o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -lgcj || exit; \
rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
$(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
-o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -lgcj || exit; \
rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
--- libjava/Makefile.in.jj 2010-07-09 11:17:34.000000000 +0200
+++ libjava/Makefile.in 2010-07-09 13:18:07.542572270 +0200
@@ -12665,7 +12665,8 @@ install-exec-hook: install-binPROGRAMS i
install-libexecsubPROGRAMS
install-libexecsubPROGRAMS
@USE_LIBGCJ_BC_TRUE@ @echo Installing dummy lib libgcj_bc.so.1.0.0; \
@USE_LIBGCJ_BC_TRUE@ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
-@USE_LIBGCJ_BC_TRUE@ mv $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \

12
SOURCES/gcc48-i386-libgomp.patch

@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
--- libgomp/configure.tgt.jj 2008-01-10 20:53:48.000000000 +0100
+++ libgomp/configure.tgt 2008-03-27 12:44:51.000000000 +0100
@@ -67,7 +67,7 @@ if test $enable_linux_futex = yes; then
;;
*)
if test -z "$with_arch"; then
;;
*)
if test -z "$with_arch"; then
- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
fi
esac
;;
fi
esac
;;

12
SOURCES/gcc48-java-nomulti.patch

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
--- libjava/configure.ac.jj 2007-12-07 17:55:50.000000000 +0100
+++ libjava/configure.ac 2007-12-07 18:36:56.000000000 +0100
@@ -82,6 +82,13 @@ AC_ARG_ENABLE(java-maintainer-mode,
[allow rebuilding of .class and .h files]))
[allow rebuilding of .class and .h files]))
AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes)

+AC_ARG_ENABLE(libjava-multilib,
+ AS_HELP_STRING([--enable-libjava-multilib], [build libjava as multilib]))
+if test "$enable_libjava_multilib" = no; then
@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
+
# It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
GCC_NO_EXECUTABLES

--- libjava/configure.jj 2007-12-07 17:55:50.000000000 +0100
+++ libjava/configure 2007-12-07 18:39:58.000000000 +0100
@@ -1021,6 +1021,8 @@ Optional Features:
@ -27,8 +27,8 @@ @@ -27,8 +27,8 @@
--enable-maintainer-mode enable make rules and dependencies not useful
@@ -1973,6 +1975,16 @@ else
fi


+# Check whether --enable-libjava-multilib was given.
+if test "${enable_libjava_multilib+set}" = set; then
+ enableval=$enable_libjava_multilib;
@ -40,3 +40,5 @@ @@ -40,3 +40,5 @@
+fi
+
# It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.

112
SOURCES/gcc48-libgo-p224.patch

@ -2,49 +2,49 @@ @@ -2,49 +2,49 @@
+++ libgo/Makefile.am 2014-02-18 17:31:54.798484657 +0100
@@ -1109,8 +1109,7 @@ go_crypto_dsa_files = \
go_crypto_ecdsa_files = \
go/crypto/ecdsa/ecdsa.go
go/crypto/ecdsa/ecdsa.go
go_crypto_elliptic_files = \
- go/crypto/elliptic/elliptic.go \
- go/crypto/elliptic/p224.go
+ go/crypto/elliptic/elliptic.go
go_crypto_hmac_files = \
go/crypto/hmac/hmac.go
go/crypto/hmac/hmac.go
go_crypto_md5_files = \
--- libgo/Makefile.in.jj 2013-12-12 19:01:49.000000000 +0100
+++ libgo/Makefile.in 2014-02-18 17:32:11.350389191 +0100
@@ -1274,8 +1274,7 @@ go_crypto_ecdsa_files = \
go/crypto/ecdsa/ecdsa.go

go/crypto/ecdsa/ecdsa.go
go_crypto_elliptic_files = \
- go/crypto/elliptic/elliptic.go \
- go/crypto/elliptic/p224.go
+ go/crypto/elliptic/elliptic.go

go_crypto_hmac_files = \
go/crypto/hmac/hmac.go
go/crypto/hmac/hmac.go
--- libgo/go/crypto/elliptic/elliptic.go.jj 2012-12-13 11:32:02.640039537 +0100
+++ libgo/go/crypto/elliptic/elliptic.go 2014-02-18 17:28:22.909692022 +0100
@@ -327,7 +327,6 @@ var p384 *CurveParams
var p521 *CurveParams

func initAll() {
- initP224()
initP256()
initP384()
initP521()
initP256()
initP384()
initP521()
--- libgo/go/crypto/elliptic/elliptic_test.go.jj 2012-12-13 11:32:02.640039537 +0100
+++ libgo/go/crypto/elliptic/elliptic_test.go 2014-02-18 17:31:04.052774265 +0100
@@ -5,329 +5,14 @@
package elliptic

import (
- "crypto/rand"
- "encoding/hex"
- "fmt"
- "math/big"
"testing"
"testing"
)

-func TestOnCurve(t *testing.T) {
- p224 := P224()
- if !p224.IsOnCurve(p224.Params().Gx, p224.Params().Gy) {
@ -356,17 +356,17 @@ @@ -356,17 +356,17 @@
-}
-
func TestInfinity(t *testing.T) {
tests := []struct {
name string
curve Curve
}{
tests := []struct {
name string
curve Curve
}{
- {"p224", P224()},
{"p256", P256()},
}

{"p256", P256()},
}
@@ -359,43 +44,3 @@ func TestInfinity(t *testing.T) {
}
}
}
}
}
-
-func BenchmarkBaseMult(b *testing.B) {
@ -412,33 +412,33 @@ @@ -412,33 +412,33 @@
+++ libgo/go/crypto/ecdsa/ecdsa_test.go 2014-02-18 17:28:22.909692022 +0100
@@ -33,7 +33,6 @@ func testKeyGeneration(t *testing.T, c e
}

func TestKeyGeneration(t *testing.T) {
- testKeyGeneration(t, elliptic.P224(), "p224")
if testing.Short() {
return
}
if testing.Short() {
return
}
@@ -63,7 +62,6 @@ func testSignAndVerify(t *testing.T, c e
}

func TestSignAndVerify(t *testing.T) {
- testSignAndVerify(t, elliptic.P224(), "p224")
if testing.Short() {
return
}
if testing.Short() {
return
}
@@ -129,8 +127,6 @@ func TestVectors(t *testing.T) {
parts := strings.SplitN(line, ",", 2)

switch parts[0] {
parts := strings.SplitN(line, ",", 2)
switch parts[0] {
- case "P-224":
- pub.Curve = elliptic.P224()
case "P-256":
pub.Curve = elliptic.P256()
case "P-384":
case "P-256":
pub.Curve = elliptic.P256()
case "P-384":
--- libgo/go/crypto/x509/x509.go.jj 2013-08-14 13:55:08.939843607 +0200
+++ libgo/go/crypto/x509/x509.go 2014-02-18 17:28:22.943691764 +0100
@@ -283,9 +283,6 @@ func getPublicKeyAlgorithmFromOID(oid as

// RFC 5480, 2.1.1.1. Named Curve
//
-// secp224r1 OBJECT IDENTIFIER ::= {
@ -452,36 +452,36 @@ @@ -452,36 +452,36 @@
// NB: secp256r1 is equivalent to prime256v1
var (
- oidNamedCurveP224 = asn1.ObjectIdentifier{1, 3, 132, 0, 33}
oidNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7}
oidNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34}
oidNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35}
oidNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7}
oidNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34}
oidNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35}
@@ -306,8 +302,6 @@ var (

func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve {
switch {
switch {
- case oid.Equal(oidNamedCurveP224):
- return elliptic.P224()
case oid.Equal(oidNamedCurveP256):
return elliptic.P256()
case oid.Equal(oidNamedCurveP384):
case oid.Equal(oidNamedCurveP256):
return elliptic.P256()
case oid.Equal(oidNamedCurveP384):
@@ -320,8 +314,6 @@ func namedCurveFromOID(oid asn1.ObjectId

func oidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool) {
switch curve {
switch curve {
- case elliptic.P224():
- return oidNamedCurveP224, true
case elliptic.P256():
return oidNamedCurveP256, true
case elliptic.P384():
case elliptic.P256():
return oidNamedCurveP256, true
case elliptic.P384():
@@ -1212,7 +1204,7 @@ func CreateCertificate(rand io.Reader, t
hashFunc = crypto.SHA1
case *ecdsa.PrivateKey:
switch priv.Curve {
hashFunc = crypto.SHA1
case *ecdsa.PrivateKey:
switch priv.Curve {
- case elliptic.P224(), elliptic.P256():
+ case elliptic.P256():
hashFunc = crypto.SHA256
signatureAlgorithm.Algorithm = oidSignatureECDSAWithSHA256
case elliptic.P384():
hashFunc = crypto.SHA256
signatureAlgorithm.Algorithm = oidSignatureECDSAWithSHA256
case elliptic.P384():
--- libgo/go/crypto/elliptic/p224.go.jj 2012-12-13 11:32:02.641039533 +0100
+++ libgo/go/crypto/elliptic/p224.go 2014-02-15 11:40:56.191557928 +0100
@@ -1,765 +0,0 @@

806
SOURCES/gcc48-libgomp-20160715.patch

File diff suppressed because it is too large Load Diff

7
SOURCES/gcc48-libgomp-omp_h-multilib.patch

@ -5,12 +5,13 @@ @@ -5,12 +5,13 @@
--- libgomp/omp.h.in.jj 2008-06-09 13:34:05.000000000 +0200
+++ libgomp/omp.h.in 2008-06-09 13:34:48.000000000 +0200
@@ -42,8 +42,8 @@ typedef struct

typedef struct
{
- unsigned char _x[@OMP_NEST_LOCK_SIZE@]
- unsigned char _x[@OMP_NEST_LOCK_SIZE@]
- __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
+ unsigned char _x[8 + sizeof (void *)]
+ unsigned char _x[8 + sizeof (void *)]
+ __attribute__((__aligned__(sizeof (void *))));
} omp_nest_lock_t;
#endif

24
SOURCES/gcc48-libtool-no-rpath.patch

@ -2,26 +2,26 @@ libtool sucks. @@ -2,26 +2,26 @@ libtool sucks.
--- ltmain.sh.jj 2007-12-07 14:53:21.000000000 +0100
+++ ltmain.sh 2008-09-05 21:51:48.000000000 +0200
@@ -5394,6 +5394,7 @@ EOF
rpath="$finalize_rpath"
test "$mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
rpath="$finalize_rpath"
test "$mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
+ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
@@ -6071,6 +6072,7 @@ EOF
rpath=
hardcode_libdirs=
for libdir in $compile_rpath $finalize_rpath; do
+ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
@@ -6120,6 +6122,7 @@ EOF
rpath=
hardcode_libdirs=
for libdir in $finalize_rpath; do
+ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then

10
SOURCES/gcc48-no-add-needed.patch

@ -23,28 +23,28 @@ @@ -23,28 +23,28 @@
#undef LINK_EH_SPEC
-#define LINK_EH_SPEC ""
+#define LINK_EH_SPEC "--no-add-needed "

/* Put all *tf routines in libgcc. */
#undef LIBGCC2_HAS_TF_MODE
--- gcc/config/gnu-user.h.jj 2011-01-03 12:53:03.739057299 +0100
+++ gcc/config/gnu-user.h 2011-01-04 18:14:10.932814884 +0100
@@ -82,7 +82,7 @@ see the files COPYING3 and COPYING.RUNTI
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC

#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
#endif

#undef LINK_GCC_C_SEQUENCE_SPEC
--- gcc/config/rs6000/sysv4.h.jj 2011-01-03 13:02:18.255994215 +0100
+++ gcc/config/rs6000/sysv4.h 2011-01-04 18:14:10.933888871 +0100
@@ -820,7 +820,7 @@ extern int fixuplabelno;
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"

#if defined(HAVE_LD_EH_FRAME_HDR)
-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+# define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
#endif

#define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \

4
SOURCES/gcc48-ppc32-retaddr.patch

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
{
+ rtx x;
cfun->machine->ra_needs_full_frame = 1;

- return
- gen_rtx_MEM
- (Pmode,
@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
+ x = plus_constant (Pmode, x, RETURN_ADDRESS_OFFSET);
+ return gen_rtx_MEM (Pmode, memory_address (Pmode, x));
}

cfun->machine->ra_need_lr = 1;
--- gcc/testsuite/gcc.dg/20051128-1.c.jj 2005-10-10 11:21:41.096999000 +0200
+++ gcc/testsuite/gcc.dg/20051128-1.c 2005-11-28 12:30:57.000000000 +0100

48
SOURCES/gcc48-pr28865.patch

@ -19,31 +19,31 @@ @@ -19,31 +19,31 @@
@@ -4474,8 +4474,10 @@ static unsigned HOST_WIDE_INT
This includes the pseudo-op such as ".int" or ".byte", and a newline.
Assumes output_addressed_constants has been done on EXP already.

- Generate exactly SIZE bytes of assembler data, padding at the end
- with zeros if necessary. SIZE must always be specified.
+ Generate at least SIZE bytes of assembler data, padding at the end
+ with zeros if necessary. SIZE must always be specified. The returned
+ value is the actual number of bytes of assembler data generated, which
+ may be bigger than SIZE if the object contains a variable length field.

SIZE is important for structure constructors,
since trailing members may have been omitted from the constructor.
@@ -4490,14 +4492,14 @@ static unsigned HOST_WIDE_INT

ALIGN is the alignment of the data in bits. */

-void
+unsigned HOST_WIDE_INT
output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align)
{
enum tree_code code;
unsigned HOST_WIDE_INT thissize;

if (size == 0 || flag_syntax_only)
- return;
+ return size;

/* See if we're trying to initialize a pointer in a non-default mode
to the address of some declaration somewhere. If the target says
@@ -4562,7 +4564,7 @@ output_constant (tree exp, unsigned HOST
@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
- return;
+ return size;
}

if (TREE_CODE (exp) == FDESC_EXPR)
@@ -4574,7 +4576,7 @@ output_constant (tree exp, unsigned HOST
#else
@ -62,18 +62,18 @@ @@ -62,18 +62,18 @@
- return;
+ return size;
}

/* Now output the underlying data. If we've handling the padding, return.
@@ -4612,8 +4614,7 @@ output_constant (tree exp, unsigned HOST
switch (TREE_CODE (exp))
{
case CONSTRUCTOR:
{
case CONSTRUCTOR:
- output_constructor (exp, size, align, NULL);
- return;
+ return output_constructor (exp, size, align, NULL);
case STRING_CST:
thissize = MIN ((unsigned HOST_WIDE_INT)TREE_STRING_LENGTH (exp),
size);
case STRING_CST:
thissize = MIN ((unsigned HOST_WIDE_INT)TREE_STRING_LENGTH (exp),
size);
@@ -4648,11 +4649,10 @@ output_constant (tree exp, unsigned HOST
case RECORD_TYPE:
case UNION_TYPE:
@ -81,29 +81,29 @@ @@ -81,29 +81,29 @@
- output_constructor (exp, size, align, NULL);
- return;
+ return output_constructor (exp, size, align, NULL);

case ERROR_MARK:
- return;
+ return 0;

default:
gcc_unreachable ();
@@ -4660,6 +4660,8 @@ output_constant (tree exp, unsigned HOST

if (size > thissize)
assemble_zeros (size - thissize);
+
+ return size;
}

@@ -4759,7 +4761,7 @@ output_constructor_array_range (oc_local
if (local->val == NULL_TREE)
assemble_zeros (fieldsize);
assemble_zeros (fieldsize);
else
- output_constant (local->val, fieldsize, align2);
+ fieldsize = output_constant (local->val, fieldsize, align2);

/* Count its size. */
local->total_bytes += fieldsize;
@@ -4808,9 +4810,8 @@ output_constructor_regular_field (oc_loc
@ -123,7 +123,7 @@ @@ -123,7 +123,7 @@
else
- output_constant (local->val, fieldsize, align2);
+ fieldsize = output_constant (local->val, fieldsize, align2);

/* Count its size. */
local->total_bytes += fieldsize;
--- gcc/output.h (revision 206660)
@ -131,18 +131,18 @@ @@ -131,18 +131,18 @@
@@ -294,11 +294,13 @@ extern void output_quoted_string (FILE *
This includes the pseudo-op such as ".int" or ".byte", and a newline.
Assumes output_addressed_constants has been done on EXP already.

- Generate exactly SIZE bytes of assembler data, padding at the end
- with zeros if necessary. SIZE must always be specified.
+ Generate at least SIZE bytes of assembler data, padding at the end
+ with zeros if necessary. SIZE must always be specified. The returned
+ value is the actual number of bytes of assembler data generated, which
+ may be bigger than SIZE if the object contains a variable length field.

ALIGN is the alignment in bits that may be assumed for the data. */
-extern void output_constant (tree, unsigned HOST_WIDE_INT, unsigned int);
+extern unsigned HOST_WIDE_INT output_constant (tree, unsigned HOST_WIDE_INT, unsigned int);

/* When outputting delayed branch sequences, this rtx holds the
sequence being output. It is null when no delayed branch
--- gcc/testsuite/gcc.c-torture/execute/pr28865.c (revision 0)
@ -182,7 +182,7 @@ @@ -182,7 +182,7 @@
+ since each element has a variable length. GCC allows it
+ (for the moment) because it is used in existing code, such
+ as glibc. */
+static const struct var_len var_array[] =
+static const struct var_len var_array[] =
+{
+ { 1, "Long exposure noise reduction" },
+ { 2, "Shutter/AE lock buttons" },

22
SOURCES/gcc48-pr38757.patch

@ -17,7 +17,7 @@ c/ @@ -17,7 +17,7 @@ c/
@@ -467,6 +467,10 @@ struct lang_hooks
gimplification. */
bool deep_unsharing;

+ /* Return year of the source language standard version if the FE supports
+ multiple versions of the standard. */
+ int (*source_language) (void);
@ -32,7 +32,7 @@ c/ @@ -32,7 +32,7 @@ c/
#define LANG_HOOKS_EH_USE_CXA_END_CLEANUP false
#define LANG_HOOKS_DEEP_UNSHARING false
+#define LANG_HOOKS_SOURCE_LANGUAGE NULL

/* Attribute hooks. */
#define LANG_HOOKS_ATTRIBUTE_TABLE NULL
@@ -303,7 +304,8 @@ extern void lhd_end_section (void);
@ -43,14 +43,14 @@ c/ @@ -43,14 +43,14 @@ c/
+ LANG_HOOKS_DEEP_UNSHARING, \
+ LANG_HOOKS_SOURCE_LANGUAGE \
}

#endif /* GCC_LANG_HOOKS_DEF_H */
--- gcc/c/c-lang.c.jj 2011-01-03 12:53:05.376056936 +0100
+++ gcc/c/c-lang.c 2011-01-04 17:59:43.167743798 +0100
@@ -36,6 +36,12 @@ along with GCC; see the file COPYING3.

enum c_language_kind c_language = clk_c;

+static int
+c_source_language (void)
+{
@ -59,14 +59,14 @@ c/ @@ -59,14 +59,14 @@ c/
+
/* Lang hooks common to C and ObjC are declared in c-objc-common.h;
consequently, there should be very few hooks below. */

@@ -45,6 +51,8 @@ enum c_language_kind c_language = clk_c;
#define LANG_HOOKS_INIT c_objc_common_init
#undef LANG_HOOKS_INIT_TS
#define LANG_HOOKS_INIT_TS c_common_init_ts
+#undef LANG_HOOKS_SOURCE_LANGUAGE
+#define LANG_HOOKS_SOURCE_LANGUAGE c_source_language

/* Each front end provides its own lang hook initializer. */
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
--- gcc/dwarf2out.c.jj 2011-01-03 12:53:05.102056475 +0100
@ -91,12 +91,12 @@ c/ @@ -91,12 +91,12 @@ c/
+ break;
+ }
}

/* Add an 'abstract_origin' attribute below a given DIE. The DIE is found
@@ -18915,6 +18924,10 @@ gen_compile_unit_die (const char *filena
if (strcmp (language_string, "GNU Go") == 0)
language = DW_LANG_Go;
}
if (strcmp (language_string, "GNU Go") == 0)
language = DW_LANG_Go;
}
+ else if (strcmp (language_string, "GNU C") == 0
+ && lang_hooks.source_language
+ && lang_hooks.source_language () >= 1999)

16
SOURCES/gcc48-pr52714.patch

@ -15,24 +15,24 @@ @@ -15,24 +15,24 @@
+++ gcc/combine.c (revision 208204)
@@ -3706,6 +3706,9 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
#ifdef HAVE_cc0
&& !reg_referenced_p (cc0_rtx, XVECEXP (newpat, 0, 0))
&& !reg_referenced_p (cc0_rtx, XVECEXP (newpat, 0, 0))
#endif
+ /* If I3 is a jump, ensure that set0 is a jump so that
+ we do not create invalid RTL. */
+ && (!JUMP_P (i3) || SET_DEST (XVECEXP (newpat, 0, 0)) == pc_rtx)
)
{
newi2pat = XVECEXP (newpat, 0, 1);
)
{
newi2pat = XVECEXP (newpat, 0, 1);
@@ -3716,6 +3719,9 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
#ifdef HAVE_cc0
&& !reg_referenced_p (cc0_rtx, XVECEXP (newpat, 0, 1))
&& !reg_referenced_p (cc0_rtx, XVECEXP (newpat, 0, 1))
#endif
+ /* If I3 is a jump, ensure that set1 is a jump so that
+ we do not create invalid RTL. */
+ && (!JUMP_P (i3) || SET_DEST (XVECEXP (newpat, 0, 1)) == pc_rtx)
)
{
newi2pat = XVECEXP (newpat, 0, 0);
)
{
newi2pat = XVECEXP (newpat, 0, 0);
--- gcc/testsuite/gcc.c-torture/compile/pr52714.c (revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/pr52714.c (revision 208204)
@@ -0,0 +1,25 @@

30
SOURCES/gcc48-pr53477.patch

@ -21,11 +21,11 @@ @@ -21,11 +21,11 @@
+ value = value.referenced_value()
+
return self.function(self.name, value)

# A pretty-printer that conforms to the "PrettyPrinter" protocol from
@@ -841,6 +846,11 @@ class Printer(object):
return None

basename = match.group(1)
+
+ if val.type.code == gdb.TYPE_CODE_REF:
@ -34,20 +34,20 @@ @@ -34,20 +34,20 @@
+
if basename in self.lookup:
return self.lookup[basename].invoke(val)

--- libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc (revision 201887)
+++ libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc (revision 201888)
@@ -1,5 +1,5 @@
// { dg-do run }
-// { dg-options "-std=gnu++11 -g" }
+// { dg-options "-std=gnu++11 -g -O0" }

// Copyright (C) 2011-2013 Free Software Foundation, Inc.
//
@@ -24,6 +24,8 @@
#include <string>
#include <iostream>

+typedef std::tuple<int, int> ExTuple;
+
template<class T>
@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
@@ -62,43 +64,75 @@ main()
std::forward_list<int> efl;
// { dg-final { note-test efl "empty std::forward_list" } }

+ std::forward_list<int> &refl = efl;
+// { dg-final { note-test refl "empty std::forward_list" } }
+
@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
fl.push_front(2);
fl.push_front(1);
// { dg-final { note-test fl {std::forward_list = {[0] = 1, [1] = 2}} } }

+ std::forward_list<int> &rfl = fl;
+// { dg-final { note-test rfl {std::forward_list = {[0] = 1, [1] = 2}} } }
+
@ -87,12 +87,12 @@ @@ -87,12 +87,12 @@
// { dg-final { note-test eums "std::unordered_multiset with 0 elements" } }
+ std::unordered_multiset<int> &reums = eums;
+// { dg-final { note-test reums "std::unordered_multiset with 0 elements" } }

std::unordered_map<int, std::string> uom;
uom[5] = "three";
uom[3] = "seven";
// { dg-final { note-test uom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }

+ std::unordered_map<int, std::string> &ruom = uom;
+// { dg-final { note-test ruom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }
+
@ -102,30 +102,30 @@ @@ -102,30 +102,30 @@
// { dg-final { note-test uomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } }
+ std::unordered_multimap<int, std::string> &ruomm = uomm;
+// { dg-final { note-test ruomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } }

std::unordered_set<int> uos;
uos.insert(5);
// { dg-final { note-test uos {std::unordered_set with 1 elements = {[0] = 5}} } }
+ std::unordered_set<int> &ruos = uos;
+// { dg-final { note-test ruos {std::unordered_set with 1 elements = {[0] = 5}} } }

std::unordered_multiset<int> uoms;
uoms.insert(5);
// { dg-final { note-test uoms {std::unordered_multiset with 1 elements = {[0] = 5}} } }
+ std::unordered_multiset<int> &ruoms = uoms;
+// { dg-final { note-test ruoms {std::unordered_multiset with 1 elements = {[0] = 5}} } }

std::unique_ptr<datum> uptr (new datum);
uptr->s = "hi bob";
uptr->i = 23;
// { dg-final { regexp-test uptr {std::unique_ptr.datum. containing 0x.*} } }
+ std::unique_ptr<datum> &ruptr = uptr;
+// { dg-final { regexp-test ruptr {std::unique_ptr.datum. containing 0x.*} } }

+ ExTuple tpl(6,7);
+// { dg-final { note-test tpl {std::tuple containing = {[1] = 6, [2] = 7}} } }
+// { dg-final { note-test tpl {std::tuple containing = {[1] = 6, [2] = 7}} } }
+ ExTuple &rtpl = tpl;
+// { dg-final { note-test rtpl {std::tuple containing = {[1] = 6, [2] = 7}} } }
+// { dg-final { note-test rtpl {std::tuple containing = {[1] = 6, [2] = 7}} } }
placeholder(""); // Mark SPOT
use(efl);
use(fl);

120
SOURCES/gcc48-pr56564.patch

@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
@@ -1062,6 +1062,15 @@ arrays to be word-aligned so that @code{
constants to character arrays can be done inline.
@end defmac

+@defmac DATA_ABI_ALIGNMENT (@var{type}, @var{basic-align})
+Similar to @code{DATA_ALIGNMENT}, but for the cases where the ABI mandates
+some alignment increase, instead of optimization only purposes. E.g.@
@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
@@ -1078,6 +1078,15 @@ arrays to be word-aligned so that @code{
constants to character arrays can be done inline.
@end defmac

+@defmac DATA_ABI_ALIGNMENT (@var{type}, @var{basic-align})
+Similar to @code{DATA_ALIGNMENT}, but for the cases where the ABI mandates
+some alignment increase, instead of optimization only purposes. E.g.@
@ -101,7 +101,7 @@ @@ -101,7 +101,7 @@
@@ -966,13 +966,80 @@ align_variable (tree decl, bool dont_out
align = MAX_OFILE_ALIGNMENT;
}

- /* On some machines, it is good to increase alignment sometimes. */
if (! DECL_USER_ALIGN (decl))
{
@ -179,31 +179,31 @@ @@ -179,31 +179,31 @@
- is too precious. */
+ is too precious. */
if (! DECL_THREAD_LOCAL_P (decl) || data_align <= BITS_PER_WORD)
align = data_align;
align = data_align;
#endif
@@ -989,9 +1056,7 @@ align_variable (tree decl, bool dont_out
#endif
}

- /* Reset the alignment in case we have made it tighter, so we can benefit
- from it in get_pointer_alignment. */
- DECL_ALIGN (decl) = align;
+ return align;
}

/* Return the section into which the given VAR_DECL or CONST_DECL
@@ -1043,7 +1108,8 @@ get_variable_section (tree decl, bool pr
return bss_noswitch_section;
return bss_noswitch_section;
}

- return targetm.asm_out.select_section (decl, reloc, DECL_ALIGN (decl));
+ return targetm.asm_out.select_section (decl, reloc,
+ get_variable_align (decl));
}

/* Return the block into which object_block DECL should be placed. */
@@ -1780,7 +1846,8 @@ emit_bss (tree decl ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT rounded ATTRIBUTE_UNUSED)
unsigned HOST_WIDE_INT rounded ATTRIBUTE_UNUSED)
{
#if defined ASM_OUTPUT_ALIGNED_BSS
- ASM_OUTPUT_ALIGNED_BSS (asm_out_file, decl, name, size, DECL_ALIGN (decl));
@ -228,49 +228,49 @@ @@ -228,49 +228,49 @@
ASM_OUTPUT_COMMON (asm_out_file, name, size, rounded);
@@ -1828,7 +1896,8 @@ emit_tls_common (tree decl ATTRIBUTE_UNU
NAME is the name of DECL's SYMBOL_REF. */

static void
-assemble_noswitch_variable (tree decl, const char *name, section *sect)
+assemble_noswitch_variable (tree decl, const char *name, section *sect,
+ unsigned int align)
{
unsigned HOST_WIDE_INT size, rounded;

@@ -1850,7 +1919,7 @@ assemble_noswitch_variable (tree decl, c
* (BIGGEST_ALIGNMENT / BITS_PER_UNIT));

* (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
if (!sect->noswitch.callback (decl, name, size, rounded)
- && (unsigned HOST_WIDE_INT) DECL_ALIGN_UNIT (decl) > rounded)
+ && (unsigned HOST_WIDE_INT) (align / BITS_PER_UNIT) > rounded)
warning (0, "requested alignment for %q+D is greater than "
"implemented alignment of %wu", decl, rounded);
"implemented alignment of %wu", decl, rounded);
}
@@ -1880,7 +1949,7 @@ assemble_variable_contents (tree decl, c
/* Output the actual data. */
output_constant (DECL_INITIAL (decl),
tree_low_cst (DECL_SIZE_UNIT (decl), 1),
/* Output the actual data. */
output_constant (DECL_INITIAL (decl),
tree_low_cst (DECL_SIZE_UNIT (decl), 1),
- DECL_ALIGN (decl));
+ get_variable_align (decl));
else
/* Leave space for it. */
assemble_zeros (tree_low_cst (DECL_SIZE_UNIT (decl), 1));
/* Leave space for it. */
assemble_zeros (tree_low_cst (DECL_SIZE_UNIT (decl), 1));
@@ -1904,6 +1973,7 @@ assemble_variable (tree decl, int top_le
const char *name;
rtx decl_rtl, symbol;
section *sect;
+ unsigned int align;
bool asan_protected = false;

/* This function is supposed to handle VARIABLES. Ensure we have one. */
@@ -2003,6 +2073,8 @@ assemble_variable (tree decl, int top_le

set_mem_align (decl_rtl, DECL_ALIGN (decl));

+ align = get_variable_align (decl);
+
if (TREE_PUBLIC (decl))
maybe_assemble_visibility (decl);

@@ -2032,12 +2104,12 @@ assemble_variable (tree decl, int top_le
place_block_symbol (symbol);
}
@ -286,7 +286,7 @@ @@ -286,7 +286,7 @@
+ ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
assemble_variable_contents (decl, name, dont_output_data);
if (asan_protected)
{
{
@@ -6709,10 +6781,10 @@ bool
decl_binds_to_current_def_p (tree decl)
{
@ -301,7 +301,7 @@ @@ -301,7 +301,7 @@
if (TREE_CODE (decl) == VAR_DECL
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
@@ -6730,10 +6802,20 @@ decl_binds_to_current_def_p (tree decl)
return resolution_to_local_definition_p (node->symbol.resolution);
return resolution_to_local_definition_p (node->symbol.resolution);
}
/* Otherwise we have to assume the worst for DECL_WEAK (hidden weaks
- binds locally but still can be overwritten).
@ -321,7 +321,7 @@ @@ -321,7 +321,7 @@
+ return false;
+ return true;
}

/* A replaceable function or variable is one which may be replaced
@@ -6959,7 +7041,7 @@ place_block_symbol (rtx symbol)
else
@ -331,16 +331,16 @@ @@ -331,16 +331,16 @@
+ alignment = get_variable_align (decl);
size = tree_low_cst (DECL_SIZE_UNIT (decl), 1);
if (flag_asan && asan_protect_global (decl))
{
{
--- gcc/config/s390/s390.h (revision 199897)
+++ gcc/config/s390/s390.h (revision 199898)
@@ -221,7 +221,7 @@ enum processor_flags

/* Alignment on even addresses for LARL instruction. */
#define CONSTANT_ALIGNMENT(EXP, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)
-#define DATA_ALIGNMENT(TYPE, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)
+#define DATA_ABI_ALIGNMENT(TYPE, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)

/* Alignment is not required by the hardware. */
#define STRICT_ALIGNMENT 0
--- gcc/config/i386/i386.h (revision 199897)
@ -348,7 +348,7 @@ @@ -348,7 +348,7 @@
@@ -859,7 +859,18 @@ enum target_cpu_default
cause character arrays to be word-aligned so that `strcpy' calls
that copy constants to character arrays can be done inline. */

-#define DATA_ALIGNMENT(TYPE, ALIGN) ix86_data_alignment ((TYPE), (ALIGN))
+#define DATA_ALIGNMENT(TYPE, ALIGN) \
+ ix86_data_alignment ((TYPE), (ALIGN), true)
@ -362,32 +362,32 @@ @@ -362,32 +362,32 @@
+
+#define DATA_ABI_ALIGNMENT(TYPE, ALIGN) \
+ ix86_data_alignment ((TYPE), (ALIGN), false)

/* If defined, a C expression to compute the alignment for a local
variable. TYPE is the data type, and ALIGN is the alignment that
--- gcc/config/i386/i386-protos.h (revision 199897)
+++ gcc/config/i386/i386-protos.h (revision 199898)
@@ -207,7 +207,7 @@ extern void init_cumulative_args (CUMULA
#endif /* RTX_CODE */

#ifdef TREE_CODE
-extern int ix86_data_alignment (tree, int);
+extern int ix86_data_alignment (tree, int, bool);
extern unsigned int ix86_local_alignment (tree, enum machine_mode,
unsigned int);
unsigned int);
extern unsigned int ix86_minimum_alignment (tree, enum machine_mode,
--- gcc/config/i386/i386.c (revision 199897)
+++ gcc/config/i386/i386.c (revision 199898)
@@ -25292,12 +25292,13 @@ ix86_constant_alignment (tree exp, int a
instead of that alignment to align the object. */

int
-ix86_data_alignment (tree type, int align)
+ix86_data_alignment (tree type, int align, bool opt)
{
int max_align
= optimize_size ? BITS_PER_WORD : MIN (256, MAX_OFILE_ALIGNMENT);

- if (AGGREGATE_TYPE_P (type)
+ if (opt
+ && AGGREGATE_TYPE_P (type)
@ -408,9 +408,9 @@ @@ -408,9 +408,9 @@
+ && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
+ && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= 128
+ || TREE_INT_CST_HIGH (TYPE_SIZE (type))) && align < 128)
return 128;
return 128;
}

+ if (!opt)
+ return align;
+
@ -427,24 +427,24 @@ @@ -427,24 +427,24 @@
+#define DATA_ABI_ALIGNMENT(TYPE, ALIGN) \
(((ALIGN) < BITS_PER_UNIT * 8 && TREE_CODE (TYPE) == ARRAY_TYPE) \
? BITS_PER_UNIT * 8 : (ALIGN))

--- gcc/config/mmix/mmix.h (revision 199897)
+++ gcc/config/mmix/mmix.h (revision 199898)
@@ -164,7 +164,7 @@ struct GTY(()) machine_function
/* Copied from elfos.h. */
#define MAX_OFILE_ALIGNMENT (32768 * 8)

-#define DATA_ALIGNMENT(TYPE, BASIC_ALIGN) \
+#define DATA_ABI_ALIGNMENT(TYPE, BASIC_ALIGN) \
mmix_data_alignment (TYPE, BASIC_ALIGN)

#define CONSTANT_ALIGNMENT(CONSTANT, BASIC_ALIGN) \
--- gcc/config/mmix/mmix.c (revision 199897)
+++ gcc/config/mmix/mmix.c (revision 199898)
@@ -313,7 +313,7 @@ mmix_init_machine_status (void)
return ggc_alloc_cleared_machine_function ();
}

-/* DATA_ALIGNMENT.
+/* DATA_ABI_ALIGNMENT.
We have trouble getting the address of stuff that is located at other
@ -466,45 +466,45 @@ @@ -466,45 +466,45 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -ffast-math -mavx -mtune=generic" } */
+/* { dg-options "-O3 -ffast-math -mavx -mtune=generic -fno-common" } */

double a[1024];

--- gcc/testsuite/gcc.target/i386/avx256-unaligned-load-4.c (revision 199897)
+++ gcc/testsuite/gcc.target/i386/avx256-unaligned-load-4.c (revision 199898)
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -dp -mavx -mno-avx256-split-unaligned-load -mno-avx256-split-unaligned-store" } */
+/* { dg-options "-O3 -dp -mavx -mno-avx256-split-unaligned-load -mno-avx256-split-unaligned-store -fno-common" } */

#define N 1024

--- gcc/testsuite/gcc.target/i386/avx256-unaligned-store-1.c (revision 199897)
+++ gcc/testsuite/gcc.target/i386/avx256-unaligned-store-1.c (revision 199898)
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -dp -mavx -mavx256-split-unaligned-store" } */
+/* { dg-options "-O3 -dp -mavx -mavx256-split-unaligned-store -fno-common" } */

#define N 1024

--- gcc/testsuite/gcc.target/i386/avx256-unaligned-store-3.c (revision 199897)
+++ gcc/testsuite/gcc.target/i386/avx256-unaligned-store-3.c (revision 199898)
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -dp -mavx -mavx256-split-unaligned-store -mtune=generic" } */
+/* { dg-options "-O3 -dp -mavx -mavx256-split-unaligned-store -mtune=generic -fno-common" } */

#define N 1024

--- gcc/testsuite/gcc.target/i386/avx256-unaligned-store-4.c (revision 199897)
+++ gcc/testsuite/gcc.target/i386/avx256-unaligned-store-4.c (revision 199898)
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -dp -mavx -mno-avx256-split-unaligned-load -mno-avx256-split-unaligned-store" } */
+/* { dg-options "-O3 -dp -mavx -mno-avx256-split-unaligned-load -mno-avx256-split-unaligned-store -fno-common" } */

#define N 1024

--- gcc/testsuite/gcc.target/i386/pr56564-1.c (revision 0)
+++ gcc/testsuite/gcc.target/i386/pr56564-1.c (revision 199985)
@@ -0,0 +1,26 @@
@ -624,31 +624,31 @@ @@ -624,31 +624,31 @@
@@ -18,7 +18,7 @@ struct s{
struct t e; /* unaligned (offset 2N+4N+4 B) */
};

-struct s tmp;
+struct s tmp = { 1 };

int main1 ()
{
{
--- gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c (revision 199897)
+++ gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c (revision 199898)
@@ -18,7 +18,7 @@ struct s{
struct t e; /* unaligned (offset 2N+4N+4 B) */
};

-struct s tmp;
+struct s tmp = { 1 };

int main1 ()
{
{
--- gcc/testsuite/gcc.dg/tree-ssa/loop-19.c (revision 200212)
+++ gcc/testsuite/gcc.dg/tree-ssa/loop-19.c (revision 200213)
@@ -6,7 +6,7 @@

/* { dg-do compile { target { i?86-*-* || { x86_64-*-* || powerpc_hard_double } } } } */
/* { dg-require-effective-target nonpic } */
-/* { dg-options "-O3 -fno-tree-loop-distribute-patterns -fno-prefetch-loop-arrays -fdump-tree-optimized" } */
+/* { dg-options "-O3 -fno-tree-loop-distribute-patterns -fno-prefetch-loop-arrays -fdump-tree-optimized -fno-common" } */

# define N 2000000
double a[N],c[N];

2
SOURCES/gcc48-pr62258.patch

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
@@ -245,6 +245,9 @@ std::rethrow_exception(std::exception_pt
__GXX_INIT_DEPENDENT_EXCEPTION_CLASS(dep->unwindHeader.exception_class);
dep->unwindHeader.exception_cleanup = __gxx_dependent_exception_cleanup;

+ __cxa_eh_globals *globals = __cxa_get_globals ();
+ globals->uncaughtExceptions += 1;
+

28
SOURCES/gcc48-pr63293.patch

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
+ /* We need to add memory barrier to prevent read from deallocated stack. */
+ bool need_barrier_p = (get_frame_size () != 0
+ || cfun->machine->saved_varargs_size);

aarch64_layout_frame ();
original_frame_size = get_frame_size () + cfun->machine->saved_varargs_size;
@@ -2030,6 +2033,9 @@ aarch64_expand_epilogue (bool for_sibcal
@ -25,8 +25,8 @@ @@ -25,8 +25,8 @@
+ emit_insn (gen_stack_tie (stack_pointer_rtx, stack_pointer_rtx));
+
insn = emit_insn (gen_add3_insn (stack_pointer_rtx,
hard_frame_pointer_rtx,
GEN_INT (- fp_offset)));
hard_frame_pointer_rtx,
GEN_INT (- fp_offset)));
@@ -2048,6 +2054,9 @@ aarch64_expand_epilogue (bool for_sibcal
/* Restore the frame pointer and lr if the frame pointer is needed. */
if (offset > 0)
@ -35,26 +35,26 @@ @@ -35,26 +35,26 @@
+ emit_insn (gen_stack_tie (stack_pointer_rtx, stack_pointer_rtx));
+
if (frame_pointer_needed)
{
rtx mem_fp, mem_lr;
{
rtx mem_fp, mem_lr;
@@ -2067,6 +2076,10 @@ aarch64_expand_epilogue (bool for_sibcal
+ UNITS_PER_WORD));
emit_insn (gen_load_pairdi (reg_fp, mem_fp, reg_lr, mem_lr));

+ UNITS_PER_WORD));
emit_insn (gen_load_pairdi (reg_fp, mem_fp, reg_lr, mem_lr));
+ if (need_barrier_p)
+ emit_insn (gen_stack_tie (stack_pointer_rtx,
+ stack_pointer_rtx));
+
insn = emit_insn (gen_add2_insn (stack_pointer_rtx,
GEN_INT (offset)));
}
insn = emit_insn (gen_add2_insn (stack_pointer_rtx,
GEN_INT (offset)));
}
@@ -2128,6 +2141,9 @@ aarch64_expand_epilogue (bool for_sibcal

if (frame_size > -1)
{
+ if (need_barrier_p)
+ emit_insn (gen_stack_tie (stack_pointer_rtx, stack_pointer_rtx));
+
if (frame_size >= 0x1000000)
{
rtx op0 = gen_rtx_REG (Pmode, IP0_REGNUM);
{
rtx op0 = gen_rtx_REG (Pmode, IP0_REGNUM);

3
SOURCES/gcc48-pr65142.patch

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
+++ libstdc++-v3/src/c++11/random.cc (revision 228424)
@@ -126,8 +126,10 @@ namespace std _GLIBCXX_VISIBILITY(defaul
#endif

result_type __ret;
- std::fread(reinterpret_cast<void*>(&__ret), sizeof(result_type),
- 1, _M_file);
@ -20,3 +20,4 @@ @@ -20,3 +20,4 @@
+ std::__throw_runtime_error(__N("random_device could not be read"));
return __ret;
}

4
SOURCES/gcc48-pr66731.patch

@ -15,8 +15,8 @@ @@ -15,8 +15,8 @@
+++ gcc/config/aarch64/aarch64.md (revision 226592)
@@ -3101,6 +3101,17 @@
(mult:GPF
(neg:GPF (match_operand:GPF 1 "register_operand" "w"))
(match_operand:GPF 2 "register_operand" "w")))]
(neg:GPF (match_operand:GPF 1 "register_operand" "w"))
(match_operand:GPF 2 "register_operand" "w")))]
+ "TARGET_FLOAT && !flag_rounding_math"
+ "fnmul\\t%<s>0, %<s>1, %<s>2"
+ [(set_attr "v8type" "fmul")

16
SOURCES/gcc48-pr66840.patch

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
2015-07-14 Matthias Klose <doko@ubuntu.com>

PR target/66840
* config/rs6000/t-rs6000 (TM_H): Add rs6000-cpus.def.

diff -Nrup a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000
--- /gcc/config/rs6000/t-rs6000 2013-08-14 05:55:11.000000000 -0600
+++ gcc/config/rs6000/t-rs6000 2018-04-18 12:09:30.614737081 -0600
@@ -19,6 +19,7 @@
# <http://www.gnu.org/licenses/>.
TM_H += $(srcdir)/config/rs6000/rs6000-builtin.def
+TM_H += $(srcdir)/config/rs6000/rs6000-cpus.def
rs6000.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h \

50
SOURCES/gcc48-pr67281.patch

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
@@ -16092,6 +16092,28 @@ unsigned int __builtin_tresume (void)
unsigned int __builtin_tsuspend (void)
@end smallexample

+Note that the semantics of the above HTM builtins are required to mimic
+the locking semantics used for critical sections. Builtins that are used
+to create a new transaction or restart a suspended transaction must have
@ -50,12 +50,12 @@ @@ -50,12 +50,12 @@
+
The following set of built-in functions are available to gain access
to the HTM specific special purpose registers.

--- gcc/config/rs6000/htm.md (revision 226531)
+++ gcc/config/rs6000/htm.md (revision 228827)
@@ -27,6 +27,14 @@ (define_constants
])

;;
+;; UNSPEC usage
+;;
@ -67,11 +67,11 @@ @@ -67,11 +67,11 @@
+;;
;; UNSPEC_VOLATILE usage
;;

@@ -45,96 +53,223 @@ (define_c_enum "unspecv"
UNSPECV_HTM_MTSPR
])

+(define_expand "tabort"
+ [(parallel
+ [(set (match_operand:CC 1 "cc_reg_operand" "=x")
@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
+ operands[2] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
+ MEM_VOLATILE_P (operands[2]) = 1;
+})

-(define_insn "tabort"
+(define_insn "*tabort"
[(set (match_operand:CC 1 "cc_reg_operand" "=x")
@ -96,7 +96,7 @@ @@ -96,7 +96,7 @@
"tabort. %0"
[(set_attr "type" "htm")
(set_attr "length" "4")])

-(define_insn "tabort<wd>c"
+(define_expand "tabort<wd>c"
+ [(parallel
@ -114,9 +114,9 @@ @@ -114,9 +114,9 @@
+
+(define_insn "*tabort<wd>c"
[(set (match_operand:CC 3 "cc_reg_operand" "=x")
(unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
(match_operand:GPR 1 "gpc_reg_operand" "r")
(match_operand:GPR 2 "gpc_reg_operand" "r")]
(unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
(match_operand:GPR 1 "gpc_reg_operand" "r")
(match_operand:GPR 2 "gpc_reg_operand" "r")]
- UNSPECV_HTM_TABORTXC))]
+ UNSPECV_HTM_TABORTXC))
+ (set (match_operand:BLK 4) (unspec:BLK [(match_dup 4)] UNSPEC_HTM_FENCE))]
@ -124,7 +124,7 @@ @@ -124,7 +124,7 @@
"tabort<wd>c. %0,%1,%2"
[(set_attr "type" "htm")
(set_attr "length" "4")])

-(define_insn "tabort<wd>ci"
+(define_expand "tabort<wd>ci"
+ [(parallel
@ -142,9 +142,9 @@ @@ -142,9 +142,9 @@
+
+(define_insn "*tabort<wd>ci"
[(set (match_operand:CC 3 "cc_reg_operand" "=x")
(unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
(match_operand:GPR 1 "gpc_reg_operand" "r")
(match_operand 2 "s5bit_cint_operand" "n")]
(unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
(match_operand:GPR 1 "gpc_reg_operand" "r")
(match_operand 2 "s5bit_cint_operand" "n")]
- UNSPECV_HTM_TABORTXCI))]
+ UNSPECV_HTM_TABORTXCI))
+ (set (match_operand:BLK 4) (unspec:BLK [(match_dup 4)] UNSPEC_HTM_FENCE))]
@ -152,7 +152,7 @@ @@ -152,7 +152,7 @@
"tabort<wd>ci. %0,%1,%2"
[(set_attr "type" "htm")
(set_attr "length" "4")])

-(define_insn "tbegin"
+(define_expand "tbegin"
+ [(parallel
@ -168,7 +168,7 @@ @@ -168,7 +168,7 @@
+
+(define_insn "*tbegin"
[(set (match_operand:CC 1 "cc_reg_operand" "=x")
(unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
(unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
- UNSPECV_HTM_TBEGIN))]
+ UNSPECV_HTM_TBEGIN))
+ (set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
@ -176,7 +176,7 @@ @@ -176,7 +176,7 @@
"tbegin. %0"
[(set_attr "type" "htm")
(set_attr "length" "4")])

-(define_insn "tcheck"
+(define_expand "tcheck"
+ [(parallel
@ -199,7 +199,7 @@ @@ -199,7 +199,7 @@
"tcheck %0"
[(set_attr "type" "htm")
(set_attr "length" "4")])

-(define_insn "tend"
+(define_expand "tend"
+ [(parallel
@ -215,7 +215,7 @@ @@ -215,7 +215,7 @@
+
+(define_insn "*tend"
[(set (match_operand:CC 1 "cc_reg_operand" "=x")
(unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
(unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
- UNSPECV_HTM_TEND))]
+ UNSPECV_HTM_TEND))
+ (set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
@ -223,7 +223,7 @@ @@ -223,7 +223,7 @@
"tend. %0"
[(set_attr "type" "htm")
(set_attr "length" "4")])

-(define_insn "trechkpt"
+(define_expand "trechkpt"
+ [(parallel
@ -246,7 +246,7 @@ @@ -246,7 +246,7 @@
"trechkpt."
[(set_attr "type" "htm")
(set_attr "length" "4")])

-(define_insn "treclaim"
+(define_expand "treclaim"
+ [(parallel
@ -262,7 +262,7 @@ @@ -262,7 +262,7 @@
+
+(define_insn "*treclaim"
[(set (match_operand:CC 1 "cc_reg_operand" "=x")
(unspec_volatile:CC [(match_operand:SI 0 "gpc_reg_operand" "r")]
(unspec_volatile:CC [(match_operand:SI 0 "gpc_reg_operand" "r")]
- UNSPECV_HTM_TRECLAIM))]
+ UNSPECV_HTM_TRECLAIM))
+ (set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
@ -270,7 +270,7 @@ @@ -270,7 +270,7 @@
"treclaim. %0"
[(set_attr "type" "htm")
(set_attr "length" "4")])

-(define_insn "tsr"
+(define_expand "tsr"
+ [(parallel
@ -286,7 +286,7 @@ @@ -286,7 +286,7 @@
+
+(define_insn "*tsr"
[(set (match_operand:CC 1 "cc_reg_operand" "=x")
(unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
(unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
- UNSPECV_HTM_TSR))]
+ UNSPECV_HTM_TSR))
+ (set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
@ -294,7 +294,7 @@ @@ -294,7 +294,7 @@
"tsr. %0"
[(set_attr "type" "htm")
(set_attr "length" "4")])

-(define_insn "ttest"
+(define_expand "ttest"
+ [(parallel

6
SOURCES/gcc48-pr68680.patch

@ -9,9 +9,9 @@ @@ -9,9 +9,9 @@
--- gcc/calls.c (revision 231278)
+++ gcc/calls.c (revision 231279)
@@ -564,6 +564,17 @@ special_function_p (const_tree fndecl, i
flags |= ECF_NORETURN;
flags |= ECF_NORETURN;
}

+ if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (fndecl))
+ {
@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
+
return flags;
}

--- gcc/testsuite/gcc.target/i386/pr68680.c (revision 0)
+++ gcc/testsuite/gcc.target/i386/pr68680.c (revision 231279)
@@ -0,0 +1,15 @@

6
SOURCES/gcc48-pr69116.patch

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
@@ -331,14 +331,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return pow(__x, __y); }
};

+ template<typename _Tp, bool _IsValidValarrayValue = !__is_abstract(_Tp)>
+ struct __fun_with_valarray
+ {
@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
+ {
+ // No result type defined for invalid value types.
+ };

// We need these bits in order to recover the return type of
// some functions/operators now that we're no longer using
// function templates.
@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
{
- typedef _Tp result_type;
};

// several specializations for relational operators.
--- libstdc++-v3/testsuite/26_numerics/valarray/69116.cc (nonexistent)
+++ libstdc++-v3/testsuite/26_numerics/valarray/69116.cc (revision 233265)

8
SOURCES/gcc48-pr69644.patch

@ -15,15 +15,15 @@ @@ -15,15 +15,15 @@
@@ -20263,6 +20263,9 @@ rs6000_expand_atomic_compare_and_swap (rtx operands[])
else if (reg_overlap_mentioned_p (retval, oldval))
oldval = copy_to_reg (oldval);

+ if (mode != TImode && !reg_or_short_operand (oldval, mode))
+ oldval = copy_to_mode_reg (mode, oldval);
+
mem = rs6000_pre_atomic_barrier (mem, mod_s);

label1 = NULL_RTX;
@@ -20277,10 +20280,8 @@ rs6000_expand_atomic_compare_and_swap (rtx operands[])

x = retval;
if (mask)
- {
@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
- }
+ x = expand_simple_binop (SImode, AND, retval, mask,
+ NULL_RTX, 1, OPTAB_LIB_WIDEN);

cond = gen_reg_rtx (CCmode);
/* If we have TImode, synthesize a comparison. */
--- /dev/null

4
SOURCES/gcc48-pr70549.patch

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
@@ -3846,8 +3846,13 @@ aarch64_secondary_reload (bool in_p ATTR
&& GET_MODE_SIZE (mode) == 16 && MEM_P (x))
return FP_REGS;

+ if (rclass == CORE_REGS
+ && (mode == SFmode || mode == DFmode)
+ && CONSTANT_P (x))
@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
if (rclass == FP_REGS && (mode == TImode || mode == TFmode) && CONSTANT_P(x))
- return CORE_REGS;
+ return CORE_REGS;

return NO_REGS;
}
--- gcc/testsuite/g++.dg/opt/pr70549.C.jj 2017-03-08 16:02:45.104918249 +0100

87
SOURCES/gcc48-pr72717.patch

@ -0,0 +1,87 @@ @@ -0,0 +1,87 @@
2016-12-13 Michael Meissner <meissner@linux.vnet.ibm.com>

Backport from mainline
2016-12-07 Michael Meissner <meissner@linux.vnet.ibm.com>

PR target/72717
* config/rs6000/rs6000.c (rs6000_expand_vector_init): If the
V2DImode elements are SUBREG's convert the result into DImode
rather than failing in emit_move_insn.

--- gcc/testsuite/gcc.target/powerpc/pr72717.c (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/pr72717.c (revision 243626)
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O2" } */
+
+typedef long V __attribute__((__vector_size__(32)));
+
+extern void foo (V *, V*);
+
+/* This test generated an failure in emit_move_insn. */
+
+void
+foo(V *p, V *q)
+{
+ V v = *q;
+ *p = v << v[0];
+}
--- gcc/config/rs6000/rs6000.c (revision 243625)
+++ gcc/config/rs6000/rs6000.c (revision 243626)
@@ -6667,25 +6667,43 @@
/* Double word values on VSX can use xxpermdi or lxvdsx. */
if (VECTOR_MEM_VSX_P (mode) && (mode == V2DFmode || mode == V2DImode))
{
- rtx op0 = XVECEXP (vals, 0, 0);
- rtx op1 = XVECEXP (vals, 0, 1);
+ rtx op[2];
+ size_t i;
+ size_t num_elements = (all_same) ? 1 : 2;
+ for (i = 0; i < num_elements; i++)
+ {
+ op[i] = XVECEXP (vals, 0, i);
+ /* Just in case there is a SUBREG with a smaller mode, do a
+ conversion. */
+ if (GET_MODE (op[i]) != inner_mode)
+ {
+ rtx tmp = gen_reg_rtx (inner_mode);
+ convert_move (tmp, op[i], 0);
+ op[i] = tmp;
+ }
+ /* Allow load with splat double word. */
+ else if (MEM_P (op[i]))
+ {
+ if (!all_same)
+ op[i] = force_reg (inner_mode, op[i]);
+ }
+ else if (!REG_P (op[i]))
+ op[i] = force_reg (inner_mode, op[i]);
+ }
+
if (all_same)
{
- if (!MEM_P (op0) && !REG_P (op0))
- op0 = force_reg (inner_mode, op0);
if (mode == V2DFmode)
- emit_insn (gen_vsx_splat_v2df (target, op0));
+ emit_insn (gen_vsx_splat_v2df (target, op[0]));
else
- emit_insn (gen_vsx_splat_v2di (target, op0));
+ emit_insn (gen_vsx_splat_v2di (target, op[0]));
}
else
{
- op0 = force_reg (inner_mode, op0);
- op1 = force_reg (inner_mode, op1);
if (mode == V2DFmode)
- emit_insn (gen_vsx_concat_v2df (target, op0, op1));
+ emit_insn (gen_vsx_concat_v2df (target, op[0], op[1]));
else
- emit_insn (gen_vsx_concat_v2di (target, op0, op1));
+ emit_insn (gen_vsx_concat_v2di (target, op[0], op[1]));
}
return;
}

2
SOURCES/gcc48-pr72747.patch

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
--- gcc/gimplify.c (revision 241792)
+++ gcc/gimplify.c (revision 241793)
@@ -4273,24 +4273,23 @@ gimplify_init_constructor (tree *expr_p,

if (ret == GS_ERROR)
return GS_ERROR;
- else if (want_value)

8
SOURCES/gcc48-pr72863.patch

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
+++ gcc/config/rs6000/vsx.md (revision 239762)
@@ -716,13 +716,27 @@ (define_expand "vsx_load_<mode>"
[(set (match_operand:VSX_M 0 "vsx_register_operand" "")
(match_operand:VSX_M 1 "memory_operand" ""))]
(match_operand:VSX_M 1 "memory_operand" ""))]
"VECTOR_MEM_VSX_P (<MODE>mode)"
- "")
+{
@ -24,10 +24,10 @@ @@ -24,10 +24,10 @@
+ DONE;
+ }
+})

(define_expand "vsx_store_<mode>"
[(set (match_operand:VSX_M 0 "memory_operand" "")
(match_operand:VSX_M 1 "vsx_register_operand" ""))]
(match_operand:VSX_M 1 "vsx_register_operand" ""))]
"VECTOR_MEM_VSX_P (<MODE>mode)"
- "")
+{
@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
+ DONE;
+ }
+})

;; VSX vector floating point arithmetic instructions. The VSX scalar
--- gcc/testsuite/gcc.target/powerpc/pr72863.c (nonexistent)

12
SOURCES/gcc48-pr77375.patch

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
2017-05-30 Jakub Jelinek <jakub@redhat.com>

Backported from mainline
Backported from mainline
2016-09-16 Jakub Jelinek <jakub@redhat.com>

PR c++/77375
@ -12,14 +12,14 @@ @@ -12,14 +12,14 @@
--- gcc/cp/class.c 2017-10-17 17:27:32.287980595 +0200
+++ gcc/cp/class.c 2017-10-17 17:29:11.104213281 +0200
@@ -1479,6 +1479,8 @@ check_bases (tree t,
|= CLASSTYPE_CONTAINS_EMPTY_CLASS_P (basetype);
|= CLASSTYPE_CONTAINS_EMPTY_CLASS_P (basetype);
TYPE_HAS_COMPLEX_DFLT (t) |= (!TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype)
|| TYPE_HAS_COMPLEX_DFLT (basetype));
|| TYPE_HAS_COMPLEX_DFLT (basetype));
+ if (TYPE_HAS_MUTABLE_P (basetype))
+ CLASSTYPE_HAS_MUTABLE (t) = 1;

/* A standard-layout class is a class that:
...
...
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/mutable1.C
@@ -0,0 +1,12 @@

8
SOURCES/gcc48-pr77767.patch

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
2017-05-30 Jakub Jelinek <jakub@redhat.com>

Backported from mainline
Backported from mainline
2016-12-21 Jakub Jelinek <jakub@redhat.com>

PR c/77767
@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
+ }
if (expr_const_operands == NULL)
expr_const_operands = &expr_const_operands_dummy;

- *expr = declspecs->expr;
+ if (declspecs->expr)
+ {
@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
+ *expr = declspecs->expr;
+ }
*expr_const_operands = declspecs->expr_const_operands;

if (decl_context == FUNCDEF)
--- /dev/null
+++ gcc/testsuite/gcc.c-torture/execute/pr77767.c

2
SOURCES/gcc48-pr78064.patch

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
--- libgcc/unwind-c.c (revision 241490)
+++ libgcc/unwind-c.c (revision 241491)
@@ -26,6 +26,7 @@ see the files COPYING3 and COPYING.RUNTI

#include "tconfig.h"
#include "tsystem.h"
+#include "auto-target.h"

13
SOURCES/gcc48-pr78378.patch

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
2017-05-30 Jakub Jelinek <jakub@redhat.com>

Backported from mainline
Backported from mainline
2016-11-16 Jakub Jelinek <jakub@redhat.com>

PR rtl-optimization/78378
@ -14,11 +14,11 @@ @@ -14,11 +14,11 @@
@@ -7342,6 +7342,7 @@ make_extraction (machine_mode mode, rtx inner, HOST_WIDE_INT pos,
if (tmode != BLKmode
&& ((pos_rtx == 0 && (pos % BITS_PER_WORD) == 0
&& !MEM_P (inner)
&& !MEM_P (inner)
+ && (pos == 0 || REG_P (inner))
&& (inner_mode == tmode
|| !REG_P (inner)
|| TRULY_NOOP_TRUNCATION_MODES_P (tmode, inner_mode)
&& (inner_mode == tmode
|| !REG_P (inner)
|| TRULY_NOOP_TRUNCATION_MODES_P (tmode, inner_mode)
--- /dev/null
+++ gcc/testsuite/gcc.c-torture/execute/pr78378.c
@@ -0,0 +1,18 @@
@ -40,3 +40,4 @@ @@ -40,3 +40,4 @@
+ __builtin_abort();
+ return 0;
+}


54
SOURCES/gcc48-pr78416.patch

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
+++ gcc/expmed.c
@@ -3844,7 +3844,15 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
if (unsignedp)
ext_op1 &= GET_MODE_MASK (mode);
ext_op1 &= GET_MODE_MASK (mode);
op1_is_pow2 = ((EXACT_POWER_OF_2_OR_ZERO_P (ext_op1)
- || (! unsignedp && EXACT_POWER_OF_2_OR_ZERO_P (-ext_op1))));
+ /* If mode is wider than HWI and op1 has msb set,
@ -23,12 +23,12 @@ @@ -23,12 +23,12 @@
+ <= HOST_BITS_PER_WIDE_INT
+ || INTVAL (op1) < 0)));
}

/*
@@ -3987,8 +3995,17 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
op1_is_constant = CONST_INT_P (op1);
op1_is_pow2 = (op1_is_constant
&& ((EXACT_POWER_OF_2_OR_ZERO_P (INTVAL (op1))
&& ((EXACT_POWER_OF_2_OR_ZERO_P (INTVAL (op1))
- || (! unsignedp
- && EXACT_POWER_OF_2_OR_ZERO_P (-UINTVAL (op1))))));
+ /* If mode is wider than HWI and op1 has msb set,
@ -43,49 +43,49 @@ @@ -43,49 +43,49 @@
+ <= HOST_BITS_PER_WIDE_INT
+ || INTVAL (op1) < 0))));
}

/* If one of the operands is a volatile MEM, copy it into a register. */
@@ -4031,7 +4048,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
unsigned HOST_WIDE_INT d = (INTVAL (op1)
& GET_MODE_MASK (compute_mode));

unsigned HOST_WIDE_INT d = (INTVAL (op1)
& GET_MODE_MASK (compute_mode));
- if (EXACT_POWER_OF_2_OR_ZERO_P (d))
+ if (EXACT_POWER_OF_2_OR_ZERO_P (d)
+ && (INTVAL (op1) >= 0 || size <= HOST_BITS_PER_WIDE_INT))
{
pre_shift = floor_log2 (d);
if (rem_flag)
{
pre_shift = floor_log2 (d);
if (rem_flag)
@@ -4179,6 +4197,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
goto fail1;
}
else if (EXACT_POWER_OF_2_OR_ZERO_P (d)
goto fail1;
}
else if (EXACT_POWER_OF_2_OR_ZERO_P (d)
+ && (size <= HOST_BITS_PER_WIDE_INT || d >= 0)
&& (rem_flag
? smod_pow2_cheap (speed, compute_mode)
: sdiv_pow2_cheap (speed, compute_mode))
&& (rem_flag
? smod_pow2_cheap (speed, compute_mode)
: sdiv_pow2_cheap (speed, compute_mode))
@@ -4192,7 +4211,9 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
compute_mode)
!= CODE_FOR_nothing)))
;
compute_mode)
!= CODE_FOR_nothing)))
;
- else if (EXACT_POWER_OF_2_OR_ZERO_P (abs_d))
+ else if (EXACT_POWER_OF_2_OR_ZERO_P (abs_d)
+ && (size <= HOST_BITS_PER_WIDE_INT
+ || abs_d != (unsigned HOST_WIDE_INT) d))
{
if (rem_flag)
{
{
if (rem_flag)
{
@@ -4504,7 +4525,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
case CEIL_MOD_EXPR:
if (unsignedp)
{
if (unsignedp)
{
- if (op1_is_constant && EXACT_POWER_OF_2_OR_ZERO_P (INTVAL (op1)))
+ if (op1_is_constant
+ && EXACT_POWER_OF_2_OR_ZERO_P (INTVAL (op1))
+ && (size <= HOST_BITS_PER_WIDE_INT
+ || INTVAL (op1) >= 0))
{
rtx t1, t2, t3;
unsigned HOST_WIDE_INT d = INTVAL (op1);
{
rtx t1, t2, t3;
unsigned HOST_WIDE_INT d = INTVAL (op1);
--- gcc/testsuite/gcc.dg/torture/pr78416.c
+++ gcc/testsuite/gcc.dg/torture/pr78416.c
@@ -0,0 +1,17 @@

2
SOURCES/gcc48-pr78796.patch

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
+ return aarch64_classify_tls_symbol (x);
+
return SYMBOL_FORCE_TO_MEM;

case AARCH64_CMODEL_TINY:
--- gcc/testsuite/gcc.dg/tls/pr78796.c (nonexistent)
+++ gcc/testsuite/gcc.dg/tls/pr78796.c (revision 243646)

22
SOURCES/gcc48-pr78875.patch

@ -55,9 +55,9 @@ @@ -55,9 +55,9 @@
--- gcc/config/rs6000/rs6000.c (revision 244555)
+++ gcc/config/rs6000/rs6000.c (revision 244556)
@@ -3727,6 +3727,54 @@ rs6000_option_override_internal (bool gl
atoi (rs6000_sched_insert_nops_str));
atoi (rs6000_sched_insert_nops_str));
}

+ /* Handle stack protector */
+ if (!global_options_set.x_rs6000_stack_protector_guard)
+#ifdef TARGET_THREAD_SSP_OFFSET
@ -112,8 +112,8 @@ @@ -112,8 +112,8 @@
--- gcc/config/rs6000/rs6000.md (revision 244555)
+++ gcc/config/rs6000/rs6000.md (revision 244556)
@@ -13092,19 +13092,23 @@


(define_expand "stack_protect_set"
- [(match_operand 0 "memory_operand" "")
- (match_operand 1 "memory_operand" "")]
@ -141,10 +141,10 @@ @@ -141,10 +141,10 @@
+
DONE;
})

@@ -13127,21 +13131,26 @@
(set_attr "length" "12")])

(define_expand "stack_protect_test"
- [(match_operand 0 "memory_operand" "")
- (match_operand 1 "memory_operand" "")
@ -181,13 +181,13 @@ @@ -181,13 +181,13 @@
+
DONE;
})

--- gcc/config/rs6000/rs6000-opts.h (revision 244555)
+++ gcc/config/rs6000/rs6000-opts.h (revision 244556)
@@ -154,6 +154,12 @@ enum rs6000_vector {
VECTOR_OTHER /* Some other vector unit */
};

+/* Where to get the canary for the stack protector. */
+enum stack_protector_guard {
+ SSP_TLS, /* per-thread canary in TLS block */
@ -207,11 +207,11 @@ @@ -207,11 +207,11 @@
+-mcompat-align-parm -mno-compat-align-parm @gol
+-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
+-mstack-protector-guard-offset=@var{offset}}

@emph{RX Options}
@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
@@ -18295,6 +18297,23 @@ GCC.

In this version of the compiler, the @option{-mcompat-align-parm}
is the default, except when using the Linux ELFv2 ABI.
+
@ -232,7 +232,7 @@ @@ -232,7 +232,7 @@
+offset from that base register. The default for those is as specified in the
+relevant ABI.
@end table

@node RX Options
--- gcc/testsuite/gcc.target/powerpc/ssp-1.c (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/ssp-1.c (revision 244562)

8
SOURCES/gcc48-pr79439.patch

@ -9,14 +9,14 @@ @@ -9,14 +9,14 @@
--- gcc/config/rs6000/predicates.md (revision 245812)
+++ gcc/config/rs6000/predicates.md (revision 245813)
@@ -1086,8 +1086,8 @@
&& ((DEFAULT_ABI != ABI_AIX
&& DEFAULT_ABI != ABI_ELFv2)
|| !SYMBOL_REF_EXTERNAL_P (op)))
&& ((DEFAULT_ABI != ABI_AIX
&& DEFAULT_ABI != ABI_ELFv2)
|| !SYMBOL_REF_EXTERNAL_P (op)))
- || (op == XEXP (DECL_RTL (current_function_decl),
- 0)))")))
+ || (op == XEXP (DECL_RTL (current_function_decl), 0)
+ && !decl_replaceable_p (current_function_decl)))")))

;; Return 1 if this operand is a valid input for a move insn.
(define_predicate "input_operand"
--- gcc/testsuite/gcc.target/powerpc/pr79439.c (nonexistent)

2
SOURCES/gcc48-pr79969.patch

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
+ a forward declaration. */
+ else if (TYPE_STUB_DECL (enumtype))
+ DECL_SOURCE_LOCATION (TYPE_STUB_DECL (enumtype)) = loc;

if (C_TYPE_BEING_DEFINED (enumtype))
error_at (loc, "nested redefinition of %<enum %E%>", name);
--- gcc/testsuite/gcc.dg/debug/dwarf2/enum-loc1.c.jj 2017-03-09 08:09:30.742037844 +0100

16
SOURCES/gcc48-pr80129.patch

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
2017-05-30 Jakub Jelinek <jakub@redhat.com>

Backported from mainline
Backported from mainline
2017-03-22 Jakub Jelinek <jakub@redhat.com>

PR c++/80129
@ -12,9 +12,9 @@ @@ -12,9 +12,9 @@
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -4293,6 +4293,14 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p,
if (ret != GS_ERROR)
ret = GS_OK;

if (ret != GS_ERROR)
ret = GS_OK;
+ /* If we are going to write RESULT more than once, clear
+ TREE_READONLY flag, otherwise we might incorrectly promote
+ the variable to static const and initialize it at compile
@ -23,9 +23,9 @@ @@ -23,9 +23,9 @@
+ && TREE_TYPE (TREE_OPERAND (cond, 1)) != void_type_node
+ && TREE_TYPE (TREE_OPERAND (cond, 2)) != void_type_node)
+ TREE_READONLY (result) = 0;
if (TREE_TYPE (TREE_OPERAND (cond, 1)) != void_type_node)
TREE_OPERAND (cond, 1)
= build2 (code, void_type_node, result,
if (TREE_TYPE (TREE_OPERAND (cond, 1)) != void_type_node)
TREE_OPERAND (cond, 1)
= build2 (code, void_type_node, result,
--- /dev/null
+++ gcc/testsuite/g++.dg/torture/pr80129.C
@@ -0,0 +1,14 @@

8
SOURCES/gcc48-pr80362.patch

@ -13,15 +13,15 @@ @@ -13,15 +13,15 @@
+++ gcc/fold-const.c
@@ -11940,8 +11942,8 @@ fold_binary_loc (location_t loc,
/* Convert -A / -B to A / B when the type is signed and overflow is
undefined. */
undefined. */
if ((!INTEGRAL_TYPE_P (type) || TYPE_OVERFLOW_UNDEFINED (type))
- && TREE_CODE (arg0) == NEGATE_EXPR
- && negate_expr_p (arg1))
+ && TREE_CODE (op0) == NEGATE_EXPR
+ && negate_expr_p (op1))
{
if (INTEGRAL_TYPE_P (type))
fold_overflow_warning (("assuming signed overflow does not occur "
{
if (INTEGRAL_TYPE_P (type))
fold_overflow_warning (("assuming signed overflow does not occur "
--- /dev/null
+++ gcc/testsuite/gcc.dg/torture/pr80362.c
@@ -0,0 +1,11 @@

4
SOURCES/gcc48-pr80692.patch

@ -14,13 +14,13 @@ @@ -14,13 +14,13 @@
@@ -950,12 +950,12 @@ do_compare (const REAL_VALUE_TYPE *a, const REAL_VALUE_TYPE *b,
gcc_unreachable ();
}

- if (a->sign != b->sign)
- return -a->sign - -b->sign;
-
if (a->decimal || b->decimal)
return decimal_do_compare (a, b, nan_result);

+ if (a->sign != b->sign)
+ return -a->sign - -b->sign;
+

67
SOURCES/gcc48-pr81395.patch

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
2017-07-18 Jonathan Wakely <jwakely@redhat.com>

PR libstdc++/81395
* include/bits/fstream.tcc (basic_filebuf::xsgetn): Don't set buffer
pointers for write mode after reading.
* testsuite/27_io/basic_filebuf/sgetn/char/81395.cc: New.

--- libstdc++-v3/include/bits/fstream.tcc (revision 254017)
+++ libstdc++-v3/include/bits/fstream.tcc (revision 254018)
@@ -699,7 +699,7 @@
if (__n == 0)
{
- _M_set_buffer(0);
+ // Set _M_reading. Buffer is already in initial 'read' mode.
_M_reading = true;
}
else if (__len == 0)
--- libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/81395.cc (nonexistent)
+++ libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/81395.cc (revision 254018)
@@ -0,0 +1,46 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-fileio "" }
+
+// PR libstdc++/81395
+
+#include <fstream>
+#include <cstring> // for std::memset
+#include <cstdio> // For BUFSIZ
+
+using std::memset;
+
+int main()
+{
+ {
+ std::filebuf fb;
+ fb.open("test.txt", std::ios::out);
+ char data[BUFSIZ];
+ memset(data, 'A', sizeof(data));
+ fb.sputn(data, sizeof(data));
+ }
+
+ std::filebuf fb;
+ fb.open("test.txt", std::ios::in|std::ios::out);
+ char buf[BUFSIZ];
+ memset(buf, 0, sizeof(buf));
+ fb.sgetn(buf, sizeof(buf));
+ // Switch from reading to writing without seeking first:
+ fb.sputn("B", 1);
+ fb.pubsync();
+}

12
SOURCES/gcc48-pr82274.patch

@ -10,15 +10,15 @@ @@ -10,15 +10,15 @@
--- libgcc/libgcc2.c 2017/10/13 16:50:13 253733
+++ libgcc/libgcc2.c 2017/10/13 17:19:12 253734
@@ -375,7 +375,8 @@
}
else
{
}
else
{
- if (uu.s.high == (Wtype) -1 && vv.s.high == (Wtype) - 1)
+ if ((uu.s.high & vv.s.high) == (Wtype) -1
+ && (uu.s.low | vv.s.low) != 0)
{
DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low
* (UDWtype) (UWtype) vv.s.low};
{
DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low
* (UDWtype) (UWtype) vv.s.low};
--- /dev/null
+++ gcc/testsuite/gcc.dg/pr82274-1.c
@@ -0,0 +1,16 @@

74
SOURCES/gcc48-rh1180633.patch

@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
@@ -32,7 +32,11 @@ using namespace GTM;
extern __thread gtm_thread_tls _gtm_thr_tls;
#endif

-gtm_rwlock GTM::gtm_thread::serial_lock;
+// Put this at the start of a cacheline so that serial_lock's writers and
+// htm_fastpath fields are on the same cacheline, so that HW transactions
@ -29,11 +29,11 @@ @@ -29,11 +29,11 @@
+ __attribute__((aligned(HW_CACHELINE_SIZE)));
gtm_thread *GTM::gtm_thread::list_of_threads = 0;
unsigned GTM::gtm_thread::number_of_threads = 0;

@@ -54,9 +58,6 @@ static pthread_mutex_t global_tid_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_key_t thr_release_key;
static pthread_once_t thr_release_once = PTHREAD_ONCE_INIT;

-// See gtm_thread::begin_transaction.
-uint32_t GTM::htm_fastpath = 0;
-
@ -69,36 +69,36 @@ @@ -69,36 +69,36 @@
+ // anything besides the serial lock, which is independent of method
+ // groups.
+ for (uint32_t t = serial_lock.get_htm_fastpath(); t; t--)
{
uint32_t ret = htm_begin();
if (htm_begin_success(ret))
{
uint32_t ret = htm_begin();
if (htm_begin_success(ret))
@@ -197,9 +205,11 @@ GTM::gtm_thread::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
// We are executing a transaction now.
// Monitor the writer flag in the serial-mode lock, and abort
// if there is an active or waiting serial-mode transaction.
// We are executing a transaction now.
// Monitor the writer flag in the serial-mode lock, and abort
// if there is an active or waiting serial-mode transaction.
+ // Also checks that htm_fastpath is still nonzero and thus
+ // HW transactions are allowed to run.
// Note that this can also happen due to an enclosing
// serial-mode transaction; we handle this case below.
// Note that this can also happen due to an enclosing
// serial-mode transaction; we handle this case below.
- if (unlikely(serial_lock.is_write_locked()))
+ if (unlikely(serial_lock.htm_fastpath_disabled()))
htm_abort();
else
// We do not need to set a_saveLiveVariables because of HTM.
htm_abort();
else
// We do not need to set a_saveLiveVariables because of HTM.
@@ -210,9 +220,12 @@ GTM::gtm_thread::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
// retrying the transaction will be successful.
if (!htm_abort_should_retry(ret))
break;
// retrying the transaction will be successful.
if (!htm_abort_should_retry(ret))
break;
+ // Check whether the HTM fastpath has been disabled.
+ if (!serial_lock.get_htm_fastpath())
+ break;
// Wait until any concurrent serial-mode transactions have finished.
// This is an empty critical section, but won't be elided.
// Wait until any concurrent serial-mode transactions have finished.
// This is an empty critical section, but won't be elided.
- if (serial_lock.is_write_locked())
+ if (serial_lock.htm_fastpath_disabled())
{
tx = gtm_thr();
if (unlikely(tx == NULL))
{
tx = gtm_thr();
if (unlikely(tx == NULL))
@@ -618,7 +631,7 @@ _ITM_commitTransaction(void)
// a serial-mode transaction. If we are, then there will be no other
// concurrent serial-mode transaction.
@ -128,7 +128,7 @@ @@ -128,7 +128,7 @@
+// standard layout, and the writers field must be first (i.e., so the
+// assembler code can assume that its address is equal to the address of the
+// respective instance of the class), and htm_fastpath must be second.

class gtm_rwlock
{
- // TODO Put futexes on different cachelines?
@ -143,18 +143,18 @@ @@ -143,18 +143,18 @@
+ // should remain on the same cacheline.
std::atomic<int> writer_readers;// A confirmed writer waits here for readers.
std::atomic<int> readers; // Readers wait here for writers (iff true).

public:
- gtm_rwlock() : writers(0), writer_readers(0), readers(0) {};
+ gtm_rwlock() : writers(0), htm_fastpath(0), writer_readers(0), readers(0)
+ { }

void read_lock (gtm_thread *tx);
void read_unlock (gtm_thread *tx);
@@ -59,12 +72,28 @@ class gtm_rwlock
bool write_upgrade (gtm_thread *tx);
void write_upgrade_finish (gtm_thread *tx);

- // Returns true iff there is a concurrent active or waiting writer.
- // This is primarily useful for simple HyTM approaches, and the value being
- // checked is loaded with memory_order_relaxed.
@ -183,7 +183,7 @@ @@ -183,7 +183,7 @@
- return writers.load (memory_order_relaxed) != 0;
+ htm_fastpath.store (val, memory_order_relaxed);
}

protected:
--- libitm/config/posix/rwlock.h
+++ libitm/config/posix/rwlock.h
@ -196,7 +196,7 @@ @@ -196,7 +196,7 @@
+// standard layout, and the summary field must be first (i.e., so the
+// assembler code can assume that its address is equal to the address of the
+// respective instance of the class), and htm_fastpath must be second.

class gtm_rwlock
{
- pthread_mutex_t mutex; // Held if manipulating any field.
@ -207,7 +207,7 @@ @@ -207,7 +207,7 @@
static const unsigned a_writer = 1; // An active writer.
static const unsigned w_writer = 2; // The w_writers field != 0
static const unsigned w_reader = 4; // The w_readers field != 0

std::atomic<unsigned int> summary; // Bitmask of the above.
+
+ // We put the HTM fastpath control variable here so that HTM fastpath
@ -228,7 +228,7 @@ @@ -228,7 +228,7 @@
@@ -74,12 +87,28 @@ class gtm_rwlock
bool write_upgrade (gtm_thread *tx);
void write_upgrade_finish (gtm_thread *tx);

- // Returns true iff there is a concurrent active or waiting writer.
- // This is primarily useful for simple HyTM approaches, and the value being
- // checked is loaded with memory_order_relaxed.
@ -257,13 +257,13 @@ @@ -257,13 +257,13 @@
- return summary.load (memory_order_relaxed) & (a_writer | w_writer);
+ htm_fastpath.store (val, memory_order_relaxed);
}

protected:
--- libitm/config/posix/rwlock.cc
+++ libitm/config/posix/rwlock.cc
@@ -30,11 +30,12 @@ namespace GTM HIDDEN {
// ??? Move this back to the header file when constexpr is implemented.

gtm_rwlock::gtm_rwlock()
- : mutex (PTHREAD_MUTEX_INITIALIZER),
+ : summary (0),
@ -279,15 +279,15 @@ @@ -279,15 +279,15 @@
--- libitm/libitm_i.h
+++ libitm/libitm_i.h
@@ -336,10 +336,6 @@ extern abi_dispatch *dispatch_htm();

extern gtm_cacheline_mask gtm_mask_stack(gtm_cacheline *, gtm_cacheline_mask);

-// Control variable for the HTM fastpath that uses serial mode as fallback.
-// Non-zero if the HTM fastpath is enabled. See gtm_thread::begin_transaction.
-extern uint32_t htm_fastpath;
-
} // namespace GTM

#endif // LIBITM_I_H
--- libitm/method-serial.cc
+++ libitm/method-serial.cc
@ -306,7 +306,7 @@ @@ -306,7 +306,7 @@
+ gtm_thread::serial_lock.set_htm_fastpath(0);
}
};

@@ -288,7 +288,7 @@ GTM::gtm_thread::serialirr_mode ()
#if defined(USE_HTM_FASTPATH)
// HTM fastpath. If we are executing a HW transaction, don't go serial but
@ -315,7 +315,7 @@ @@ -315,7 +315,7 @@
+ if (likely(!gtm_thread::serial_lock.htm_fastpath_disabled()))
return;
#endif

--- libitm/query.cc
+++ libitm/query.cc
@@ -49,7 +49,7 @@ _ITM_inTransaction (void)

10
SOURCES/gcc48-rh1243366.patch

@ -10,13 +10,13 @@ @@ -10,13 +10,13 @@
+++ libstdc++-v3/include/std/streambuf
@@ -802,12 +802,22 @@
basic_streambuf(const basic_streambuf& __sb)
: _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur),
_M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg),
: _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur),
_M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg),
- _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_cur),
+ _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_end),
_M_buf_locale(__sb._M_buf_locale)
_M_buf_locale(__sb._M_buf_locale)
{ }

basic_streambuf&
- operator=(const basic_streambuf&) { return *this; };
+ operator=(const basic_streambuf& __sb)
@ -31,5 +31,5 @@ @@ -31,5 +31,5 @@
+ return *this;
+ };
};

// Explicit specialization declarations, defined in src/streambuf.cc.

22
SOURCES/gcc48-rh1278872.patch

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
@@ -7806,6 +7806,30 @@ unmark_all_dies (dw_die_ref die)
unmark_all_dies (AT_ref (a));
}

+/* Calculate if the entry should appear in the final output file. It may be
+ from a pruned a type. */
+
@ -36,9 +36,9 @@ @@ -36,9 +36,9 @@
+
/* Return the size of the .debug_pubnames or .debug_pubtypes table
generated for the compilation unit. */

@@ -7818,9 +7842,7 @@ size_of_pubnames (vec<pubname_entry, va_

size = DWARF_PUBNAMES_HEADER_SIZE;
FOR_EACH_VEC_ELT (*names, i, p)
- if (names != pubtype_table
@ -46,10 +46,10 @@ @@ -46,10 +46,10 @@
- || !flag_eliminate_unused_debug_types)
+ if (include_pubname_in_output (names, p))
size += strlen (p->name) + DWARF_OFFSET_SIZE + 1;

size += DWARF_OFFSET_SIZE;
@@ -8999,22 +9021,14 @@ output_pubnames (vec<pubname_entry, va_g

FOR_EACH_VEC_ELT (*names, i, pub)
{
- /* Enumerator names are part of the pubname table, but the parent
@ -66,13 +66,13 @@ @@ -66,13 +66,13 @@
- || pub->die->die_offset != 0
- || !flag_eliminate_unused_debug_types)
+ if (include_pubname_in_output (names, pub))
{
dw_offset die_offset = pub->die->die_offset;

{
dw_offset die_offset = pub->die->die_offset;
+ /* We shouldn't see pubnames for DIEs outside of the main CU. */
+ if (names == pubname_table)
+ gcc_assert (pub->die->die_mark);
+
/* If we're putting types in their own .debug_types sections,
the .debug_pubtypes table will still point to the compile
unit (not the type unit), so we want to use the offset of
/* If we're putting types in their own .debug_types sections,
the .debug_pubtypes table will still point to the compile
unit (not the type unit), so we want to use the offset of

2
SOURCES/gcc48-rh1296211.patch

@ -10,5 +10,5 @@ @@ -10,5 +10,5 @@
%{!T*: %(link_start) } \
-%(link_target) \
%(link_os)"

/* Shared libraries are not default. */

120
SOURCES/gcc48-rh1304449.patch

@ -40,22 +40,22 @@ @@ -40,22 +40,22 @@
--- gcc/config.gcc (revision 231943)
+++ gcc/config.gcc (revision 231945)
@@ -368,7 +368,7 @@ i[34567]86-*-*)
lzcntintrin.h bmiintrin.h bmi2intrin.h tbmintrin.h
avx2intrin.h fmaintrin.h f16cintrin.h rtmintrin.h
xtestintrin.h rdseedintrin.h prfchwintrin.h adxintrin.h
lzcntintrin.h bmiintrin.h bmi2intrin.h tbmintrin.h
avx2intrin.h fmaintrin.h f16cintrin.h rtmintrin.h
xtestintrin.h rdseedintrin.h prfchwintrin.h adxintrin.h
- fxsrintrin.h xsaveintrin.h xsaveoptintrin.h"
+ fxsrintrin.h xsaveintrin.h xsaveoptintrin.h pkuintrin.h"
;;
;;
x86_64-*-*)
cpu_type=i386
cpu_type=i386
@@ -383,7 +383,7 @@ x86_64-*-*)
lzcntintrin.h bmiintrin.h tbmintrin.h bmi2intrin.h
avx2intrin.h fmaintrin.h f16cintrin.h rtmintrin.h
xtestintrin.h rdseedintrin.h prfchwintrin.h adxintrin.h
lzcntintrin.h bmiintrin.h tbmintrin.h bmi2intrin.h
avx2intrin.h fmaintrin.h f16cintrin.h rtmintrin.h
xtestintrin.h rdseedintrin.h prfchwintrin.h adxintrin.h
- fxsrintrin.h xsaveintrin.h xsaveoptintrin.h"
+ fxsrintrin.h xsaveintrin.h xsaveoptintrin.h pkuintrin.h"
need_64bit_hwint=yes
;;
need_64bit_hwint=yes
;;
ia64-*-*)
--- gcc/common/config/i386/i386-common.c (revision 231943)
+++ gcc/common/config/i386/i386-common.c (revision 231945)
@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
#define OPTION_MASK_ISA_F16C_SET \
(OPTION_MASK_ISA_F16C | OPTION_MASK_ISA_AVX_SET)
+#define OPTION_MASK_ISA_PKU_SET OPTION_MASK_ISA_PKU

/* Define a set of ISAs which aren't available when a given ISA is
disabled. MMX and SSE ISAs are handled separately. */
@@ -164,6 +165,7 @@ along with GCC; see the file COPYING3.
@ -72,13 +72,13 @@ @@ -72,13 +72,13 @@
#define OPTION_MASK_ISA_RDRND_UNSET OPTION_MASK_ISA_RDRND
#define OPTION_MASK_ISA_F16C_UNSET OPTION_MASK_ISA_F16C
+#define OPTION_MASK_ISA_PKU_UNSET OPTION_MASK_ISA_PKU

/* Implement TARGET_HANDLE_OPTION. */

@@ -659,6 +661,19 @@ ix86_handle_option (struct gcc_options *
}
}
return true;

+ case OPT_mpku:
+ if (value)
+ {
@ -94,7 +94,7 @@ @@ -94,7 +94,7 @@
+
/* Comes from final.c -- no real reason to change it. */
#define MAX_CODE_ALIGN 16

--- gcc/config/i386/i386.h (revision 231943)
+++ gcc/config/i386/i386.h (revision 231945)
@@ -80,6 +80,7 @@ see the files COPYING3 and COPYING.RUNTI
@ -102,25 +102,25 @@ @@ -102,25 +102,25 @@
#define TARGET_XSAVE TARGET_ISA_XSAVE
#define TARGET_XSAVEOPT TARGET_ISA_XSAVEOPT
+#define TARGET_PKU TARGET_ISA_PKU

#define TARGET_LP64 TARGET_ABI_64
#define TARGET_X32 TARGET_ABI_X32
--- gcc/config/i386/i386.md (revision 231943)
+++ gcc/config/i386/i386.md (revision 231945)
@@ -224,6 +224,9 @@ (define_c_enum "unspecv" [
UNSPECV_XTEST

UNSPECV_NLGR
+
+ ;; For RDPKRU and WRPKRU support
+ UNSPECV_PKU
])

;; Constants to represent rounding modes in the ROUND instruction
@@ -18289,6 +18292,48 @@ (define_insn "xtest_1"
[(set_attr "type" "other")
(set_attr "length" "3")])

+;; RDPKRU and WRPKRU
+
+(define_expand "rdpkru"
@ -219,20 +219,20 @@ @@ -219,20 +219,20 @@
@@ -74,6 +74,10 @@
#define bit_RDSEED (1 << 18)
#define bit_ADX (1 << 19)

+/* %ecx */
+#define bit_PKU (1 << 3)
+#define bit_OSPKE (1 << 4)
+
+
/* Extended State Enumeration Sub-leaf (%eax == 13, %ecx == 1) */
#define bit_XSAVEOPT (1 << 0)

--- gcc/config/i386/x86intrin.h (revision 231943)
+++ gcc/config/i386/x86intrin.h (revision 231945)
@@ -119,4 +119,8 @@

#include <adxintrin.h>

+#ifdef __PKU__
+#include <pkuintrin.h>
+#endif
@ -266,9 +266,9 @@ @@ -266,9 +266,9 @@
unsigned int has_rdseed = 0, has_prfchw = 0, has_adx = 0;
unsigned int has_osxsave = 0, has_fxsr = 0, has_xsave = 0, has_xsaveopt = 0;
+ unsigned int has_pku = 0;

bool arch;

@@ -479,6 +480,8 @@ const char *host_detect_local_cpu (int a
has_fsgsbase = ebx & bit_FSGSBASE;
has_rdseed = ebx & bit_RDSEED;
@ -276,22 +276,22 @@ @@ -276,22 +276,22 @@
+
+ has_pku = ecx & bit_OSPKE;
}

if (max_level >= 13)
@@ -855,12 +858,13 @@ const char *host_detect_local_cpu (int a
const char *fxsr = has_fxsr ? " -mfxsr" : " -mno-fxsr";
const char *xsave = has_xsave ? " -mxsave" : " -mno-xsave";
const char *xsaveopt = has_xsaveopt ? " -mxsaveopt" : " -mno-xsaveopt";
+ const char *pku = has_pku ? " -mpku" : " -mno-pku";

options = concat (options, cx16, sahf, movbe, ase, pclmul,
popcnt, abm, lwp, fma, fma4, xop, bmi, bmi2,
tbm, avx, avx2, sse4_2, sse4_1, lzcnt, rtm,
hle, rdrnd, f16c, fsgsbase, rdseed, prfchw, adx,
popcnt, abm, lwp, fma, fma4, xop, bmi, bmi2,
tbm, avx, avx2, sse4_2, sse4_1, lzcnt, rtm,
hle, rdrnd, f16c, fsgsbase, rdseed, prfchw, adx,
- fxsr, xsave, xsaveopt, NULL);
+ fxsr, xsave, xsaveopt, pku, NULL);
}

done:
--- gcc/config/i386/i386.c (revision 231943)
+++ gcc/config/i386/i386.c (revision 231945)
@ -301,45 +301,45 @@ @@ -301,45 +301,45 @@
{ "-mxsaveopt", OPTION_MASK_ISA_XSAVEOPT },
+ { "-mpku", OPTION_MASK_ISA_PKU },
};

/* Flag options. */
@@ -2905,6 +2906,7 @@ ix86_option_override_internal (bool main
#define PTA_FXSR (HOST_WIDE_INT_1 << 37)
#define PTA_XSAVE (HOST_WIDE_INT_1 << 38)
#define PTA_XSAVEOPT (HOST_WIDE_INT_1 << 39)
+#define PTA_PKU (HOST_WIDE_INT_1 << 60)

/* if this reaches 64, need to widen struct pta flags below */

@@ -3429,6 +3431,9 @@ ix86_option_override_internal (bool main
if (processor_alias_table[i].flags & PTA_XSAVEOPT
&& !(ix86_isa_flags_explicit & OPTION_MASK_ISA_XSAVEOPT))
ix86_isa_flags |= OPTION_MASK_ISA_XSAVEOPT;
if (processor_alias_table[i].flags & PTA_XSAVEOPT
&& !(ix86_isa_flags_explicit & OPTION_MASK_ISA_XSAVEOPT))
ix86_isa_flags |= OPTION_MASK_ISA_XSAVEOPT;
+ if (processor_alias_table[i].flags & PTA_PKU
+ && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_PKU))
+ ix86_isa_flags |= OPTION_MASK_ISA_PKU;
if (processor_alias_table[i].flags & (PTA_PREFETCH_SSE | PTA_SSE))
x86_prefetch_sse = true;

if (processor_alias_table[i].flags & (PTA_PREFETCH_SSE | PTA_SSE))
x86_prefetch_sse = true;
@@ -4220,6 +4225,7 @@ ix86_valid_target_attribute_inner_p (tre
IX86_ATTR_ISA ("fxsr", OPT_mfxsr),
IX86_ATTR_ISA ("xsave", OPT_mxsave),
IX86_ATTR_ISA ("xsaveopt", OPT_mxsaveopt),
+ IX86_ATTR_ISA ("pku", OPT_mpku),

/* enum options */
IX86_ATTR_ENUM ("fpmath=", OPT_mfpmath_),
@@ -27042,6 +27048,10 @@ enum ix86_builtins
IX86_BUILTIN_CPU_IS,
IX86_BUILTIN_CPU_SUPPORTS,

+ /* PKU instructions. */
+ IX86_BUILTIN_RDPKRU,
+ IX86_BUILTIN_WRPKRU,
+
IX86_BUILTIN_MAX
};

@@ -27357,6 +27367,10 @@ static const struct builtin_description
{ OPTION_MASK_ISA_RTM, CODE_FOR_xbegin, "__builtin_ia32_xbegin", IX86_BUILTIN_XBEGIN, UNKNOWN, (int) UNSIGNED_FTYPE_VOID },
{ OPTION_MASK_ISA_RTM, CODE_FOR_xend, "__builtin_ia32_xend", IX86_BUILTIN_XEND, UNKNOWN, (int) VOID_FTYPE_VOID },
@ -349,14 +349,14 @@ @@ -349,14 +349,14 @@
+ { OPTION_MASK_ISA_PKU, CODE_FOR_rdpkru, "__builtin_ia32_rdpkru", IX86_BUILTIN_RDPKRU, UNKNOWN, (int) UNSIGNED_FTYPE_VOID },
+ { OPTION_MASK_ISA_PKU, CODE_FOR_wrpkru, "__builtin_ia32_wrpkru", IX86_BUILTIN_WRPKRU, UNKNOWN, (int) VOID_FTYPE_UNSIGNED },
};

/* Builtins with variable number of arguments. */
--- gcc/doc/extend.texi (revision 231943)
+++ gcc/doc/extend.texi (revision 231945)
@@ -10996,6 +10996,13 @@ void __builtin_ia32_xabort (status)
int __builtin_ia32_xtest ()
@end smallexample

+The following built-in functions are available when @option{-mpku} is used.
+They generate reads and writes to PKRU.
+@smallexample
@ -366,7 +366,7 @@ @@ -366,7 +366,7 @@
+
@node X86 transactional memory intrinsics
@subsection X86 transaction memory intrinsics

--- gcc/doc/invoke.texi (revision 231943)
+++ gcc/doc/invoke.texi (revision 231945)
@@ -645,7 +645,7 @@ Objective-C and Objective-C++ Dialects}.
@ -404,22 +404,22 @@ @@ -404,22 +404,22 @@
/* { dg-do compile } */
-/* { dg-options "-O -std=c89 -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt" } */
+/* { dg-options "-O -std=c89 -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mpku" } */

#include <x86intrin.h>

--- gcc/testsuite/gcc.target/i386/sse-13.c (revision 231943)
+++ gcc/testsuite/gcc.target/i386/sse-13.c (revision 231945)
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt" } */
+/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mpku" } */

#include <mm_malloc.h>

--- gcc/testsuite/gcc.target/i386/sse-22.c (revision 231943)
+++ gcc/testsuite/gcc.target/i386/sse-22.c (revision 231945)
@@ -268,7 +268,7 @@ test_2 (_mm_clmulepi64_si128, __m128i, _

/* x86intrin.h (FMA4/XOP/LWP/BMI/BMI2/TBM/LZCNT/FMA). */
#ifdef DIFFERENT_PRAGMAS
-#pragma GCC target ("fma4,xop,lwp,bmi,bmi2,tbm,lzcnt,fma,rdseed,prfchw,adx,fxsr,xsaveopt")
@ -432,7 +432,7 @@ @@ -432,7 +432,7 @@
@@ -183,7 +183,7 @@
/* rtmintrin.h */
#define __builtin_ia32_xabort(M) __builtin_ia32_xabort(1)

-#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,fma,rtm,rdseed,prfchw,adx,fxsr,xsaveopt")
+#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,fma,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,pku")
#include <wmmintrin.h>
@ -472,13 +472,13 @@ @@ -472,13 +472,13 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt" } */
+/* { dg-options "-O -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mpku" } */

/* Test that {,x,e,p,t,s,w,a,b,i}mmintrin.h, mm3dnow.h, fma4intrin.h,
xopintrin.h, abmintrin.h, bmiintrin.h, tbmintrin.h, lwpintrin.h,
- popcntintrin.h, fmaintrin.h and mm_malloc.h.h are usable with
+ popcntintrin.h, fmaintrin.h, pkuintrin.h and mm_malloc.h.h are usable with
- popcntintrin.h, fmaintrin.h and mm_malloc.h.h are usable with
+ popcntintrin.h, fmaintrin.h, pkuintrin.h and mm_malloc.h.h are usable with
-O -pedantic-errors. */

#include <x86intrin.h>
--- gcc/testsuite/g++.dg/other/i386-3.C (revision 231943)
+++ gcc/testsuite/g++.dg/other/i386-3.C (revision 231945)
@ -486,11 +486,11 @@ @@ -486,11 +486,11 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O -fkeep-inline-functions -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt" } */
+/* { dg-options "-O -fkeep-inline-functions -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mpku" } */

/* Test that {,x,e,p,t,s,w,a,b,i}mmintrin.h, mm3dnow.h, fma4intrin.h,
xopintrin.h, abmintrin.h, bmiintrin.h, tbmintrin.h, lwpintrin.h,
- popcntintrin.h, fmaintrin.h and mm_malloc.h are usable with
+ popcntintrin.h, fmaintrin.h, pkuintrin.h and mm_malloc.h are usable with
-O -fkeep-inline-functions. */

#include <x86intrin.h>

22
SOURCES/gcc48-rh1312436.patch

@ -7,16 +7,16 @@ @@ -7,16 +7,16 @@
--- gcc/dwarf2out.c (revision 231184)
+++ gcc/dwarf2out.c (revision 231185)
@@ -18051,18 +18051,23 @@ gen_subprogram_die (tree decl, dw_die_re
}
if (mode == VOIDmode || mode == BLKmode)
continue;
}
if (mode == VOIDmode || mode == BLKmode)
continue;
- if (XEXP (XEXP (arg, 0), 0) == pc_rtx)
+ /* Get dynamic information about call target only if we
+ have no static information: we cannot generate both
+ DW_AT_abstract_origin and DW_AT_GNU_call_site_target
+ attributes. */
+ if (ca_loc->symbol_ref == NULL_RTX)
{
{
- gcc_assert (ca_loc->symbol_ref == NULL_RTX);
- tloc = XEXP (XEXP (arg, 0), 1);
- continue;
@ -38,18 +38,18 @@ @@ -38,18 +38,18 @@
+ tlocc = XEXP (XEXP (arg, 0), 1);
+ continue;
+ }
}
reg = NULL;
if (REG_P (XEXP (XEXP (arg, 0), 0)))
}
reg = NULL;
if (REG_P (XEXP (XEXP (arg, 0), 0)))
@@ -20842,15 +20847,27 @@ dwarf2out_var_location (rtx loc_note)
if (!CALL_P (prev))
prev = XVECEXP (PATTERN (prev), 0, 0);
prev = XVECEXP (PATTERN (prev), 0, 0);
ca_loc->tail_call_p = SIBLING_CALL_P (prev);
+
+ /* Look for a SYMBOL_REF in the "prev" instruction. */
x = get_call_rtx_from (PATTERN (prev));
if (x)
{
{
- x = XEXP (XEXP (x, 0), 0);
- if (GET_CODE (x) == SYMBOL_REF
- && SYMBOL_REF_DECL (x)
@ -69,8 +69,8 @@ @@ -69,8 +69,8 @@
+ && MEM_EXPR (x)
+ && TREE_CODE (MEM_EXPR (x)) == FUNCTION_DECL)
+ ca_loc->symbol_ref = XEXP (DECL_RTL (MEM_EXPR (x)), 0);
}
}
+
ca_loc->block = insn_scope (prev);
if (call_arg_locations)
call_arg_loc_last->next = ca_loc;
call_arg_loc_last->next = ca_loc;

12
SOURCES/gcc48-rh1344807.patch

@ -10,16 +10,16 @@ @@ -10,16 +10,16 @@
--- gcc/cp/call.c.jj 2014-08-06 10:45:03.260163142 +0200
+++ gcc/cp/call.c 2016-06-15 11:15:06.663878423 +0200
@@ -1975,7 +1975,9 @@ add_function_candidate (struct z_candida
bool rv = FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (fn));
parmtype = cp_build_reference_type (parmtype, rv);
if (TREE_CODE (arg) == CONVERT_EXPR
bool rv = FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (fn));
parmtype = cp_build_reference_type (parmtype, rv);
if (TREE_CODE (arg) == CONVERT_EXPR
- && TYPE_PTR_P (TREE_TYPE (arg)))
+ && TYPE_PTR_P (TREE_TYPE (arg))
+ && (TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0)))
+ == REFERENCE_TYPE))
/* Strip conversion from reference to pointer. */
arg = TREE_OPERAND (arg, 0);
arg = build_fold_indirect_ref (arg);
/* Strip conversion from reference to pointer. */
arg = TREE_OPERAND (arg, 0);
arg = build_fold_indirect_ref (arg);
--- gcc/testsuite/g++.dg/cpp0x/ref-qual17.C.jj 2016-06-15 11:12:57.692558903 +0200
+++ gcc/testsuite/g++.dg/cpp0x/ref-qual17.C 2016-06-15 11:07:02.000000000 +0200
@@ -0,0 +1,12 @@

6
SOURCES/gcc48-rh1369183.patch

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
@@ -418,6 +418,13 @@ gfc_compare_derived_types (gfc_symbol *d
&& !(derived1->attr.is_bind_c && derived2->attr.is_bind_c))
return 0;

+ /* Protect against null components. */
+ if (derived1->attr.zero_comp != derived2->attr.zero_comp)
+ return 0;
@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
+
dt1 = derived1->components;
dt2 = derived2->components;

--- gcc/testsuite/gfortran.dg/rh1369183.f90.jj 2017-03-07 18:37:39.574775432 +0100
+++ gcc/testsuite/gfortran.dg/rh1369183.f90 2017-03-07 18:38:38.423993194 +0100
@@ -0,0 +1,22 @@
@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
+end module mod1369183
+subroutine rh1369183
+ use mod1369183
+ implicit none
+ implicit none
+ type test_t
+ sequence
+ end type test_t

40
SOURCES/gcc48-rh1402585.patch

@ -1,32 +1,32 @@ @@ -1,32 +1,32 @@
--- gcc/reload.c (revision 235552)
+++ gcc/reload.c (working copy)
@@ -4054,14 +4054,14 @@ find_reloads (rtx insn, int replace, int
&XEXP (recog_data.operand[i], 0), (rtx*) 0,
base_reg_class (VOIDmode, as, MEM, SCRATCH),
address_mode,
&XEXP (recog_data.operand[i], 0), (rtx*) 0,
base_reg_class (VOIDmode, as, MEM, SCRATCH),
address_mode,
- VOIDmode, 0, 0, i, RELOAD_FOR_INPUT);
+ VOIDmode, 0, 0, i, RELOAD_OTHER);
rld[operand_reloadnum[i]].inc
= GET_MODE_SIZE (GET_MODE (recog_data.operand[i]));

/* If this operand is an output, we will have made any
reloads for its address as RELOAD_FOR_OUTPUT_ADDRESS, but
now we are treating part of the operand as an input, so
rld[operand_reloadnum[i]].inc
= GET_MODE_SIZE (GET_MODE (recog_data.operand[i]));
/* If this operand is an output, we will have made any
reloads for its address as RELOAD_FOR_OUTPUT_ADDRESS, but
now we are treating part of the operand as an input, so
- we must change these to RELOAD_FOR_INPUT_ADDRESS. */
+ we must change these to RELOAD_FOR_OTHER_ADDRESS. */

if (modified[i] == RELOAD_WRITE)
{
if (modified[i] == RELOAD_WRITE)
{
@@ -4070,10 +4070,10 @@ find_reloads (rtx insn, int replace, int
if (rld[j].opnum == i)
{
if (rld[j].when_needed == RELOAD_FOR_OUTPUT_ADDRESS)
if (rld[j].opnum == i)
{
if (rld[j].when_needed == RELOAD_FOR_OUTPUT_ADDRESS)
- rld[j].when_needed = RELOAD_FOR_INPUT_ADDRESS;
+ rld[j].when_needed = RELOAD_FOR_OTHER_ADDRESS;
else if (rld[j].when_needed
== RELOAD_FOR_OUTADDR_ADDRESS)
else if (rld[j].when_needed
== RELOAD_FOR_OUTADDR_ADDRESS)
- rld[j].when_needed = RELOAD_FOR_INPADDR_ADDRESS;
+ rld[j].when_needed = RELOAD_FOR_OTHER_ADDRESS;
}
}
}
}
}
}

28
SOURCES/gcc48-rh1468546.patch

@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
@@ -4953,6 +4953,10 @@ Define this macro if the code for function profiling should come before
the function prologue. Normally, the profiling code comes after.
@end defmac

+@deftypefn {Target Hook} bool TARGET_KEEP_LEAF_WHEN_PROFILED (void)
+This target hook returns true if the target wants the leaf flag for the current function to stay true even if it calls mcount. This might make sense for targets using the leaf flag only to determine whether a stack frame needs to be generated or not and for which the call to mcount is generated before the function prologue.
+@end deftypefn
@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
@@ -3963,6 +3963,8 @@ Define this macro if the code for function profiling should come before
the function prologue. Normally, the profiling code comes after.
@end defmac

+@hook TARGET_KEEP_LEAF_WHEN_PROFILED
+
@node Tail Calls
@ -50,20 +50,20 @@ @@ -50,20 +50,20 @@
@@ -4241,7 +4241,9 @@ leaf_function_p (void)
{
rtx insn;

- if (crtl->profile || profile_arc_flag)
+ /* Some back-ends (e.g. s390) want leaf functions to stay leaf
+ functions even if they call mcount. */
+ if (crtl->profile && !targetm.keep_leaf_when_profiled ())
return 0;

for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
--- gcc/target.def
+++ gcc/target.def
@@ -2658,6 +2658,18 @@ The default version of this hook use the target macro\n\
bool, (void),
default_profile_before_prologue)

+/* Return true if a leaf function should stay leaf even with profiling
+ enabled. */
+DEFHOOK
@ -84,7 +84,7 @@ @@ -84,7 +84,7 @@
@@ -1447,6 +1447,15 @@ default_get_reg_raw_mode (int regno)
return reg_raw_mode[regno];
}

+/* Return true if a leaf function should stay leaf even with profiling
+ enabled. */
+
@ -100,29 +100,29 @@ @@ -100,29 +100,29 @@
--- gcc/targhooks.h
+++ gcc/targhooks.h
@@ -188,6 +188,7 @@ extern section * default_function_sectio
bool startup, bool exit);
bool startup, bool exit);
extern enum machine_mode default_dwarf_frame_reg_mode (int);
extern enum machine_mode default_get_reg_raw_mode(int);
+extern bool default_keep_leaf_when_profiled ();

extern void *default_get_pch_validity (size_t *);
extern const char *default_pch_valid_p (const void *, size_t);
--- gcc/config/rs6000/rs6000.c
+++ gcc/config/rs6000/rs6000.c
@@ -24433,7 +24433,6 @@ rs6000_output_function_prologue (FILE *file,
gcc_assert (!TARGET_32BIT);

asm_fprintf (file, "\tmflr %s\n", reg_names[0]);
- asm_fprintf (file, "\tstd %s,16(%s)\n", reg_names[0], reg_names[1]);

/* In the ELFv2 ABI we have no compiler stack word. It must be
the resposibility of _mcount to preserve the static chain
the resposibility of _mcount to preserve the static chain
--- gcc/config/rs6000/linux64.h
+++ gcc/config/rs6000/linux64.h
@@ -59,6 +59,9 @@ extern int dot_symbols;

#define TARGET_PROFILE_KERNEL profile_kernel

+#undef TARGET_KEEP_LEAF_WHEN_PROFILED
+#define TARGET_KEEP_LEAF_WHEN_PROFILED rs6000_keep_leaf_when_profiled
+
@ -134,7 +134,7 @@ @@ -134,7 +134,7 @@
@@ -26237,6 +26237,14 @@ rs6000_output_function_prologue (FILE *file,
rs6000_pic_labelno++;
}

+/* -mprofile-kernel code calls mcount before the function prolog,
+ so a profiled leaf function should stay a leaf function. */
+static bool

16
SOURCES/gcc48-rh1469384.patch

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
2017-07-25 Jonathan Wakely <jwakely@redhat.com>

PR libstdc++/53984
* include/bits/basic_ios.h (basic_ios::_M_setstate): Adjust comment.
* include/bits/istream.tcc (basic_istream::sentry): Handle exceptions
@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
@@ -157,8 +157,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
setstate(iostate __state)
{ this->clear(this->rdstate() | __state); }

- // Flip the internal state on for the proper state bits, then re
- // throws the propagated exception if bit also set in
+ // Flip the internal state on for the proper state bits, then
@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
-
- const __ctype_type& __ct = __check_facet(__in._M_ctype);
- while (!traits_type::eq_int_type(__c, __eof)
- && __ct.is(ctype_base::space,
- && __ct.is(ctype_base::space,
- traits_type::to_char_type(__c)))
- __c = __sb->snextc();
+ __try
@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
+ && __ct.is(ctype_base::space,
+ traits_type::to_char_type(__c)))
+ __c = __sb->snextc();

- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 195. Should basic_istream::sentry's constructor ever
- // set eofbit?
@ -79,9 +79,9 @@ @@ -79,9 +79,9 @@
+ }
+ __catch(...)
+ { __in._M_setstate(ios_base::badbit); }

if (__in.good() && __err == ios_base::goodbit)
_M_ok = true;
_M_ok = true;
--- libstdc++-v3/include/std/istream
+++ libstdc++-v3/include/std/istream
@@ -150,9 +150,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -95,7 +95,7 @@ @@ -95,7 +95,7 @@
+ * ios_base::failure to be thrown) and the original exception will
+ * be rethrown if badbit is set in the exceptions mask.
*/

//@{
@@ -286,9 +286,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* by gcount().
@ -108,7 +108,7 @@ @@ -108,7 +108,7 @@
+ * ios_base::failure to be thrown) and the original exception will
+ * be rethrown if badbit is set in the exceptions mask.
*/

/**
--- /dev/null
+++ libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc

12
SOURCES/gcc48-rh1469697-1.patch

@ -17,15 +17,15 @@ index 5b18468439d..4fb41b1112b 100644 @@ -17,15 +17,15 @@ index 5b18468439d..4fb41b1112b 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -216,10 +216,6 @@ static const size_t extra_order_size_table[] = {

#define ROUND_UP_VALUE(x, f) ((f) - 1 - ((f) - 1 + (x)) % (f))

-/* Compute the smallest multiple of F that is >= X. */
-
-#define ROUND_UP(x, f) (CEIL (x, f) * (f))
-
/* Round X to next multiple of the page size */

#define PAGE_ALIGN(x) (((x) + G.pagesize - 1) & ~(G.pagesize - 1))
diff --git a/gcc/hwint.h b/gcc/hwint.h
index da62fadcc9e..64b1805345d 100644
@ -34,11 +34,11 @@ index da62fadcc9e..64b1805345d 100644 @@ -34,11 +34,11 @@ index da62fadcc9e..64b1805345d 100644
@@ -76,7 +76,9 @@ extern char sizeof_long_long_must_be_8[sizeof(long long) == 8 ? 1 : -1];
# endif
#endif

+#define HOST_WIDE_INT_UC(X) HOST_WIDE_INT_C (X ## U)
#define HOST_WIDE_INT_1 HOST_WIDE_INT_C(1)
+#define HOST_WIDE_INT_1U HOST_WIDE_INT_UC(1)

/* This is a magic identifier which allows GCC to figure out the type
of HOST_WIDE_INT for %wd specifier checks. You must issue this
diff --git a/gcc/system.h b/gcc/system.h
@ -48,7 +48,7 @@ index 41cd565538a..8230d506fc3 100644 @@ -48,7 +48,7 @@ index 41cd565538a..8230d506fc3 100644
@@ -348,6 +348,12 @@ extern int errno;
/* Returns the least number N such that N * Y >= X. */
#define CEIL(x,y) (((x) + (y) - 1) / (y))

+/* This macro rounds x up to the y boundary. */
+#define ROUND_UP(x,y) (((x) + (y) - 1) & ~((y) - 1))
+

9
SOURCES/gcc48-rh1469697-10.patch

@ -4,11 +4,11 @@ Date: Thu Sep 21 22:03:59 2017 +0000 @@ -4,11 +4,11 @@ Date: Thu Sep 21 22:03:59 2017 +0000

* config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash):
Fix dump output if the only stack space is for pushed registers.

* lib/target-supports.exp
(check_effective_target_frame_pointer_for_non_leaf): Add
case for x86 Solaris.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253082 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
@ -32,14 +32,14 @@ index a9072f58f50..d8a225195ae 100644 @@ -32,14 +32,14 @@ index a9072f58f50..d8a225195ae 100644
+ dump_stack_clash_frame_info (NO_PROBE_NO_FRAME, false);
return;
}

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index f24c5c6e0ac..7c126e4122b 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5439,6 +5439,12 @@ proc check_effective_target_frame_pointer_for_non_leaf { } {
if { [istarget aarch*-*-*] } {
return 1
return 1
}
+
+ # Solaris/x86 defaults to -fno-omit-frame-pointer.
@ -49,3 +49,4 @@ index f24c5c6e0ac..7c126e4122b 100644 @@ -49,3 +49,4 @@ index f24c5c6e0ac..7c126e4122b 100644
+
return 0
}

68
SOURCES/gcc48-rh1469697-11.patch

@ -18,11 +18,11 @@ Date: Mon Sep 25 23:13:55 2017 +0000 @@ -18,11 +18,11 @@ Date: Mon Sep 25 23:13:55 2017 +0000
* rs6000.md (allocate_stack): Handle -fstack-clash-protection.
(probe_stack_range<P:mode>): Operand 0 is now early-clobbered.
Add additional operand and pass it to output_probe_stack_range.

* lib/target-supports.exp
(check_effective_target_supports_stack_clash_protection): Enable for
rs6000 and powerpc targets.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253179 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
@ -45,11 +45,11 @@ index a9052c6becf..c5d9988c1d9 100644 @@ -45,11 +45,11 @@ index a9052c6becf..c5d9988c1d9 100644
@@ -22320,6 +22320,220 @@ rs6000_emit_stack_tie (rtx fp, bool hard_frame_needed)
emit_insn (gen_stack_tie (gen_rtx_PARALLEL (VOIDmode, p)));
}

+/* Allocate SIZE_INT bytes on the stack using a store with update style insn
+ and set the appropriate attributes for the generated insn. Return the
+ first insn which adjusts the stack pointer or the last insn before
+ the stack adjustment loop.
+ the stack adjustment loop.
+
+ SIZE_INT is used to create the CFI note for the allocation.
+
@ -74,7 +74,7 @@ index a9052c6becf..c5d9988c1d9 100644 @@ -74,7 +74,7 @@ index a9052c6becf..c5d9988c1d9 100644
+ try_split (PATTERN (insn), insn, 0);
+ size_rtx = tmp_reg;
+ }
+
+
+ if (Pmode == SImode)
+ insn = emit_insn (gen_movsi_update_stack (stack_pointer_rtx,
+ stack_pointer_rtx,
@ -268,13 +268,13 @@ index a9052c6becf..c5d9988c1d9 100644 @@ -268,13 +268,13 @@ index a9052c6becf..c5d9988c1d9 100644
rtx tmp_reg = gen_rtx_REG (Pmode, 0);
rtx todec = gen_int_mode (-size, Pmode);
- rtx par, set, mem;

if (INTVAL (todec) != -size)
{
@@ -22368,6 +22581,22 @@ rs6000_emit_allocate_stack (HOST_WIDE_INT size, rtx copy_reg, int copy_off)
warning (0, "stack limit expression is not supported");
warning (0, "stack limit expression is not supported");
}

+ if (flag_stack_clash_protection)
+ {
+ if (size < get_stack_clash_protection_guard_size ())
@ -295,9 +295,9 @@ index a9052c6becf..c5d9988c1d9 100644 @@ -295,9 +295,9 @@ index a9052c6becf..c5d9988c1d9 100644
{
if (copy_off != 0)
@@ -22376,39 +22605,12 @@ rs6000_emit_allocate_stack (HOST_WIDE_INT size, rtx copy_reg, int copy_off)
emit_move_insn (copy_reg, stack_reg);
emit_move_insn (copy_reg, stack_reg);
}

- if (size > 32767)
- {
- /* Need a note here so that try_split doesn't get confused. */
@ -307,7 +307,7 @@ index a9052c6becf..c5d9988c1d9 100644 @@ -307,7 +307,7 @@ index a9052c6becf..c5d9988c1d9 100644
- try_split (PATTERN (insn), insn, 0);
- todec = tmp_reg;
- }
-
-
- insn = emit_insn (TARGET_32BIT
- ? gen_movsi_update_stack (stack_reg, stack_reg,
- todec, stack_reg)
@ -334,27 +334,27 @@ index a9052c6becf..c5d9988c1d9 100644 @@ -334,27 +334,27 @@ index a9052c6becf..c5d9988c1d9 100644
+ insn = rs6000_emit_allocate_stack_1 (size, stack_reg);
+ return;
}

#define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)
@@ -22490,9 +22692,9 @@ rs6000_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size)
until it is equal to ROUNDED_SIZE. */

until it is equal to ROUNDED_SIZE. */
if (TARGET_64BIT)
- emit_insn (gen_probe_stack_rangedi (r12, r12, r0));
+ emit_insn (gen_probe_stack_rangedi (r12, r12, stack_pointer_rtx, r0));
else
- emit_insn (gen_probe_stack_rangesi (r12, r12, r0));
+ emit_insn (gen_probe_stack_rangesi (r12, r12, stack_pointer_rtx, r0));


/* Step 4: probe at FIRST + SIZE if we cannot assert at compile-time
@@ -22504,10 +22706,10 @@ rs6000_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size)
}

/* Probe a range of stack addresses from REG1 to REG2 inclusive. These are
- absolute addresses. */
+ addresses, not offsets. */

-const char *
-output_probe_stack_range (rtx reg1, rtx reg2)
+static const char *
@ -365,7 +365,7 @@ index a9052c6becf..c5d9988c1d9 100644 @@ -365,7 +365,7 @@ index a9052c6becf..c5d9988c1d9 100644
@@ -22546,6 +22748,63 @@ output_probe_stack_range (rtx reg1, rtx reg2)
return "";
}

+/* Probe a range of stack addresses from REG1 to REG3 inclusive. These are
+ addresses, not offsets.
+
@ -427,9 +427,9 @@ index a9052c6becf..c5d9988c1d9 100644 @@ -427,9 +427,9 @@ index a9052c6becf..c5d9988c1d9 100644
with (plus:P (reg 1) VAL), and with REG2 replaced with RREG if REG2
is not NULL. It would be nice if dwarf2out_frame_debug_expr could
@@ -23857,6 +24116,13 @@ rs6000_emit_prologue (void)
}
}
}

+ /* If we are emitting stack probes, but allocate no stack, then
+ just note that in the dump file. */
+ if (flag_stack_clash_protection
@ -465,12 +465,12 @@ index cd197213480..3cd70e592c1 100644 @@ -465,12 +465,12 @@ index cd197213480..3cd70e592c1 100644
- (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
+ (minus (reg 1) (match_operand 1 "reg_or_cint_operand" "")))
(set (reg 1)
(minus (reg 1) (match_dup 1)))]
(minus (reg 1) (match_dup 1)))]
""
@@ -11835,6 +11845,15 @@
rtx neg_op0;
rtx insn, par, set, mem;

+ /* By allowing reg_or_cint_operand as the predicate we can get
+ better code for stack-clash-protection because we do not lose
+ size information. But the rest of the code expects the operand
@ -481,12 +481,12 @@ index cd197213480..3cd70e592c1 100644 @@ -481,12 +481,12 @@ index cd197213480..3cd70e592c1 100644
+ operands[1] = force_reg (Pmode, operands[1]);
+
emit_move_insn (chain, stack_bot);

/* Check stack bounds if necessary. */
@@ -11847,6 +11866,51 @@
emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
}

+ /* Allocate and probe if requested.
+ This may look similar to the loop we use for prologue allocations,
+ but it is critically different. For the former we know the loop
@ -500,7 +500,7 @@ index cd197213480..3cd70e592c1 100644 @@ -500,7 +500,7 @@ index cd197213480..3cd70e592c1 100644
+ compute_stack_clash_protection_loop_data (&rounded_size, &last_addr,
+ &residual, &probe_interval,
+ orig_op1);
+
+
+ /* We do occasionally get in here with constant sizes, we might
+ as well do a reasonable job when we obviously can. */
+ if (rounded_size != const0_rtx)
@ -537,15 +537,15 @@ index cd197213480..3cd70e592c1 100644 @@ -537,15 +537,15 @@ index cd197213480..3cd70e592c1 100644
|| INTVAL (operands[1]) > 32768)
@@ -12994,12 +13058,13 @@
(set_attr "length" "4")])

(define_insn "probe_stack_range<P:mode>"
- [(set (match_operand:P 0 "register_operand" "=r")
+ [(set (match_operand:P 0 "register_operand" "=&r")
(unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
(unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
- (match_operand:P 2 "register_operand" "r")]
+ (match_operand:P 2 "register_operand" "r")
+ (match_operand:P 3 "register_operand" "r")]
UNSPECV_PROBE_STACK_RANGE))]
UNSPECV_PROBE_STACK_RANGE))]
""
- "* return output_probe_stack_range (operands[0], operands[2]);"
+ "* return output_probe_stack_range (operands[0], operands[2], operands[3]);"
@ -558,16 +558,16 @@ index 7c126e4122b..aba99513ed0 100644 @@ -558,16 +558,16 @@ index 7c126e4122b..aba99513ed0 100644
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5421,12 +5421,12 @@ proc check_effective_target_autoincdec { } {
proc check_effective_target_supports_stack_clash_protection { } {

# Temporary until the target bits are fully ACK'd.
-# if { [istarget aarch*-*-*]
-# || [istarget powerpc*-*-*] || [istarget rs6000*-*-*] } {
+# if { [istarget aarch*-*-*] } {
# return 1
# }

if { [istarget x86_64-*-*] || [istarget i?86-*-*]
if { [istarget x86_64-*-*] || [istarget i?86-*-*]
+ || [istarget powerpc*-*-*] || [istarget rs6000*-*-*]
|| [istarget s390*-*-*] } {
return 1
|| [istarget s390*-*-*] } {
return 1
}

13
SOURCES/gcc48-rh1469697-12.patch

@ -5,7 +5,7 @@ Date: Sun Oct 8 15:44:39 2017 +0000 @@ -5,7 +5,7 @@ Date: Sun Oct 8 15:44:39 2017 +0000
* gcc.dg/stack-check-5.c: Skip with -fstack-protector.
* gcc.dg/stack-check-6.c: Likewise.
* gcc.dg/stack-check-6a.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253527 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/testsuite/gcc.dg/stack-check-5.c b/gcc/testsuite/gcc.dg/stack-check-5.c
@ -17,8 +17,8 @@ index 3178f5d8ce5..850e023ea4e 100644 @@ -17,8 +17,8 @@ index 3178f5d8ce5..850e023ea4e 100644
/* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */


/* Otherwise the S/390 back-end might save the stack pointer in f2 ()
diff --git a/gcc/testsuite/gcc.dg/stack-check-6.c b/gcc/testsuite/gcc.dg/stack-check-6.c
index ad2021c9037..ab4b0e8894c 100644
@ -29,8 +29,8 @@ index ad2021c9037..ab4b0e8894c 100644 @@ -29,8 +29,8 @@ index ad2021c9037..ab4b0e8894c 100644
/* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */


extern void foo (char *);
diff --git a/gcc/testsuite/gcc.dg/stack-check-6a.c b/gcc/testsuite/gcc.dg/stack-check-6a.c
index 6f8e7128921..468d649a4fa 100644
@ -42,5 +42,6 @@ index 6f8e7128921..468d649a4fa 100644 @@ -42,5 +42,6 @@ index 6f8e7128921..468d649a4fa 100644
/* { dg-require-effective-target supports_stack_clash_protection } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */
+

#include "stack-check-6.c"

6
SOURCES/gcc48-rh1469697-13.patch

@ -6,7 +6,7 @@ diff -rup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -6,7 +6,7 @@ diff -rup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c 2017-11-03 10:41:10.654774032 -0600
@@ -10686,8 +10686,12 @@ ix86_expand_prologue (void)
&& (flag_stack_check == STATIC_BUILTIN_STACK_CHECK
|| flag_stack_clash_protection))
|| flag_stack_clash_protection))
{
- /* We expect the registers to be saved when probes are used. */
- gcc_assert (int_registers_saved);
@ -16,6 +16,6 @@ diff -rup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -16,6 +16,6 @@ diff -rup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+ protection probing. */
+ if (!flag_stack_clash_protection)
+ gcc_assert (int_registers_saved);

if (flag_stack_clash_protection)
{
{

10
SOURCES/gcc48-rh1469697-14.patch

@ -23,7 +23,7 @@ index 5afc167d569..cadf193cfcf 100644 @@ -23,7 +23,7 @@ index 5afc167d569..cadf193cfcf 100644
@@ -969,6 +969,199 @@ aarch64_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
return true;
}

+static int
+aarch64_internal_mov_immediate (rtx dest, rtx imm, bool generate,
+ enum machine_mode mode)
@ -218,12 +218,12 @@ index 5afc167d569..cadf193cfcf 100644 @@ -218,12 +218,12 @@ index 5afc167d569..cadf193cfcf 100644
+}
+
/* Implement TARGET_PASS_BY_REFERENCE. */

static bool
@@ -1476,6 +1669,47 @@ aarch64_libgcc_cmp_return_mode (void)
return SImode;
}

+#define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)
+
+/* We use the 12-bit shifted immediate arithmetic instructions so values
@ -279,11 +279,11 @@ index 91299901bbf..17082486ac8 100644 @@ -279,11 +279,11 @@ index 91299901bbf..17082486ac8 100644
+ UNSPECV_PROBE_STACK_RANGE ; Represent stack range probing.
UNSPEC_VSTRUCTDUMMY
])

@@ -3399,6 +3400,18 @@
[(set_attr "length" "0")]
)

+(define_insn "probe_stack_range"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "0")

74
SOURCES/gcc48-rh1469697-15.patch

@ -9,10 +9,10 @@ Date: Tue Jan 13 14:11:15 2015 +0000 @@ -9,10 +9,10 @@ Date: Tue Jan 13 14:11:15 2015 +0000
(*sub_<optab><SHORT:mode>_shft_si_uxtw, *sub_<optab><mode>_multp2)
(*sub_<optab>si_multp2_uxtw, *sub_uxt<mode>_multp2)
(*sub_uxtsi_multp2_uxtw): Add stack pointer sources.

gcc/testsuite/
* gcc.target/aarch64/subsp.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219533 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
@ -20,7 +20,7 @@ index 17082486ac8..a085c6acaf5 100644 @@ -20,7 +20,7 @@ index 17082486ac8..a085c6acaf5 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -1610,8 +1610,8 @@

(define_insn "subsi3"
[(set (match_operand:SI 0 "register_operand" "=rk")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
@ -33,93 +33,93 @@ index 17082486ac8..a085c6acaf5 100644 @@ -33,93 +33,93 @@ index 17082486ac8..a085c6acaf5 100644
@@ -1622,7 +1622,7 @@
(define_insn "*subsi3_uxtw"
[(set (match_operand:DI 0 "register_operand" "=rk")
(zero_extend:DI
(zero_extend:DI
- (minus:SI (match_operand:SI 1 "register_operand" "r")
+ (minus:SI (match_operand:SI 1 "register_operand" "rk")
(match_operand:SI 2 "register_operand" "r"))))]
(match_operand:SI 2 "register_operand" "r"))))]
""
"sub\\t%w0, %w1, %w2"
@@ -1632,7 +1632,7 @@

(define_insn "subdi3"
[(set (match_operand:DI 0 "register_operand" "=rk,!w")
- (minus:DI (match_operand:DI 1 "register_operand" "r,!w")
+ (minus:DI (match_operand:DI 1 "register_operand" "rk,!w")
(match_operand:DI 2 "register_operand" "r,!w")))]
(match_operand:DI 2 "register_operand" "r,!w")))]
""
"@
@@ -1725,7 +1725,7 @@

(define_insn "*sub_<optab><ALLX:mode>_<GPI:mode>"
[(set (match_operand:GPI 0 "register_operand" "=rk")
- (minus:GPI (match_operand:GPI 1 "register_operand" "r")
+ (minus:GPI (match_operand:GPI 1 "register_operand" "rk")
(ANY_EXTEND:GPI
(match_operand:ALLX 2 "register_operand" "r"))))]
(ANY_EXTEND:GPI
(match_operand:ALLX 2 "register_operand" "r"))))]
""
@@ -1738,7 +1738,7 @@
(define_insn "*sub_<optab><SHORT:mode>_si_uxtw"
[(set (match_operand:DI 0 "register_operand" "=rk")
(zero_extend:DI
(zero_extend:DI
- (minus:SI (match_operand:SI 1 "register_operand" "r")
+ (minus:SI (match_operand:SI 1 "register_operand" "rk")
(ANY_EXTEND:SI
(match_operand:SHORT 2 "register_operand" "r")))))]
(ANY_EXTEND:SI
(match_operand:SHORT 2 "register_operand" "r")))))]
""
@@ -1749,7 +1749,7 @@

(define_insn "*sub_<optab><ALLX:mode>_shft_<GPI:mode>"
[(set (match_operand:GPI 0 "register_operand" "=rk")
- (minus:GPI (match_operand:GPI 1 "register_operand" "r")
+ (minus:GPI (match_operand:GPI 1 "register_operand" "rk")
(ashift:GPI (ANY_EXTEND:GPI
(match_operand:ALLX 2 "register_operand" "r"))
(match_operand 3 "aarch64_imm3" "Ui3"))))]
(ashift:GPI (ANY_EXTEND:GPI
(match_operand:ALLX 2 "register_operand" "r"))
(match_operand 3 "aarch64_imm3" "Ui3"))))]
@@ -1763,7 +1763,7 @@
(define_insn "*sub_<optab><SHORT:mode>_shft_si_uxtw"
[(set (match_operand:DI 0 "register_operand" "=rk")
(zero_extend:DI
(zero_extend:DI
- (minus:SI (match_operand:SI 1 "register_operand" "r")
+ (minus:SI (match_operand:SI 1 "register_operand" "rk")
(ashift:SI (ANY_EXTEND:SI
(match_operand:SHORT 2 "register_operand" "r"))
(match_operand 3 "aarch64_imm3" "Ui3")))))]
(ashift:SI (ANY_EXTEND:SI
(match_operand:SHORT 2 "register_operand" "r"))
(match_operand 3 "aarch64_imm3" "Ui3")))))]
@@ -1775,7 +1775,7 @@

(define_insn "*sub_<optab><mode>_multp2"
[(set (match_operand:GPI 0 "register_operand" "=rk")
- (minus:GPI (match_operand:GPI 4 "register_operand" "r")
+ (minus:GPI (match_operand:GPI 4 "register_operand" "rk")
(ANY_EXTRACT:GPI
(mult:GPI (match_operand:GPI 1 "register_operand" "r")
(match_operand 2 "aarch64_pwr_imm3" "Up3"))
(ANY_EXTRACT:GPI
(mult:GPI (match_operand:GPI 1 "register_operand" "r")
(match_operand 2 "aarch64_pwr_imm3" "Up3"))
@@ -1791,7 +1791,7 @@
(define_insn "*sub_<optab>si_multp2_uxtw"
[(set (match_operand:DI 0 "register_operand" "=rk")
(zero_extend:DI
(zero_extend:DI
- (minus:SI (match_operand:SI 4 "register_operand" "r")
+ (minus:SI (match_operand:SI 4 "register_operand" "rk")
(ANY_EXTRACT:SI
(mult:SI (match_operand:SI 1 "register_operand" "r")
(match_operand 2 "aarch64_pwr_imm3" "Up3"))
(ANY_EXTRACT:SI
(mult:SI (match_operand:SI 1 "register_operand" "r")
(match_operand 2 "aarch64_pwr_imm3" "Up3"))
@@ -1805,7 +1805,7 @@

(define_insn "*sub_uxt<mode>_multp2"
[(set (match_operand:GPI 0 "register_operand" "=rk")
- (minus:GPI (match_operand:GPI 4 "register_operand" "r")
+ (minus:GPI (match_operand:GPI 4 "register_operand" "rk")
(and:GPI
(mult:GPI (match_operand:GPI 1 "register_operand" "r")
(match_operand 2 "aarch64_pwr_imm3" "Up3"))
(and:GPI
(mult:GPI (match_operand:GPI 1 "register_operand" "r")
(match_operand 2 "aarch64_pwr_imm3" "Up3"))
@@ -1823,7 +1823,7 @@
(define_insn "*sub_uxtsi_multp2_uxtw"
[(set (match_operand:DI 0 "register_operand" "=rk")
(zero_extend:DI
(zero_extend:DI
- (minus:SI (match_operand:SI 4 "register_operand" "r")
+ (minus:SI (match_operand:SI 4 "register_operand" "rk")
(and:SI
(mult:SI (match_operand:SI 1 "register_operand" "r")
(match_operand 2 "aarch64_pwr_imm3" "Up3"))
(and:SI
(mult:SI (match_operand:SI 1 "register_operand" "r")
(match_operand 2 "aarch64_pwr_imm3" "Up3"))
diff --git a/gcc/testsuite/gcc.target/aarch64/subsp.c b/gcc/testsuite/gcc.target/aarch64/subsp.c
new file mode 100644
index 00000000000..70d848c59d1

68
SOURCES/gcc48-rh1469697-16.patch

@ -18,12 +18,12 @@ index cadf193cfcf..e08632ffa88 100644 @@ -18,12 +18,12 @@ index cadf193cfcf..e08632ffa88 100644
#include "dwarf2.h"
+#include "params.h"
+#include "dumpfile.h"

/* Classifies an address.

@@ -1696,7 +1698,14 @@ aarch64_output_probe_stack_range (rtx reg1, rtx reg2)
output_asm_insn ("sub\t%0, %0, %1", xops);

/* Probe at TEST_ADDR. */
- output_asm_insn ("str\txzr, [%0]", xops);
+ if (flag_stack_clash_protection)
@ -34,13 +34,13 @@ index cadf193cfcf..e08632ffa88 100644 @@ -34,13 +34,13 @@ index cadf193cfcf..e08632ffa88 100644
+ }
+ else
+ output_asm_insn ("str\txzr, [%0]", xops);

/* Test if TEST_ADDR == LAST_ADDR. */
xops[1] = reg2;
@@ -2001,6 +2010,123 @@ aarch64_save_or_restore_callee_save_registers (HOST_WIDE_INT offset,
base_rtx, cfi_ops);
base_rtx, cfi_ops);
}

+/* Allocate SIZE bytes of stack space using SCRATCH_REG as a scratch
+ register. */
+
@ -159,12 +159,12 @@ index cadf193cfcf..e08632ffa88 100644 @@ -159,12 +159,12 @@ index cadf193cfcf..e08632ffa88 100644
+}
+
/* AArch64 stack frames generated by this compiler look like:

+-------------------------------+
+-------------------------------+
@@ -2073,6 +2199,44 @@ aarch64_expand_prologue (void)
- original_frame_size
- cfun->machine->frame.saved_regs_size);

- original_frame_size
- cfun->machine->frame.saved_regs_size);
+ /* We do not fully protect aarch64 against stack clash style attacks
+ as doing so would be prohibitively expensive with less utility over
+ time as newer compilers are deployed.
@ -209,19 +209,19 @@ index cadf193cfcf..e08632ffa88 100644 @@ -209,19 +209,19 @@ index cadf193cfcf..e08632ffa88 100644
@@ -2089,7 +2253,10 @@ aarch64_expand_prologue (void)
frame_size -= (offset + crtl->outgoing_args_size);
fp_offset = 0;

- if (frame_size >= 0x1000000)
+ if (flag_stack_clash_protection
+ && frame_size >= guard_size - guard_used_by_caller)
+ aarch64_allocate_and_probe_stack_space (IP0_REGNUM, frame_size);
+ else if (frame_size >= 0x1000000)
{
rtx op0 = gen_rtx_REG (Pmode, IP0_REGNUM);
emit_move_insn (op0, GEN_INT (-frame_size));
{
rtx op0 = gen_rtx_REG (Pmode, IP0_REGNUM);
emit_move_insn (op0, GEN_INT (-frame_size));
@@ -2206,10 +2373,30 @@ aarch64_expand_prologue (void)
{
if (crtl->outgoing_args_size > 0)
{
{
- insn = emit_insn (gen_add2_insn
- (stack_pointer_rtx,
- GEN_INT (- crtl->outgoing_args_size)));
@ -250,13 +250,13 @@ index cadf193cfcf..e08632ffa88 100644 @@ -250,13 +250,13 @@ index cadf193cfcf..e08632ffa88 100644
+ }
+ else
+ aarch64_sub_sp (IP1_REGNUM, final_adjust, !frame_pointer_needed);
}
}
}
}
@@ -5088,6 +5275,12 @@ aarch64_override_options (void)
#endif
}

+ /* We assume the guard page is 64k. */
+ maybe_set_param_value (PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE,
+ 16,
@ -265,11 +265,11 @@ index cadf193cfcf..e08632ffa88 100644 @@ -265,11 +265,11 @@ index cadf193cfcf..e08632ffa88 100644
+
aarch64_override_options_after_change ();
}

@@ -8161,6 +8354,28 @@ aarch64_vectorize_vec_perm_const_ok (enum machine_mode vmode,
return ret;
}

+/* It has been decided that to allow up to 1kb of outgoing argument
+ space to be allocated w/o probing. If more than 1kb of outgoing
+ argment space is allocated, then it must be probed and the last
@ -294,17 +294,17 @@ index cadf193cfcf..e08632ffa88 100644 @@ -294,17 +294,17 @@ index cadf193cfcf..e08632ffa88 100644
+
#undef TARGET_ADDRESS_COST
#define TARGET_ADDRESS_COST aarch64_address_cost

@@ -8378,6 +8593,10 @@ aarch64_vectorize_vec_perm_const_ok (enum machine_mode vmode,
#undef TARGET_FIXED_CONDITION_CODE_REGS
#define TARGET_FIXED_CONDITION_CODE_REGS aarch64_fixed_condition_code_regs

+#undef TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE
+#define TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE \
+ aarch64_stack_clash_protection_final_dynamic_probe
+
struct gcc_target targetm = TARGET_INITIALIZER;

#include "gt-aarch64.h"
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index a085c6acaf5..5485a5f70b1 100644
@ -312,13 +312,13 @@ index a085c6acaf5..5485a5f70b1 100644 @@ -312,13 +312,13 @@ index a085c6acaf5..5485a5f70b1 100644
+++ b/gcc/config/aarch64/aarch64.md
@@ -3401,7 +3401,7 @@
)

(define_insn "probe_stack_range"
- [(set (match_operand:DI 0 "register_operand" "=r")
+ [(set (match_operand:DI 0 "register_operand" "=rk")
(unspec_volatile:DI [(match_operand:DI 1 "register_operand" "0")
(match_operand:DI 2 "register_operand" "r")]
UNSPECV_PROBE_STACK_RANGE))]
(unspec_volatile:DI [(match_operand:DI 1 "register_operand" "0")
(match_operand:DI 2 "register_operand" "r")]
UNSPECV_PROBE_STACK_RANGE))]
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-12.c b/gcc/testsuite/gcc.target/aarch64/stack-check-12.c
new file mode 100644
index 00000000000..2ce38483b6b
@ -402,7 +402,7 @@ index 00000000000..59ffe01376d @@ -402,7 +402,7 @@ index 00000000000..59ffe01376d
+/* This test has a constant sized alloca that is smaller than the
+ probe interval. But it actually requires two probes instead
+ of one because of the optimistic assumptions we made in the
+ aarch64 prologue code WRT probing state.
+ aarch64 prologue code WRT probing state.
+
+ The form can change quite a bit so we just check for two
+ probes without looking at the actual address. */
@ -432,7 +432,7 @@ index 00000000000..e06db6dc2f0 @@ -432,7 +432,7 @@ index 00000000000..e06db6dc2f0
+
+/* This test has a variable sized alloca. It requires 3 probes.
+ One in the loop, one for the residual and at the end of the
+ alloca area.
+ alloca area.
+
+ The form can change quite a bit so we just check for two
+ probes without looking at the actual address. */
@ -445,18 +445,18 @@ index aba99513ed0..a8451c98b08 100644 @@ -445,18 +445,18 @@ index aba99513ed0..a8451c98b08 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5420,14 +5420,9 @@ proc check_effective_target_autoincdec { } {
#
#
proc check_effective_target_supports_stack_clash_protection { } {

- # Temporary until the target bits are fully ACK'd.
-# if { [istarget aarch*-*-*] } {
-# return 1
-# }
-
if { [istarget x86_64-*-*] || [istarget i?86-*-*]
|| [istarget powerpc*-*-*] || [istarget rs6000*-*-*]
if { [istarget x86_64-*-*] || [istarget i?86-*-*]
|| [istarget powerpc*-*-*] || [istarget rs6000*-*-*]
- || [istarget s390*-*-*] } {
+ || [istarget aarch64*-**] || [istarget s390*-*-*] } {
return 1
return 1
}
return 0

8
SOURCES/gcc48-rh1469697-17.patch

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
* config/i386/i386.c (ix86_emit_restore_reg_using_pop): Prototype.
(ix86_adjust_stack_and_probe_stack_clash): Use a push/pop sequence
to probe at the start of a noreturn function.

* gcc.target/i386/stack-check-12.c: New test

diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
@ -10,10 +10,10 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -10,10 +10,10 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c 2017-11-03 13:37:39.489361692 -0600
@@ -64,6 +64,7 @@ along with GCC; see the file COPYING3.
#include "tree-flow.h"

static rtx legitimize_dllimport_symbol (rtx, bool);
+static void ix86_emit_restore_reg_using_pop (rtx);

#ifndef CHECK_STACK_LIMIT
#define CHECK_STACK_LIMIT (-1)
@@ -9884,8 +9885,14 @@ ix86_adjust_stack_and_probe_stack_clash
@ -32,7 +32,7 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -32,7 +32,7 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+ ix86_emit_restore_reg_using_pop (dummy_reg);
emit_insn (gen_blockage ());
}

diff -Nrup a/gcc/testsuite/gcc.target/i386/stack-check-12.c b/gcc/testsuite/gcc.target/i386/stack-check-12.c
--- a/gcc/testsuite/gcc.target/i386/stack-check-12.c 1969-12-31 17:00:00.000000000 -0700
+++ b/gcc/testsuite/gcc.target/i386/stack-check-12.c 2017-11-03 13:36:15.104055651 -0600

104
SOURCES/gcc48-rh1469697-18.patch

@ -15,7 +15,7 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -15,7 +15,7 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
@@ -9839,7 +9839,17 @@ release_scratch_register_on_entry (struc
}
}

-#define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)
+/* Return the probing interval for -fstack-clash-protection. */
+
@ -28,9 +28,9 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -28,9 +28,9 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+ else
+ return (HOST_WIDE_INT_1U << STACK_CHECK_PROBE_INTERVAL_EXP);
+}

/* Emit code to adjust the stack pointer by SIZE bytes while probing it.

@@ -9911,8 +9921,7 @@ ix86_adjust_stack_and_probe_stack_clash
/* We're allocating a large enough stack frame that we need to
emit probes. Either emit them inline or in a loop depending
@ -42,14 +42,14 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -42,14 +42,14 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
{
HOST_WIDE_INT i;
@@ -9921,7 +9930,7 @@ ix86_adjust_stack_and_probe_stack_clash
/* Allocate PROBE_INTERVAL bytes. */
rtx insn
= pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
/* Allocate PROBE_INTERVAL bytes. */
rtx insn
= pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
- GEN_INT (-PROBE_INTERVAL), -1,
+ GEN_INT (-probe_interval), -1,
m->fs.cfa_reg == stack_pointer_rtx);
add_reg_note (insn, REG_STACK_CHECK, const0_rtx);

m->fs.cfa_reg == stack_pointer_rtx);
add_reg_note (insn, REG_STACK_CHECK, const0_rtx);
@@ -10014,7 +10023,7 @@ ix86_adjust_stack_and_probe (const HOST_
that's the easy case. The run-time loop is made up of 11 insns in the
generic case while the compile-time loop is made up of 3+2*(n-1) insns
@ -60,91 +60,91 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -60,91 +60,91 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
HOST_WIDE_INT i, adjust;
bool first_probe = true;
@@ -10023,15 +10032,15 @@ ix86_adjust_stack_and_probe (const HOST_
values of N from 1 until it exceeds SIZE. If only one probe is
needed, this will not generate any code. Then adjust and probe
to PROBE_INTERVAL + SIZE. */
values of N from 1 until it exceeds SIZE. If only one probe is
needed, this will not generate any code. Then adjust and probe
to PROBE_INTERVAL + SIZE. */
- for (i = PROBE_INTERVAL; i < size; i += PROBE_INTERVAL)
+ for (i = get_probe_interval (); i < size; i += get_probe_interval ())
{
if (first_probe)
{
{
if (first_probe)
{
- adjust = 2 * PROBE_INTERVAL + dope;
+ adjust = 2 * get_probe_interval () + dope;
first_probe = false;
}
else
first_probe = false;
}
else
- adjust = PROBE_INTERVAL;
+ adjust = get_probe_interval ();

emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
@@ -10040,9 +10049,9 @@ ix86_adjust_stack_and_probe (const HOST_
}

}
if (first_probe)
- adjust = size + PROBE_INTERVAL + dope;
+ adjust = size + get_probe_interval () + dope;
else
- adjust = size + PROBE_INTERVAL - i;
+ adjust = size + get_probe_interval () - i;

emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
@@ -10052,7 +10061,8 @@ ix86_adjust_stack_and_probe (const HOST_
/* Adjust back to account for the additional first interval. */
last = emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
- PROBE_INTERVAL + dope)));
+ (get_probe_interval ()
+ + dope))));
}

/* Otherwise, do the same as above, but in a loop. Note that we must be
@@ -10070,7 +10080,7 @@ ix86_adjust_stack_and_probe (const HOST_

/* Step 1: round SIZE to the previous multiple of the interval. */

- rounded_size = size & -PROBE_INTERVAL;
+ rounded_size = size & get_probe_interval ();


/* Step 2: compute initial and final value of the loop counter. */
@@ -10078,7 +10088,7 @@ ix86_adjust_stack_and_probe (const HOST_
/* SP = SP_0 + PROBE_INTERVAL. */
emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
- - (PROBE_INTERVAL + dope))));
+ - (get_probe_interval () + dope))));

/* LAST_ADDR = SP_0 + PROBE_INTERVAL + ROUNDED_SIZE. */
emit_move_insn (sr.reg, GEN_INT (-rounded_size));
@@ -10115,7 +10125,8 @@ ix86_adjust_stack_and_probe (const HOST_
/* Adjust back to account for the additional first interval. */
last = emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
- PROBE_INTERVAL + dope)));
+ (get_probe_interval ()
+ + dope))));

release_scratch_register_on_entry (&sr);
}
@@ -10134,7 +10145,7 @@ ix86_adjust_stack_and_probe (const HOST_
XVECEXP (expr, 0, 1)
= gen_rtx_SET (VOIDmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
= gen_rtx_SET (VOIDmode, stack_pointer_rtx,
plus_constant (Pmode, stack_pointer_rtx,
- PROBE_INTERVAL + dope + size));
+ get_probe_interval () + dope + size));
add_reg_note (last, REG_FRAME_RELATED_EXPR, expr);
RTX_FRAME_RELATED_P (last) = 1;

@@ -10168,7 +10179,7 @@ output_adjust_stack_and_probe (rtx reg)
fputc ('\n', asm_out_file);

/* SP = SP + PROBE_INTERVAL. */
- xops[1] = GEN_INT (PROBE_INTERVAL);
+ xops[1] = GEN_INT (get_probe_interval ());
output_asm_insn ("sub%z0\t{%1, %0|%0, %1}", xops);

/* Probe at SP. */
@@ -10194,14 +10205,14 @@ ix86_emit_probe_stack_range (HOST_WIDE_I
that's the easy case. The run-time loop is made up of 7 insns in the
@ -154,32 +154,32 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -154,32 +154,32 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+ if (size <= 7 * get_probe_interval ())
{
HOST_WIDE_INT i;

/* Probe at FIRST + N * PROBE_INTERVAL for values of N from 1 until
it exceeds SIZE. If only one probe is needed, this will not
generate any code. Then probe at FIRST + SIZE. */
it exceeds SIZE. If only one probe is needed, this will not
generate any code. Then probe at FIRST + SIZE. */
- for (i = PROBE_INTERVAL; i < size; i += PROBE_INTERVAL)
+ for (i = get_probe_interval (); i < size; i += get_probe_interval ())
emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx,
-(first + i)));

emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx,
-(first + i)));
@@ -10224,7 +10235,7 @@ ix86_emit_probe_stack_range (HOST_WIDE_I

/* Step 1: round SIZE to the previous multiple of the interval. */

- rounded_size = size & -PROBE_INTERVAL;
+ rounded_size = size & -get_probe_interval ();


/* Step 2: compute initial and final value of the loop counter. */
@@ -10291,7 +10302,7 @@ output_probe_stack_range (rtx reg, rtx e
fputc ('\n', asm_out_file);

/* TEST_ADDR = TEST_ADDR + PROBE_INTERVAL. */
- xops[1] = GEN_INT (PROBE_INTERVAL);
+ xops[1] = GEN_INT (get_probe_interval ());
output_asm_insn ("sub%z0\t{%1, %0|%0, %1}", xops);

/* Probe at TEST_ADDR. */
diff -Nrup a/gcc/testsuite/gcc.dg/pr82788.c b/gcc/testsuite/gcc.dg/pr82788.c
--- a/gcc/testsuite/gcc.dg/pr82788.c 1969-12-31 17:00:00.000000000 -0700

30
SOURCES/gcc48-rh1469697-19.patch

@ -9,28 +9,28 @@ diff -Nrup a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md @@ -9,28 +9,28 @@ diff -Nrup a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
--- a/gcc/config/rs6000/rs6000.md 2017-11-06 09:12:21.128237467 -0700
+++ b/gcc/config/rs6000/rs6000.md 2017-11-06 09:13:40.521601373 -0700
@@ -11886,6 +11886,9 @@
{
rtx loop_lab, end_loop;
bool rotated = CONST_INT_P (rounded_size);
{
rtx loop_lab, end_loop;
bool rotated = CONST_INT_P (rounded_size);
+ rtx update = GEN_INT (-probe_interval);
+ if (probe_interval > 32768)
+ update = force_reg (Pmode, update);

emit_stack_clash_protection_probe_loop_start (&loop_lab, &end_loop,
last_addr, rotated);
emit_stack_clash_protection_probe_loop_start (&loop_lab, &end_loop,
last_addr, rotated);
@@ -11893,13 +11896,11 @@
if (Pmode == SImode)
emit_insn (gen_movsi_update_stack (stack_pointer_rtx,
stack_pointer_rtx,
if (Pmode == SImode)
emit_insn (gen_movsi_update_stack (stack_pointer_rtx,
stack_pointer_rtx,
- GEN_INT (-probe_interval),
- chain));
+ update, chain));
else
emit_insn (gen_movdi_di_update_stack (stack_pointer_rtx,
stack_pointer_rtx,
else
emit_insn (gen_movdi_di_update_stack (stack_pointer_rtx,
stack_pointer_rtx,
- GEN_INT (-probe_interval),
- chain));
+ update, chain));
emit_stack_clash_protection_probe_loop_end (loop_lab, end_loop,
last_addr, rotated);
}
emit_stack_clash_protection_probe_loop_end (loop_lab, end_loop,
last_addr, rotated);
}

36
SOURCES/gcc48-rh1469697-2.patch

@ -14,13 +14,13 @@ Date: Wed Sep 20 04:56:54 2017 +0000 @@ -14,13 +14,13 @@ Date: Wed Sep 20 04:56:54 2017 +0000
Note that -fstack-check is primarily for Ada and refer users
to -fstack-clash-protection for stack-clash-protection.
Document new params for stack clash protection.

* gcc.dg/stack-check-2.c: New test.
* lib/target-supports.exp
(check_effective_target_supports_stack_clash_protection): New function.
(check_effective_target_frame_pointer_for_non_leaf): Likewise.
(check_effective_target_caller_implicit_probes): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252994 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/common.opt b/gcc/common.opt
@ -29,17 +29,17 @@ index 16846c13b62..0c335cb12cd 100644 @@ -29,17 +29,17 @@ index 16846c13b62..0c335cb12cd 100644
+++ b/gcc/common.opt
@@ -1911,13 +1911,18 @@ Common Report Var(flag_variable_expansion_in_unroller) Optimization
Apply variable expansion when loops are unrolled

fstack-check=
-Common Report RejectNegative Joined
--fstack-check=[no|generic|specific] Insert stack checking code into the program
+Common Report RejectNegative Joined Optimization
+-fstack-check=[no|generic|specific] Insert stack checking code into the program.

fstack-check
Common Alias(fstack-check=, specific, no)
Insert stack checking code into the program. Same as -fstack-check=specific

+fstack-clash-protection
+Common Report Var(flag_stack_clash_protection) Optimization
+Insert code to probe each page of stack space as it is allocated to protect
@ -47,7 +47,7 @@ index 16846c13b62..0c335cb12cd 100644 @@ -47,7 +47,7 @@ index 16846c13b62..0c335cb12cd 100644
+
fstack-limit
Common Var(common_deferred_options) Defer

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f7a15ca190e..313a6c5ff76 100644
--- a/gcc/doc/invoke.texi
@ -55,7 +55,7 @@ index f7a15ca190e..313a6c5ff76 100644 @@ -55,7 +55,7 @@ index f7a15ca190e..313a6c5ff76 100644
@@ -9406,6 +9406,21 @@ compilation for profile feedback and one for compilation without. The value
for compilation with profile feedback needs to be more conservative (higher) in
order to make tracer effective.

+@item stack-clash-protection-guard-size
+Specify the size of the operating system provided stack guard as
+2 raised to @var{num} bytes. The default value is 12 (4096 bytes).
@ -72,7 +72,7 @@ index f7a15ca190e..313a6c5ff76 100644 @@ -72,7 +72,7 @@ index f7a15ca190e..313a6c5ff76 100644
+stack clash style attacks.
+
@item max-cse-path-length

The maximum number of basic blocks on path that CSE considers.
@@ -20949,7 +20964,8 @@ target support in the compiler but comes with the following drawbacks:
@enumerate
@ -81,13 +81,13 @@ index f7a15ca190e..313a6c5ff76 100644 @@ -81,13 +81,13 @@ index f7a15ca190e..313a6c5ff76 100644
-allocated dynamically if their size exceeds a fixed threshold.
+allocated dynamically if their size exceeds a fixed threshold. Note this
+may change the semantics of some code.

@item
Fixed limit on the size of the static frame of functions: when it is
@@ -20964,6 +20980,27 @@ generic implementation, code performance is hampered.
Note that old-style stack checking is also the fallback method for
@code{specific} if no target support has been added in the compiler.

+@samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
+and stack overflows. @samp{specific} is an excellent choice when compiling
+Ada code. It is not generally sufficient to protect against stack-clash
@ -119,7 +119,7 @@ index 4fc5d33348e..21e943d38fa 100644 @@ -119,7 +119,7 @@ index 4fc5d33348e..21e943d38fa 100644
@@ -139,7 +139,14 @@ enum excess_precision
EXCESS_PRECISION_STANDARD
};

-/* Type of stack check. */
+/* Type of stack check.
+
@ -137,9 +137,9 @@ index e51b847a7c4..e668624b0cb 100644 @@ -137,9 +137,9 @@ index e51b847a7c4..e668624b0cb 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -208,6 +208,16 @@ DEFPARAM(PARAM_STACK_FRAME_GROWTH,
"Maximal stack frame growth due to inlining (in percent)",
1000, 0, 0)

"Maximal stack frame growth due to inlining (in percent)",
1000, 0, 0)
+DEFPARAM(PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE,
+ "stack-clash-protection-guard-size",
+ "Size of the stack guard expressed as a power of two.",
@ -230,7 +230,7 @@ index ef371ad7efd..821cea9cb33 100644 @@ -230,7 +230,7 @@ index ef371ad7efd..821cea9cb33 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5392,3 +5392,95 @@ proc check_effective_target_fenv_exceptions {} {
}
}
} "-std=gnu99"]
}
+
@ -254,11 +254,11 @@ index ef371ad7efd..821cea9cb33 100644 @@ -254,11 +254,11 @@ index ef371ad7efd..821cea9cb33 100644
+#
+# This is used to restrict the stack-clash mitigation tests to
+# just those targets that have been explicitly supported.
+#
+#
+# In addition to the prologue work on those targets, each target's
+# properties should be described in the functions below so that
+# tests do not become a mess of unreadable target conditions.
+#
+#
+proc check_effective_target_supports_stack_clash_protection { } {
+
+ # Temporary until the target bits are fully ACK'd.
@ -332,7 +332,7 @@ index 26f2ffb362c..1def163f8b9 100644 @@ -332,7 +332,7 @@ index 26f2ffb362c..1def163f8b9 100644
@@ -1520,6 +1520,28 @@ process_options (void)
flag_associative_math = 0;
}

+#ifndef STACK_GROWS_DOWNWARD
+ /* -fstack-clash-protection is not currently supported on targets
+ where the stack grows up. */

14
SOURCES/gcc48-rh1469697-20.patch

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
* explow.c (anti_adjust_stack_and_probe_stack_clash): Avoid probing
the red zone for stack_clash_protection_final_dynamic_probe targets
when the total dynamic stack size is zero bytes.

diff -Nrup a/gcc/explow.c b/gcc/explow.c
--- a/gcc/explow.c 2017-11-14 23:33:15.403557607 -0700
+++ b/gcc/explow.c 2017-11-14 23:33:56.243239120 -0700
@ -18,20 +18,20 @@ diff -Nrup a/gcc/explow.c b/gcc/explow.c @@ -18,20 +18,20 @@ diff -Nrup a/gcc/explow.c b/gcc/explow.c
+ if SIZE is not a compile time constant. */
+
/* Ideally we would just probe at *sp. However, if SIZE is not
a compile-time constant, but is zero at runtime, then *sp
might hold live data. So probe at *sp if we know that
a compile-time constant, but is zero at runtime, then *sp
might hold live data. So probe at *sp if we know that
@@ -1946,9 +1953,12 @@ anti_adjust_stack_and_probe_stack_clash
}
}
else
{
{
- emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx,
- -GET_MODE_SIZE (word_mode)));
+ rtx label = gen_label_rtx ();
+ emit_cmp_and_jump_insns (size, CONST0_RTX (GET_MODE (size)),
+ EQ, NULL_RTX, Pmode, 1, label);
+ emit_stack_probe (stack_pointer_rtx);
emit_insn (gen_blockage ());
emit_insn (gen_blockage ());
+ emit_label (label);
}
}
}
}

24
SOURCES/gcc48-rh1469697-21.patch

@ -13,7 +13,7 @@ index b6c56602152..042e71904ec 100644 @@ -13,7 +13,7 @@ index b6c56602152..042e71904ec 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -1997,11 +1997,27 @@ anti_adjust_stack_and_probe_stack_clash (rtx size)

if (residual != CONST0_RTX (Pmode))
{
+ rtx label = NULL_RTX;
@ -31,22 +31,22 @@ index b6c56602152..042e71904ec 100644 @@ -31,22 +31,22 @@ index b6c56602152..042e71904ec 100644
+ }
+
rtx x = force_reg (Pmode, plus_constant (Pmode, residual,
-GET_MODE_SIZE (word_mode)));
-GET_MODE_SIZE (word_mode)));
anti_adjust_stack (residual);
emit_stack_probe (gen_rtx_PLUS (Pmode, stack_pointer_rtx, x));
emit_insn (gen_blockage ());
+ if (!CONST_INT_P (residual))
+ emit_label (label);
}

/* Some targets make optimistic assumptions in their prologues about
@@ -2014,28 +2030,20 @@ anti_adjust_stack_and_probe_stack_clash (rtx size)
live data. Furthermore, we don't want to probe into the red
zone.

live data. Furthermore, we don't want to probe into the red
zone.
- Go ahead and just guard a probe at *sp on SIZE != 0 at runtime
+ Go ahead and just guard the probe at *sp on SIZE != 0 at runtime
if SIZE is not a compile time constant. */
if SIZE is not a compile time constant. */
-
- /* Ideally we would just probe at *sp. However, if SIZE is not
- a compile-time constant, but is zero at runtime, then *sp
@ -61,15 +61,15 @@ index b6c56602152..042e71904ec 100644 @@ -61,15 +61,15 @@ index b6c56602152..042e71904ec 100644
- else
+ rtx label = NULL_RTX;
+ if (!CONST_INT_P (size))
{
{
- rtx label = gen_label_rtx ();
+ label = gen_label_rtx ();
emit_cmp_and_jump_insns (size, CONST0_RTX (GET_MODE (size)),
EQ, NULL_RTX, Pmode, 1, label);
emit_cmp_and_jump_insns (size, CONST0_RTX (GET_MODE (size)),
EQ, NULL_RTX, Pmode, 1, label);
- emit_stack_probe (stack_pointer_rtx);
- emit_insn (gen_blockage ());
- emit_label (label);
}
}
+
+ emit_stack_probe (stack_pointer_rtx);
+ emit_insn (gen_blockage ());
@ -77,7 +77,7 @@ index b6c56602152..042e71904ec 100644 @@ -77,7 +77,7 @@ index b6c56602152..042e71904ec 100644
+ emit_label (label);
}
}

diff --git a/gcc/testsuite/gcc.target/i386/stack-check-18.c b/gcc/testsuite/gcc.target/i386/stack-check-18.c
new file mode 100644
index 00000000000..6dbff4402da

22
SOURCES/gcc48-rh1469697-22.patch

@ -7,7 +7,7 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -7,7 +7,7 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
struct machine_function *m = cfun->machine;
+ struct ix86_frame frame;
+ ix86_compute_frame_layout (&frame);

/* If this function does not statically allocate stack space, then
no probes are needed. */
if (!size)
@ -16,12 +16,12 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -16,12 +16,12 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
- ix86_compute_frame_layout (&frame);
-
/* However, the allocation of space via pushes for register
saves could be viewed as allocating space, but without the
need to probe. */
saves could be viewed as allocating space, but without the
need to probe. */
@@ -9888,21 +9887,40 @@ ix86_adjust_stack_and_probe_stack_clash
pointer could be anywhere in the guard page. The safe thing
to do is emit a probe now.

+ The probe can be avoided if we have already emitted any callee
+ register saves into the stack or have a frame pointer (which will
+ have been saved as well). Those saves will function as implicit
@ -38,9 +38,9 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -38,9 +38,9 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+
{
/* We can safely use any register here since we're just going to push
its value and immediately pop it back. But we do try and avoid
argument passing registers so as not to introduce dependencies in
the pipeline. For 32 bit we use %esi and for 64 bit we use %rax. */
its value and immediately pop it back. But we do try and avoid
argument passing registers so as not to introduce dependencies in
the pipeline. For 32 bit we use %esi and for 64 bit we use %rax. */
rtx dummy_reg = gen_rtx_REG (word_mode, TARGET_64BIT ? AX_REG : SI_REG);
- rtx insn = emit_insn (gen_push (dummy_reg));
- RTX_FRAME_RELATED_P (insn) = 1;
@ -62,8 +62,8 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c @@ -62,8 +62,8 @@ diff -Nrup a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+ }
emit_insn (gen_blockage ());
}


diff -Nrup a/gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-12.c b/gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-12.c
--- gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-12.c 2018-01-03 15:42:40.849530670 -0700
+++ gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-12.c 2018-01-03 15:36:12.528488596 -0700
@ -74,7 +74,7 @@ diff -Nrup a/gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-12.c b @@ -74,7 +74,7 @@ diff -Nrup a/gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-12.c b
- asm volatile ("nop" ::: "edi");
exit (1);
}

diff -Nrup a/gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-17.c b/gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-17.c
--- gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-17.c 1969-12-31 17:00:00.000000000 -0700
+++ gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-17.c 2018-01-03 15:36:12.528488596 -0700
@ -91,7 +91,7 @@ diff -Nrup a/gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-17.c b @@ -91,7 +91,7 @@ diff -Nrup a/gcc-4.8.5-20150702/gcc/testsuite/gcc.target/i386/stack-check-17.c b
+__attribute__ ((noreturn))
+void
+f3 (void)
+{
+{
+ int y0 = x0;
+ int y1 = x1;
+ f1 ();

18
SOURCES/gcc48-rh1469697-23.patch

@ -5,19 +5,19 @@ index d2ef83b..dcd2930 100644 @@ -5,19 +5,19 @@ index d2ef83b..dcd2930 100644
@@ -29,9 +29,11 @@ f3 (void)
into either a stack slot or callee saved register. The former
would be rather dumb. So assume it does not happen.

- So search for two/four pushes for the callee register saves/argument
- pushes and no pops (since the function has no reachable epilogue). */
-/* { dg-final { scan-assembler-times "push\[ql\]" 2 { target { ! ia32 } } } } */
-/* { dg-final { scan-assembler-times "push\[ql\]" 4 { target { ia32 } } } } */
+ So search for two pushes for the callee register saves pushes
+ and no pops (since the function has no reachable epilogue).
+ and no pops (since the function has no reachable epilogue).
+
+ This is slightly different than upstream because the code we
+ generate for argument setup is slightly different. */
+/* { dg-final { scan-assembler-times "push\[ql\]" 2 } } */
/* { dg-final { scan-assembler-not "pop" } } */

diff --git a/gcc/testsuite/gcc.target/i386/stack-check-18.c b/gcc/testsuite/gcc.target/i386/stack-check-18.c
index 6dbff44..1638f77 100644
--- a/gcc/testsuite/gcc.target/i386/stack-check-18.c
@ -27,9 +27,9 @@ index 6dbff44..1638f77 100644 @@ -27,9 +27,9 @@ index 6dbff44..1638f77 100644
/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fdump-rtl-expand" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */

int f1 (char *);

diff --git a/gcc/testsuite/gcc.target/i386/stack-check-19.c b/gcc/testsuite/gcc.target/i386/stack-check-19.c
index b92c126..c341801 100644
--- a/gcc/testsuite/gcc.target/i386/stack-check-19.c
@ -39,12 +39,14 @@ index b92c126..c341801 100644 @@ -39,12 +39,14 @@ index b92c126..c341801 100644
/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fdump-rtl-expand" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */

int f1 (char *);

@@ -24,6 +25,6 @@ f2 (const int size)
in the probe loop and one that bypasses the residual probe.

These will all be equality tests. */
-/* { dg-final { scan-assembler-times "(\?:je|jne)" 3 } } */
+/* { dg-final { scan-assembler-times "(\?:jmp|je|jne)" 3 } } */

84
SOURCES/gcc48-rh1469697-3.patch

@ -3,7 +3,7 @@ Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4> @@ -3,7 +3,7 @@ Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed Sep 20 05:05:12 2017 +0000

2017-09-18 Jeff Law <law@redhat.com>

* explow.c: Include "params.h" and "dumpfile.h".
(anti_adjust_stack_and_probe_stack_clash): New function.
(get_stack_check_protect): Likewise.
@ -30,9 +30,9 @@ Date: Wed Sep 20 05:05:12 2017 +0000 @@ -30,9 +30,9 @@ Date: Wed Sep 20 05:05:12 2017 +0000
* config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise.
* config/sparc/sparc.c (sparc_expand_prologue): Likewise.
(sparc_flat_expand_prologue): Likewise.

* gcc.dg/stack-check-3.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252995 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
@ -40,12 +40,12 @@ index 2874b8454a9..5402f5213d6 100644 @@ -40,12 +40,12 @@ index 2874b8454a9..5402f5213d6 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -7625,7 +7625,7 @@ alpha_expand_prologue (void)

probed_size = frame_size;
if (flag_stack_check)
- probed_size += STACK_CHECK_PROTECT;
+ probed_size += get_stack_check_protect ();

if (probed_size <= 32768)
{
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
@ -53,45 +53,45 @@ index e36726ba722..d996fd160e8 100644 @@ -53,45 +53,45 @@ index e36726ba722..d996fd160e8 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -10544,12 +10544,12 @@ ix86_expand_prologue (void)
HOST_WIDE_INT size = allocate;

if (TARGET_64BIT && size >= (HOST_WIDE_INT) 0x80000000)
HOST_WIDE_INT size = allocate;
if (TARGET_64BIT && size >= (HOST_WIDE_INT) 0x80000000)
- size = 0x80000000 - STACK_CHECK_PROTECT - 1;
+ size = 0x80000000 - get_stack_check_protect () - 1;

if (TARGET_STACK_PROBE)
if (TARGET_STACK_PROBE)
- ix86_emit_probe_stack_range (0, size + STACK_CHECK_PROTECT);
+ ix86_emit_probe_stack_range (0, size + get_stack_check_protect ());
else
else
- ix86_emit_probe_stack_range (STACK_CHECK_PROTECT, size);
+ ix86_emit_probe_stack_range (get_stack_check_protect (), size);
}
}
}

diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 50bbad6661c..390983936e8 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -3435,7 +3435,7 @@ ia64_expand_prologue (void)
current_function_static_stack_size = current_frame_info.total_size;

if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK)
- ia64_emit_probe_stack_range (STACK_CHECK_PROTECT,
+ ia64_emit_probe_stack_range (get_stack_check_protect (),
current_frame_info.total_size,
current_frame_info.n_input_regs
+ current_frame_info.n_local_regs);
current_frame_info.total_size,
current_frame_info.n_input_regs
+ current_frame_info.n_local_regs);
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 41c5d6b6b1f..9b7eb678f19 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -10746,7 +10746,7 @@ mips_expand_prologue (void)
current_function_static_stack_size = size;

if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK && size)
- mips_emit_probe_stack_range (STACK_CHECK_PROTECT, size);
+ mips_emit_probe_stack_range (get_stack_check_protect (), size);

/* Save the registers. Allocate up to MIPS_MAX_FIRST_STACK_STEP
bytes beforehand; this is enough to cover the register save area
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
@ -100,12 +100,12 @@ index 15583055895..a9052c6becf 100644 @@ -100,12 +100,12 @@ index 15583055895..a9052c6becf 100644
+++ b/gcc/config/rs6000/rs6000.c
@@ -23214,7 +23214,8 @@ rs6000_emit_prologue (void)
current_function_static_stack_size = info->total_size;

if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK && info->total_size)
- rs6000_emit_probe_stack_range (STACK_CHECK_PROTECT, info->total_size);
+ rs6000_emit_probe_stack_range (get_stack_check_protect (),
+ info->total_size);

if (TARGET_FIX_AND_CONTINUE)
{
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
@ -114,20 +114,20 @@ index e5d326cdf23..e5e93c80261 100644 @@ -114,20 +114,20 @@ index e5d326cdf23..e5e93c80261 100644
+++ b/gcc/config/sparc/sparc.c
@@ -5431,7 +5431,7 @@ sparc_expand_prologue (void)
current_function_static_stack_size = size;

if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK && size)
- sparc_emit_probe_stack_range (STACK_CHECK_PROTECT, size);
+ sparc_emit_probe_stack_range (get_stack_check_protect (), size);

if (size == 0)
; /* do nothing. */
@@ -5533,7 +5533,7 @@ sparc_flat_expand_prologue (void)
current_function_static_stack_size = size;

if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK && size)
- sparc_emit_probe_stack_range (STACK_CHECK_PROTECT, size);
+ sparc_emit_probe_stack_range (get_stack_check_protect (), size);

if (sparc_save_local_in_regs_p)
emit_save_or_restore_local_in_regs (stack_pointer_rtx, SPARC_STACK_BIAS,
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
@ -137,7 +137,7 @@ index 6b18a2724bc..eeef757bf5b 100644 @@ -137,7 +137,7 @@ index 6b18a2724bc..eeef757bf5b 100644
@@ -3571,6 +3571,10 @@ GCC computed the default from the values of the above macros and you will
normally not need to override that default.
@end defmac

+@deftypefn {Target Hook} bool TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE (rtx @var{residual})
+Some targets make optimistic assumptions about the state of stack probing when they emit their prologues. On such targets a probe into the end of any dynamically allocated space is likely required for safety against stack clash style attacks. Define this variable to return nonzero if such a probe is required or zero otherwise. You need not define this macro if it would always have the value zero.
+@end deftypefn
@ -152,7 +152,7 @@ index 7d0b3c73b2f..6707ca87236 100644 @@ -152,7 +152,7 @@ index 7d0b3c73b2f..6707ca87236 100644
@@ -3539,6 +3539,8 @@ GCC computed the default from the values of the above macros and you will
normally not need to override that default.
@end defmac

+@hook TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE
+
@need 2000
@ -168,11 +168,11 @@ index 7da8bc75f19..2526e8513b7 100644 @@ -168,11 +168,11 @@ index 7da8bc75f19..2526e8513b7 100644
#include "output.h"
+#include "params.h"
+#include "dumpfile.h"

static rtx break_out_memory_refs (rtx);
+static void anti_adjust_stack_and_probe_stack_clash (rtx);


/* Truncate and perhaps sign-extend C as appropriate for MODE. */
@@ -1140,6 +1143,29 @@ update_nonlocal_goto_save_area (void)
emit_stack_save (SAVE_NONLOCAL, &r_save);
@ -203,29 +203,29 @@ index 7da8bc75f19..2526e8513b7 100644 @@ -203,29 +203,29 @@ index 7da8bc75f19..2526e8513b7 100644
+
/* Return an rtx representing the address of an area of memory dynamically
pushed on the stack.

@@ -1393,7 +1419,7 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align,
probe_stack_range (STACK_OLD_CHECK_PROTECT + STACK_CHECK_MAX_FRAME_SIZE,
size);
size);
else if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK)
- probe_stack_range (STACK_CHECK_PROTECT, size);
+ probe_stack_range (get_stack_check_protect (), size);

/* Don't let anti_adjust_stack emit notes. */
suppress_reg_args_size = true;
@@ -1451,6 +1477,8 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align,

if (flag_stack_check && STACK_CHECK_MOVING_SP)
anti_adjust_stack_and_probe (size, false);
anti_adjust_stack_and_probe (size, false);
+ else if (flag_stack_clash_protection)
+ anti_adjust_stack_and_probe_stack_clash (size);
else
anti_adjust_stack (size);

anti_adjust_stack (size);
@@ -1712,6 +1740,219 @@ probe_stack_range (HOST_WIDE_INT first, rtx size)
}
}

+/* Compute parameters for stack clash probing a dynamic stack
+ allocation of SIZE bytes.
+
@ -461,7 +461,7 @@ index 91f3387c701..ab8ec27418d 100644 @@ -461,7 +461,7 @@ index 91f3387c701..ab8ec27418d 100644
+extern void emit_stack_clash_protection_probe_loop_end (rtx, rtx,
+ rtx, bool);
+

/* In rtl.c */
extern rtx rtx_alloc_stat (RTX_CODE MEM_STAT_DECL);
diff --git a/gcc/target.def b/gcc/target.def
@ -471,7 +471,7 @@ index 4d6081c3121..eb2bd46f7a1 100644 @@ -471,7 +471,7 @@ index 4d6081c3121..eb2bd46f7a1 100644
@@ -2580,6 +2580,13 @@ DEFHOOK
void, (void),
hook_void_void)

+DEFHOOK
+(stack_clash_protection_final_dynamic_probe,
+ "Some targets make optimistic assumptions about the state of stack probing when they emit their prologues. On such targets a probe into the end of any dynamically allocated space is likely required for safety against stack clash style attacks. Define this variable to return nonzero if such a probe is required or zero otherwise. You need not define this macro if it would always have the value zero.",
@ -489,7 +489,7 @@ index f6aa9907225..be23875538d 100644 @@ -489,7 +489,7 @@ index f6aa9907225..be23875538d 100644
@@ -1557,4 +1557,10 @@ default_canonicalize_comparison (int *, rtx *, rtx *, bool)
{
}

+bool
+default_stack_clash_protection_final_dynamic_probe (rtx residual ATTRIBUTE_UNUSED)
+{
@ -503,7 +503,7 @@ index b64274d3ff9..4acf33fae08 100644 @@ -503,7 +503,7 @@ index b64274d3ff9..4acf33fae08 100644
+++ b/gcc/targhooks.h
@@ -195,3 +195,4 @@ extern const char *default_pch_valid_p (const void *, size_t);
extern void default_asm_output_ident_directive (const char*);

extern bool default_member_type_forces_blk (const_tree, enum machine_mode);
+extern bool default_stack_clash_protection_final_dynamic_probe (rtx);
diff --git a/gcc/testsuite/gcc.dg/stack-check-3.c b/gcc/testsuite/gcc.dg/stack-check-3.c

72
SOURCES/gcc48-rh1469697-4.patch

@ -10,7 +10,7 @@ Date: Wed Sep 20 05:21:09 2017 +0000 @@ -10,7 +10,7 @@ Date: Wed Sep 20 05:21:09 2017 +0000
* config/sparc/sparc.c (sparc_expand_prologue): Likewise.
(sparc_flat_expand_prologue): Likewise.
* config/spu/spu.c (spu_expand_prologue): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252996 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
@ -19,65 +19,65 @@ index 5402f5213d6..c46c843e462 100644 @@ -19,65 +19,65 @@ index 5402f5213d6..c46c843e462 100644
+++ b/gcc/config/alpha/alpha.c
@@ -7624,7 +7624,7 @@ alpha_expand_prologue (void)
Note that we are only allowed to adjust sp once in the prologue. */

probed_size = frame_size;
- if (flag_stack_check)
+ if (flag_stack_check || flag_stack_clash_protection)
probed_size += get_stack_check_protect ();

if (probed_size <= 32768)
@@ -7639,7 +7639,7 @@ alpha_expand_prologue (void)
/* We only have to do this probe if we aren't saving registers or
if we are probing beyond the frame because of -fstack-check. */
if ((sa_size == 0 && probed_size > probed - 4096)
/* We only have to do this probe if we aren't saving registers or
if we are probing beyond the frame because of -fstack-check. */
if ((sa_size == 0 && probed_size > probed - 4096)
- || flag_stack_check)
+ || flag_stack_check || flag_stack_clash_protection)
emit_insn (gen_probe_stack (GEN_INT (-probed_size)));
}

emit_insn (gen_probe_stack (GEN_INT (-probed_size)));
}
@@ -7669,7 +7669,8 @@ alpha_expand_prologue (void)
late in the compilation, generate the loop as a single insn. */
late in the compilation, generate the loop as a single insn. */
emit_insn (gen_prologue_stack_probe_loop (count, ptr));

- if ((leftover > 4096 && sa_size == 0) || flag_stack_check)
+ if ((leftover > 4096 && sa_size == 0)
+ || flag_stack_check || flag_stack_clash_protection)
{
rtx last = gen_rtx_MEM (DImode,
plus_constant (Pmode, ptr, -leftover));
{
rtx last = gen_rtx_MEM (DImode,
plus_constant (Pmode, ptr, -leftover));
@@ -7677,7 +7678,7 @@ alpha_expand_prologue (void)
emit_move_insn (last, const0_rtx);
}

emit_move_insn (last, const0_rtx);
}
- if (flag_stack_check)
+ if (flag_stack_check || flag_stack_clash_protection)
{
/* If -fstack-check is specified we have to load the entire
constant into a register and subtract from the sp in one go,
{
/* If -fstack-check is specified we have to load the entire
constant into a register and subtract from the sp in one go,
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 390983936e8..5bf7046cf15 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -2638,7 +2638,8 @@ ia64_compute_frame_size (HOST_WIDE_INT size)
mark_reg_gr_used_mask (cfun->machine->ia64_eh_epilogue_bsp, NULL);

/* Static stack checking uses r2 and r3. */
- if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK)
+ if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK
+ || flag_stack_clash_protection)
current_frame_info.gr_used_mask |= 0xc;

/* Find the size of the register stack frame. We have only 80 local
@@ -3434,7 +3435,8 @@ ia64_expand_prologue (void)
if (flag_stack_usage_info)
current_function_static_stack_size = current_frame_info.total_size;

- if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK)
+ if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK
+ || flag_stack_clash_protection)
ia64_emit_probe_stack_range (get_stack_check_protect (),
current_frame_info.total_size,
current_frame_info.n_input_regs
current_frame_info.total_size,
current_frame_info.n_input_regs
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 9b7eb678f19..da17f94b4f9 100644
--- a/gcc/config/mips/mips.c
@ -85,13 +85,13 @@ index 9b7eb678f19..da17f94b4f9 100644 @@ -85,13 +85,13 @@ index 9b7eb678f19..da17f94b4f9 100644
@@ -10745,7 +10745,9 @@ mips_expand_prologue (void)
if (flag_stack_usage_info)
current_function_static_stack_size = size;

- if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK && size)
+ if ((flag_stack_check == STATIC_BUILTIN_STACK_CHECK
+ || flag_stack_clash_protection)
+ && size)
mips_emit_probe_stack_range (get_stack_check_protect (), size);

/* Save the registers. Allocate up to MIPS_MAX_FIRST_STACK_STEP
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index e5e93c80261..617aa617208 100644
@ -100,42 +100,42 @@ index e5e93c80261..617aa617208 100644 @@ -100,42 +100,42 @@ index e5e93c80261..617aa617208 100644
@@ -5430,7 +5430,9 @@ sparc_expand_prologue (void)
if (flag_stack_usage_info)
current_function_static_stack_size = size;

- if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK && size)
+ if ((flag_stack_check == STATIC_BUILTIN_STACK_CHECK
+ || flag_stack_clash_protection)
+ && size)
sparc_emit_probe_stack_range (get_stack_check_protect (), size);

if (size == 0)
@@ -5532,7 +5534,9 @@ sparc_flat_expand_prologue (void)
if (flag_stack_usage_info)
current_function_static_stack_size = size;

- if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK && size)
+ if ((flag_stack_check == STATIC_BUILTIN_STACK_CHECK
+ || flag_stack_clash_protection)
+ && size)
sparc_emit_probe_stack_range (get_stack_check_protect (), size);

if (sparc_save_local_in_regs_p)
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 328bd5bd2ae..5541a3cd243 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -1761,7 +1761,7 @@ spu_expand_prologue (void)

if (total_size > 0)
{
- if (flag_stack_check)
+ if (flag_stack_check || flag_stack_clash_protection)
{
/* We compare against total_size-1 because
($sp >= total_size) <=> ($sp > total_size-1) */
{
/* We compare against total_size-1 because
($sp >= total_size) <=> ($sp > total_size-1) */
@@ -5366,7 +5366,7 @@ spu_allocate_stack (rtx op0, rtx op1)
emit_insn (gen_spu_convert (sp, stack_pointer_rtx));
emit_insn (gen_subv4si3 (sp, sp, splatted));

- if (flag_stack_check)
+ if (flag_stack_check || flag_stack_clash_protection)
{

7
SOURCES/gcc48-rh1469697-5.patch

@ -5,7 +5,7 @@ Date: Wed Sep 20 05:23:51 2017 +0000 @@ -5,7 +5,7 @@ Date: Wed Sep 20 05:23:51 2017 +0000
* function.c (dump_stack_clash_frame_info): New function.
* function.h (dump_stack_clash_frame_info): Prototype.
(enum stack_clash_probes): New enum.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252997 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/function.c b/gcc/function.c
@ -70,7 +70,7 @@ index 76baf307984..9b395aebcb3 100644 @@ -70,7 +70,7 @@ index 76baf307984..9b395aebcb3 100644
+
/* Add a list of INSNS to the hash HASHP, possibly allocating HASHP
for the first time. */

diff --git a/gcc/function.h b/gcc/function.h
index 89d71e592dd..ffea1e564ba 100644
--- a/gcc/function.h
@ -78,7 +78,7 @@ index 89d71e592dd..ffea1e564ba 100644 @@ -78,7 +78,7 @@ index 89d71e592dd..ffea1e564ba 100644
@@ -712,6 +712,16 @@ extern void instantiate_decl_rtl (rtx x);
and create duplicate blocks. */
extern void reorder_blocks (void);

+enum stack_clash_probes {
+ NO_PROBE_NO_FRAME,
+ NO_PROBE_SMALL_FRAME,
@ -91,3 +91,4 @@ index 89d71e592dd..ffea1e564ba 100644 @@ -91,3 +91,4 @@ index 89d71e592dd..ffea1e564ba 100644
+
/* Set BLOCK_NUMBER for all the blocks in FN. */
extern void number_blocks (tree);

37
SOURCES/gcc48-rh1469697-6.patch

@ -5,7 +5,7 @@ Date: Wed Sep 20 05:35:07 2017 +0000 @@ -5,7 +5,7 @@ Date: Wed Sep 20 05:35:07 2017 +0000
* config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): New.
(ix86_expand_prologue): Dump stack clash info as needed.
Call ix86_adjust_stack_and_probe_stack_clash as needed.

* gcc.dg/stack-check-4.c: New test.
* gcc.dg/stack-check-5.c: New test.
* gcc.dg/stack-check-6.c: New test.
@ -17,7 +17,7 @@ Date: Wed Sep 20 05:35:07 2017 +0000 @@ -17,7 +17,7 @@ Date: Wed Sep 20 05:35:07 2017 +0000
* lib/target-supports.exp
(check_effective_target_supports_stack_clash_protection): Enable for
x86 and x86_64 targets.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252998 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
@ -25,9 +25,9 @@ index d996fd160e8..a555b0774c0 100644 @@ -25,9 +25,9 @@ index d996fd160e8..a555b0774c0 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -9839,6 +9839,147 @@ release_scratch_register_on_entry (struct scratch_reg *sr)

#define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)

+/* Emit code to adjust the stack pointer by SIZE bytes while probing it.
+
+ This differs from the next routine in that it tries hard to prevent
@ -170,10 +170,10 @@ index d996fd160e8..a555b0774c0 100644 @@ -170,10 +170,10 @@ index d996fd160e8..a555b0774c0 100644
+}
+
/* Emit code to adjust the stack pointer by SIZE bytes while probing it. */

static void
@@ -10529,12 +10670,19 @@ ix86_expand_prologue (void)

/* The stack has already been decremented by the instruction calling us
so probe if the size is non-negative to preserve the protection area. */
- if (allocate >= 0 && flag_stack_check == STATIC_BUILTIN_STACK_CHECK)
@ -183,7 +183,7 @@ index d996fd160e8..a555b0774c0 100644 @@ -183,7 +183,7 @@ index d996fd160e8..a555b0774c0 100644
{
/* We expect the registers to be saved when probes are used. */
gcc_assert (int_registers_saved);

- if (STACK_CHECK_MOVING_SP)
+ if (flag_stack_clash_protection)
+ {
@ -191,9 +191,9 @@ index d996fd160e8..a555b0774c0 100644 @@ -191,9 +191,9 @@ index d996fd160e8..a555b0774c0 100644
+ allocate = 0;
+ }
+ else if (STACK_CHECK_MOVING_SP)
{
ix86_adjust_stack_and_probe (allocate);
allocate = 0;
{
ix86_adjust_stack_and_probe (allocate);
allocate = 0;
diff --git a/gcc/testsuite/gcc.dg/stack-check-10.c b/gcc/testsuite/gcc.dg/stack-check-10.c
new file mode 100644
index 00000000000..a86956ad692
@ -247,12 +247,12 @@ index 58fb65649ee..f0bf7c71a5b 100644 @@ -247,12 +247,12 @@ index 58fb65649ee..f0bf7c71a5b 100644
+++ b/gcc/testsuite/gcc.dg/stack-check-3.c
@@ -7,7 +7,7 @@
residual allocation + probe for f?. */

/* { dg-do compile } */
-/* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-expand -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=4096 --param stack-clash-protection-guard-size=4096" } */
+/* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-expand -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */
/* { dg-require-effective-target supports_stack_clash_protection } */

__attribute__((noinline, noclone)) void
diff --git a/gcc/testsuite/gcc.dg/stack-check-4.c b/gcc/testsuite/gcc.dg/stack-check-4.c
new file mode 100644
@ -321,7 +321,7 @@ index 00000000000..2171d9b6c23 @@ -321,7 +321,7 @@ index 00000000000..2171d9b6c23
+int
+f0 (int x, int y)
+{
+ asm volatile ("" : : : "memory");
+ asm volatile ("" : : : "memory");
+ return x + y;
+}
+
@ -330,7 +330,7 @@ index 00000000000..2171d9b6c23 @@ -330,7 +330,7 @@ index 00000000000..2171d9b6c23
+int
+f1 (int x, int y)
+{
+ asm volatile ("" : : : "memory");
+ asm volatile ("" : : : "memory");
+ bar ();
+}
+
@ -451,7 +451,7 @@ index 00000000000..6f8e7128921 @@ -451,7 +451,7 @@ index 00000000000..6f8e7128921
@@ -0,0 +1,17 @@
+/* The goal here is to verify that increasing the size of the guard allows
+ elimination of all probing on the relevant targets. */
+
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=16" } */
+/* { dg-require-effective-target supports_stack_clash_protection } */
@ -530,7 +530,7 @@ index 00000000000..0ccec8b532a @@ -530,7 +530,7 @@ index 00000000000..0ccec8b532a
+__attribute__((noinline, noclone)) int
+f0 (int x, int y)
+{
+ asm volatile ("" : : : "memory");
+ asm volatile ("" : : : "memory");
+ return x + y;
+}
+
@ -582,7 +582,7 @@ index 00000000000..0ccec8b532a @@ -582,7 +582,7 @@ index 00000000000..0ccec8b532a
+__attribute__((noinline, noclone)) int
+f6 (int x, int y, V a, V b, V c)
+{
+ asm volatile ("" : : : "memory");
+ asm volatile ("" : : : "memory");
+ v = a + b + c;
+ return x + y;
+}
@ -2687,7 +2687,7 @@ index 821cea9cb33..2c669a9822f 100644 @@ -2687,7 +2687,7 @@ index 821cea9cb33..2c669a9822f 100644
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5421,11 +5421,15 @@ proc check_effective_target_autoincdec { } {
proc check_effective_target_supports_stack_clash_protection { } {

# Temporary until the target bits are fully ACK'd.
-# if { [istarget aarch*-*-*] || [istarget x86_64-*-*]
-# || [istarget i?86-*-*] || [istarget s390*-*-*]
@ -2702,3 +2702,4 @@ index 821cea9cb33..2c669a9822f 100644 @@ -2702,3 +2702,4 @@ index 821cea9cb33..2c669a9822f 100644
+ }
return 0
}

30
SOURCES/gcc48-rh1469697-7.patch

@ -9,9 +9,9 @@ Date: Wed Sep 20 05:43:28 2017 +0000 @@ -9,9 +9,9 @@ Date: Wed Sep 20 05:43:28 2017 +0000
* config/i386/i386.c (pro_epilogue_adjust_stack): Return insn.
(ix86_adjust_satck_and_probe_stack_clash): Add REG_STACK_NOTEs.
* reg-notes.def (STACK_CHECK): New note.

* gcc.target/i386/stack-check-11.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252999 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
@ -19,14 +19,14 @@ index 0a4d8a51d1d..ee66c28ca35 100644 @@ -19,14 +19,14 @@ index 0a4d8a51d1d..ee66c28ca35 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -441,6 +441,8 @@ combine_stack_adjustments_for_block (basic_block bb)
continue;

continue;
set = single_set_for_csa (insn);
+ if (set && find_reg_note (insn, REG_STACK_CHECK, NULL_RTX))
+ set = NULL_RTX;
if (set)
{
rtx dest = SET_DEST (set);
{
rtx dest = SET_DEST (set);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a07104d304d..a9072f58f50 100644
--- a/gcc/config/i386/i386.c
@ -34,11 +34,11 @@ index a07104d304d..a9072f58f50 100644 @@ -34,11 +34,11 @@ index a07104d304d..a9072f58f50 100644
@@ -9502,7 +9502,7 @@ ix86_add_queued_cfa_restore_notes (rtx insn)
zero if %r11 register is live and cannot be freely used and positive
otherwise. */

-static void
+static rtx
pro_epilogue_adjust_stack (rtx dest, rtx src, rtx offset,
int style, bool set_cfa)
int style, bool set_cfa)
{
@@ -9589,6 +9589,7 @@ pro_epilogue_adjust_stack (rtx dest, rtx src, rtx offset,
m->fs.sp_offset = ooffset - INTVAL (offset);
@ -46,12 +46,12 @@ index a07104d304d..a9072f58f50 100644 @@ -46,12 +46,12 @@ index a07104d304d..a9072f58f50 100644
}
+ return insn;
}

/* Find an available register to be used as dynamic realign argument
@@ -9902,9 +9903,11 @@ ix86_adjust_stack_and_probe_stack_clash (const HOST_WIDE_INT size)
for (i = probe_interval; i <= size; i += probe_interval)
{
/* Allocate PROBE_INTERVAL bytes. */
{
/* Allocate PROBE_INTERVAL bytes. */
- pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
- GEN_INT (-probe_interval), -1,
- m->fs.cfa_reg == stack_pointer_rtx);
@ -60,9 +60,9 @@ index a07104d304d..a9072f58f50 100644 @@ -60,9 +60,9 @@ index a07104d304d..a9072f58f50 100644
+ GEN_INT (-PROBE_INTERVAL), -1,
+ m->fs.cfa_reg == stack_pointer_rtx);
+ add_reg_note (insn, REG_STACK_CHECK, const0_rtx);

/* And probe at *sp. */
emit_stack_probe (stack_pointer_rtx);
/* And probe at *sp. */
emit_stack_probe (stack_pointer_rtx);
diff --git a/gcc/reg-notes.def b/gcc/reg-notes.def
index db61c092aab..1d7a4356a85 100644
--- a/gcc/reg-notes.def
@ -82,7 +82,7 @@ index 4ac2542a3af..75780150e34 100644 @@ -82,7 +82,7 @@ index 4ac2542a3af..75780150e34 100644
@@ -4607,6 +4607,11 @@ parse_add_or_inc (struct mem_inc_info *mii, rtx insn, bool before_mem)
if (RTX_FRAME_RELATED_P (insn) || !pat)
return false;

+ /* Do not allow breaking data dependencies for insns that are marked
+ with REG_STACK_CHECK. */
+ if (find_reg_note (insn, REG_STACK_CHECK, NULL))

55
SOURCES/gcc48-rh1469697-8.patch

@ -7,10 +7,10 @@ Date: Wed Sep 20 21:59:50 2017 +0000 @@ -7,10 +7,10 @@ Date: Wed Sep 20 21:59:50 2017 +0000
CONST_INT_P before looking at INTVAL.
(anti_adjust_stack_and_probe_stack_clash): Use CONST_INT_P
instead of explicit test.

* gcc.target/i386/stack-check-11.c: Update test and regexp
so that it works for both i?86 and x86_64.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253034 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/explow.c b/gcc/explow.c
@ -19,46 +19,46 @@ index 2526e8513b7..d118e0d7782 100644 @@ -19,46 +19,46 @@ index 2526e8513b7..d118e0d7782 100644
+++ b/gcc/explow.c
@@ -1778,11 +1778,11 @@ compute_stack_clash_protection_loop_data (rtx *rounded_size, rtx *last_addr,
if (*rounded_size == CONST0_RTX (Pmode))
fprintf (dump_file,
"Stack clash skipped dynamic allocation and probing loop.\n");
fprintf (dump_file,
"Stack clash skipped dynamic allocation and probing loop.\n");
- else if (GET_CODE (*rounded_size) == CONST_INT
+ else if (CONST_INT_P (*rounded_size)
&& INTVAL (*rounded_size) <= 4 * *probe_interval)
fprintf (dump_file,
"Stack clash dynamic allocation and probing inline.\n");
&& INTVAL (*rounded_size) <= 4 * *probe_interval)
fprintf (dump_file,
"Stack clash dynamic allocation and probing inline.\n");
- else if (GET_CODE (*rounded_size) == CONST_INT)
+ else if (CONST_INT_P (*rounded_size))
fprintf (dump_file,
"Stack clash dynamic allocation and probing in "
"rotated loop.\n");
fprintf (dump_file,
"Stack clash dynamic allocation and probing in "
"rotated loop.\n");
@@ -1880,7 +1880,8 @@ anti_adjust_stack_and_probe_stack_clash (rtx size)

if (rounded_size != CONST0_RTX (Pmode))
{
- if (INTVAL (rounded_size) <= 4 * probe_interval)
+ if (CONST_INT_P (rounded_size)
+ && INTVAL (rounded_size) <= 4 * probe_interval)
{
for (HOST_WIDE_INT i = 0;
i < INTVAL (rounded_size);
{
for (HOST_WIDE_INT i = 0;
i < INTVAL (rounded_size);
@@ -1900,7 +1901,7 @@ anti_adjust_stack_and_probe_stack_clash (rtx size)
else
{
rtx loop_lab, end_loop;
{
rtx loop_lab, end_loop;
- bool rotate_loop = GET_CODE (rounded_size) == CONST_INT;
+ bool rotate_loop = CONST_INT_P (rounded_size);
emit_stack_clash_protection_probe_loop_start (&loop_lab, &end_loop,
last_addr, rotate_loop);

emit_stack_clash_protection_probe_loop_start (&loop_lab, &end_loop,
last_addr, rotate_loop);
@@ -1938,7 +1939,7 @@ anti_adjust_stack_and_probe_stack_clash (rtx size)
might hold live data. So probe at *sp if we know that
an allocation was made, otherwise probe into the red zone
which is obviously undesirable. */
might hold live data. So probe at *sp if we know that
an allocation was made, otherwise probe into the red zone
which is obviously undesirable. */
- if (GET_CODE (size) == CONST_INT)
+ if (CONST_INT_P (size))
{
emit_stack_probe (stack_pointer_rtx);
emit_insn (gen_blockage ());
{
emit_stack_probe (stack_pointer_rtx);
emit_insn (gen_blockage ());
diff --git a/gcc/testsuite/gcc.target/i386/stack-check-11.c b/gcc/testsuite/gcc.target/i386/stack-check-11.c
index 183103f01e5..fe5b2c2b844 100644
--- a/gcc/testsuite/gcc.target/i386/stack-check-11.c
@ -66,7 +66,7 @@ index 183103f01e5..fe5b2c2b844 100644 @@ -66,7 +66,7 @@ index 183103f01e5..fe5b2c2b844 100644
@@ -2,15 +2,17 @@
/* { dg-options "-O2 -fstack-clash-protection" } */
/* { dg-require-effective-target supports_stack_clash_protection } */

-extern void arf (unsigned long int *, unsigned long int *);
+#include <stdint.h>
+
@ -80,8 +80,9 @@ index 183103f01e5..fe5b2c2b844 100644 @@ -80,8 +80,9 @@ index 183103f01e5..fe5b2c2b844 100644
+ uint64_t den[859];
arf (den, num);
}

-/* { dg-final { scan-assembler-times "subq" 4 } } */
-/* { dg-final { scan-assembler-times "orq" 3 } } */
+/* { dg-final { scan-assembler-times "sub\[ql\]" 4 } } */
+/* { dg-final { scan-assembler-times "or\[ql\]" 3 } } */

94
SOURCES/gcc48-rh1469697-9.patch

@ -10,12 +10,12 @@ Date: Thu Sep 21 04:30:16 2017 +0000 @@ -10,12 +10,12 @@ Date: Thu Sep 21 04:30:16 2017 +0000
Dump actions when no stack is allocated.
(s390_prologue_plus_offset): New function.
(s390_emit_stack_probe): Likewise.

* gcc.dg/stack-check-5.c: Add argument for s390.
* lib/target-supports.exp:
(check_effective_target_supports_stack_clash_protection): Enable for
s390/s390x targets.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253049 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
@ -25,7 +25,7 @@ index 3c04781f947..45998bc7516 100644 @@ -25,7 +25,7 @@ index 3c04781f947..45998bc7516 100644
@@ -10350,6 +10350,184 @@ s390_emit_stack_tie (void)
emit_insn (gen_stack_tie (mem));
}

+/* Calculate TARGET = REG + OFFSET as s390_emit_prologue would do it.
+ - push too big immediates to the literal pool and annotate the refs
+ - emit frame related notes for stack pointer changes. */
@ -205,12 +205,12 @@ index 3c04781f947..45998bc7516 100644 @@ -205,12 +205,12 @@ index 3c04781f947..45998bc7516 100644
+
+
/* Expand the prologue into a bunch of separate insns. */

void
@@ -10391,6 +10569,19 @@ s390_emit_prologue (void)
else
temp_reg = gen_rtx_REG (Pmode, 1);

+ /* When probing for stack-clash mitigation, we have to track the distance
+ between the stack pointer and closest known reference.
+
@ -228,9 +228,9 @@ index 3c04781f947..45998bc7516 100644 @@ -228,9 +228,9 @@ index 3c04781f947..45998bc7516 100644
if (cfun_frame_layout.first_save_gpr != -1)
{
@@ -10400,6 +10591,14 @@ s390_emit_prologue (void)
- cfun_frame_layout.first_save_gpr_slot),
cfun_frame_layout.first_save_gpr,
cfun_frame_layout.last_save_gpr);
- cfun_frame_layout.first_save_gpr_slot),
cfun_frame_layout.first_save_gpr,
cfun_frame_layout.last_save_gpr);
+
+ /* This is not 100% correct. If we have more than one register saved,
+ then LAST_PROBE_OFFSET can move even closer to sp. */
@ -241,34 +241,34 @@ index 3c04781f947..45998bc7516 100644 @@ -241,34 +241,34 @@ index 3c04781f947..45998bc7516 100644
+
emit_insn (insn);
}

@@ -10416,6 +10615,8 @@ s390_emit_prologue (void)
if (cfun_fpr_bit_p (i))
{
save_fpr (stack_pointer_rtx, offset, i + 16);
{
save_fpr (stack_pointer_rtx, offset, i + 16);
+ if (offset < last_probe_offset)
+ last_probe_offset = offset;
offset += 8;
}
offset += 8;
}
else if (!TARGET_PACKED_STACK)
@@ -10429,6 +10630,8 @@ s390_emit_prologue (void)
if (cfun_fpr_bit_p (i))
{
insn = save_fpr (stack_pointer_rtx, offset, i + 16);
{
insn = save_fpr (stack_pointer_rtx, offset, i + 16);
+ if (offset < last_probe_offset)
+ last_probe_offset = offset;
offset += 8;

/* If f4 and f6 are call clobbered they are saved due to stdargs and
offset += 8;
/* If f4 and f6 are call clobbered they are saved due to stdargs and
@@ -10451,6 +10654,8 @@ s390_emit_prologue (void)
if (cfun_fpr_bit_p (i))
{
insn = save_fpr (stack_pointer_rtx, offset, i + 16);
if (cfun_fpr_bit_p (i))
{
insn = save_fpr (stack_pointer_rtx, offset, i + 16);
+ if (offset < last_probe_offset)
+ last_probe_offset = offset;

RTX_FRAME_RELATED_P (insn) = 1;
offset -= 8;
RTX_FRAME_RELATED_P (insn) = 1;
offset -= 8;
@@ -10470,10 +10675,11 @@ s390_emit_prologue (void)
if (cfun_frame_layout.frame_size > 0)
{
@ -276,28 +276,28 @@ index 3c04781f947..45998bc7516 100644 @@ -276,28 +276,28 @@ index 3c04781f947..45998bc7516 100644
- rtx real_frame_off;
+ rtx stack_pointer_backup_loc;
+ bool temp_reg_clobbered_p;

if (s390_stack_size)
- {
+ {
HOST_WIDE_INT stack_guard;

if (s390_stack_guard)
HOST_WIDE_INT stack_guard;
if (s390_stack_guard)
@@ -10538,35 +10744,36 @@ s390_emit_prologue (void)
if (s390_warn_dynamicstack_p && cfun->calls_alloca)
warning (0, "%qs uses dynamic stack allocation", current_function_name ());

warning (0, "%qs uses dynamic stack allocation", current_function_name ());
- /* Save incoming stack pointer into temp reg. */
- if (TARGET_BACKCHAIN || next_fpr)
- insn = emit_insn (gen_move_insn (temp_reg, stack_pointer_rtx));
+ /* Save the location where we could backup the incoming stack
+ pointer. */
+ stack_pointer_backup_loc = get_last_insn ();

- /* Subtract frame size from stack pointer. */
+ temp_reg_clobbered_p = allocate_stack_space (frame_off, last_probe_offset,
+ temp_reg);

- if (DISP_IN_RANGE (INTVAL (frame_off)))
- {
- insn = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
@ -307,7 +307,7 @@ index 3c04781f947..45998bc7516 100644 @@ -307,7 +307,7 @@ index 3c04781f947..45998bc7516 100644
- }
- else
+ if (TARGET_BACKCHAIN || next_fpr)
{
{
- if (!CONST_OK_FOR_K (INTVAL (frame_off)))
- frame_off = force_const_mem (Pmode, frame_off);
-
@ -332,8 +332,8 @@ index 3c04781f947..45998bc7516 100644 @@ -332,8 +332,8 @@ index 3c04781f947..45998bc7516 100644
+ emit_insn_after (gen_move_insn (temp_reg, stack_pointer_rtx),
+ stack_pointer_backup_loc);
+ }
}

}
- RTX_FRAME_RELATED_P (insn) = 1;
- real_frame_off = GEN_INT (-cfun_frame_layout.frame_size);
- add_reg_note (insn, REG_FRAME_RELATED_EXPR,
@ -342,48 +342,48 @@ index 3c04781f947..45998bc7516 100644 @@ -342,48 +342,48 @@ index 3c04781f947..45998bc7516 100644
- real_frame_off)));
-
/* Set backchain. */

if (TARGET_BACKCHAIN)
@@ -10590,6 +10797,8 @@ s390_emit_prologue (void)
emit_clobber (addr);
}
emit_clobber (addr);
}
}
+ else if (flag_stack_clash_protection)
+ dump_stack_clash_frame_info (NO_PROBE_NO_FRAME, false);

/* Save fprs 8 - 15 (64 bit ABI). */

diff --git a/gcc/testsuite/gcc.dg/stack-check-5.c b/gcc/testsuite/gcc.dg/stack-check-5.c
index 2171d9b6c23..3178f5d8ce5 100644
--- a/gcc/testsuite/gcc.dg/stack-check-5.c
+++ b/gcc/testsuite/gcc.dg/stack-check-5.c
@@ -3,6 +3,10 @@
/* { dg-require-effective-target supports_stack_clash_protection } */


+/* Otherwise the S/390 back-end might save the stack pointer in f2 ()
+ into an FPR. */
+/* { dg-additional-options "-msoft-float" { target { s390x-*-* } } } */
+
extern void foo (char *);
extern void bar (void);

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 2c669a9822f..f24c5c6e0ac 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5422,12 +5422,12 @@ proc check_effective_target_supports_stack_clash_protection { } {

# Temporary until the target bits are fully ACK'd.
# if { [istarget aarch*-*-*]
-# || [istarget s390*-*-*]
# || [istarget powerpc*-*-*] || [istarget rs6000*-*-*] } {
# return 1
# }

- if { [istarget x86_64-*-*] || [istarget i?86-*-*] } {
+ if { [istarget x86_64-*-*] || [istarget i?86-*-*]
+ if { [istarget x86_64-*-*] || [istarget i?86-*-*]
+ || [istarget s390*-*-*] } {
return 1
return 1
}
return 0

20
SOURCES/gcc48-rh1482762.patch

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
+++ gcc/config/i386/i386.c (revision 246479)
@@ -39533,9 +39533,6 @@
mode0 = DImode;

rdrand_step:
- op0 = gen_reg_rtx (mode0);
- emit_insn (GEN_FCN (icode) (op0));
@ -20,19 +20,19 @@ @@ -20,19 +20,19 @@
op1 = expand_normal (arg0);
if (!address_operand (op1, VOIDmode))
@@ -39543,6 +39540,10 @@
op1 = convert_memory_address (Pmode, op1);
op1 = copy_addr_to_reg (op1);
}
op1 = convert_memory_address (Pmode, op1);
op1 = copy_addr_to_reg (op1);
}
+
+ op0 = gen_reg_rtx (mode0);
+ emit_insn (GEN_FCN (icode) (op0));
+
emit_move_insn (gen_rtx_MEM (mode0, op1), op0);

op1 = gen_reg_rtx (SImode);
@@ -39584,9 +39597,6 @@
mode0 = DImode;

rdseed_step:
- op0 = gen_reg_rtx (mode0);
- emit_insn (GEN_FCN (icode) (op0));
@ -41,13 +41,13 @@ @@ -41,13 +41,13 @@
op1 = expand_normal (arg0);
if (!address_operand (op1, VOIDmode))
@@ -39594,6 +39604,10 @@
op1 = convert_memory_address (Pmode, op1);
op1 = copy_addr_to_reg (op1);
}
op1 = convert_memory_address (Pmode, op1);
op1 = copy_addr_to_reg (op1);
}
+
+ op0 = gen_reg_rtx (mode0);
+ emit_insn (GEN_FCN (icode) (op0));
+
emit_move_insn (gen_rtx_MEM (mode0, op1), op0);

op2 = gen_reg_rtx (QImode);

34
SOURCES/gcc48-rh1487434.patch

@ -8,27 +8,27 @@ @@ -8,27 +8,27 @@
@@ -31339,8 +31339,8 @@ rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED)
{
if (!toc_initialized)
{
{
- toc_initialized = 1;
fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);
fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);
+ ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2);
(*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0);
fprintf (asm_out_file, "\t.tc ");
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],");
(*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0);
fprintf (asm_out_file, "\t.tc ");
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],");
@@ -31348,20 +31348,30 @@ rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED)
fprintf (asm_out_file, "\n");

fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
fprintf (asm_out_file, "\n");
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
+ ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2);
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1");
fprintf (asm_out_file, " = .+32768\n");
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1");
fprintf (asm_out_file, " = .+32768\n");
+ toc_initialized = 1;
}
}
else
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
}
else if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
&& !TARGET_RELOCATABLE)
&& !TARGET_RELOCATABLE)
- fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);
+ {
+ fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);
@ -42,8 +42,8 @@ @@ -42,8 +42,8 @@
{
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
if (!toc_initialized)
{
{
+ ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2);
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1");
fprintf (asm_out_file, " = .+32768\n");
toc_initialized = 1;
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1");
fprintf (asm_out_file, " = .+32768\n");
toc_initialized = 1;

8
SOURCES/gcc48-rh1491395.patch

@ -9,8 +9,8 @@ @@ -9,8 +9,8 @@
+++ libitm/method-gl.cc
@@ -291,12 +291,18 @@ public:
// See begin_or_restart() for why we need release memory order here.
v = gl_mg::clear_locked(v) + 1;
o_gl_mg.orec.store(v, memory_order_release);
v = gl_mg::clear_locked(v) + 1;
o_gl_mg.orec.store(v, memory_order_release);
-
- // Need to ensure privatization safety. Every other transaction must
- // have a snapshot time that is at least as high as our commit time
@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
+ priv_time = v;
return true;
}

--- libitm/method-ml.cc
+++ libitm/method-ml.cc
@@ -513,6 +513,21 @@ public:
@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
+ priv_time = tx->shared_state.load(memory_order_relaxed);
return true;
}

--- /dev/null
+++ libitm/testsuite/libitm.c/priv-1.c
@@ -0,0 +1,117 @@

6
SOURCES/gcc48-rh1535655-1.patch

@ -11,17 +11,17 @@ index e31c8d0..87fd381 100644 @@ -11,17 +11,17 @@ index e31c8d0..87fd381 100644
@@ -1115,6 +1115,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
/* Base register for access to local variables of the function. */
#define FRAME_POINTER_REGNUM 20

+#define FIRST_INT_REG AX_REG
+#define LAST_INT_REG SP_REG
+
/* First floating point reg */
#define FIRST_FLOAT_REG 8

@@ -1317,6 +1320,9 @@ enum reg_class
#define QI_REG_P(X) (REG_P (X) && QI_REGNO_P (REGNO (X)))
#define QI_REGNO_P(N) IN_RANGE ((N), AX_REG, BX_REG)

+#define LEGACY_INT_REG_P(X) (REG_P (X) && LEGACY_INT_REGNO_P (REGNO (X)))
+#define LEGACY_INT_REGNO_P(N) (IN_RANGE ((N), FIRST_INT_REG, LAST_INT_REG))
+

76
SOURCES/gcc48-rh1535655-2.patch

@ -11,7 +11,7 @@ index 11c0845..139d23c 100644 @@ -11,7 +11,7 @@ index 11c0845..139d23c 100644
@@ -85,4 +85,16 @@ enum ix86_veclibabi {
ix86_veclibabi_type_acml
};

+/* This is used to mitigate variant #2 of the speculative execution
+ vulnerabilities on x86 processors identified by CVE-2017-5715, aka
+ Spectre. They convert indirect branches and function returns to
@ -31,10 +31,10 @@ index 96e7c5c..ecdf108 100644 @@ -31,10 +31,10 @@ index 96e7c5c..ecdf108 100644
+++ b/gcc/config/i386/i386-protos.h
@@ -306,6 +306,7 @@ extern enum attr_cpu ix86_schedule;
#endif

extern const char * ix86_output_call_insn (rtx insn, rtx call_op);
+extern const char * ix86_output_indirect_jmp (rtx call_op, bool ret_p);

#ifdef RTX_CODE
/* Target data for multipass lookahead scheduling.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
@ -44,7 +44,7 @@ index b91a456..ebc9a90 100644 @@ -44,7 +44,7 @@ index b91a456..ebc9a90 100644
@@ -2572,12 +2572,23 @@ struct rtl_opt_pass pass_insert_vzeroupper =
}
};

-/* Return true if a red-zone is in use. */
+/* Return true if a red-zone is in use. We can't use red-zone when
+ there are local indirect jumps, like "indirect_jump" or "tablejump",
@ -55,7 +55,7 @@ index b91a456..ebc9a90 100644 @@ -55,7 +55,7 @@ index b91a456..ebc9a90 100644
+ TODO: If we can reserve the first 2 WORDs, for PUSH and, another
+ for CALL, in red-zone, we can allow local indirect jumps with
+ indirect thunk. */

static inline bool
ix86_using_red_zone (void)
{
@ -69,7 +69,7 @@ index b91a456..ebc9a90 100644 @@ -69,7 +69,7 @@ index b91a456..ebc9a90 100644
/* Return a string that documents the current -m options. The caller is
@@ -4595,6 +4606,37 @@ ix86_can_inline_p (tree caller, tree callee)
}

+/* Set the indirect_branch_type field from the function FNDECL. */
+
@ -104,7 +104,7 @@ index b91a456..ebc9a90 100644 @@ -104,7 +104,7 @@ index b91a456..ebc9a90 100644
+
/* Remember the last target of ix86_set_current_function. */
static GTY(()) tree ix86_previous_fndecl;

@@ -4609,6 +4651,9 @@ ix86_set_current_function (tree fndecl)
slow things down too much or call target_reinit when it isn't safe. */
if (fndecl && fndecl != ix86_previous_fndecl)
@ -113,21 +113,21 @@ index b91a456..ebc9a90 100644 @@ -113,21 +113,21 @@ index b91a456..ebc9a90 100644
+ ix86_set_indirect_branch_type (fndecl);
+
tree old_tree = (ix86_previous_fndecl
? DECL_FUNCTION_SPECIFIC_TARGET (ix86_previous_fndecl)
: NULL_TREE);
? DECL_FUNCTION_SPECIFIC_TARGET (ix86_previous_fndecl)
: NULL_TREE);
@@ -4637,6 +4682,8 @@ ix86_set_current_function (tree fndecl)
target_reinit ();
}
target_reinit ();
}
}
+ if (cfun && cfun->machine && fndecl)
+ ix86_set_indirect_branch_type (fndecl);
}

@@ -8668,6 +8715,196 @@ ix86_setup_frame_addresses (void)
# endif
#endif

+/* Label count for call and return thunks. It is used to make unique
+ labels in call and return thunks. */
+static int indirectlabelno;
@ -319,12 +319,12 @@ index b91a456..ebc9a90 100644 @@ -319,12 +319,12 @@ index b91a456..ebc9a90 100644
+}
+
static int pic_labels_used;

/* Fills in the label name that should be used for a pc thunk for
@@ -8694,11 +8931,24 @@ ix86_code_end (void)
rtx xops[2];
int regno;

+ if (indirect_thunk_needed)
+ output_indirect_thunk_function (-1);
+
@ -339,17 +339,17 @@ index b91a456..ebc9a90 100644 @@ -339,17 +339,17 @@ index b91a456..ebc9a90 100644
{
char name[32];
tree decl;

+ if ((indirect_thunks_used & (1 << regno)))
+ output_indirect_thunk_function (regno);
+
if (!(pic_labels_used & (1 << regno)))
continue;

continue;
@@ -24074,12 +24324,250 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
return call;
}

+/* Output indirect branch via a call and return thunk. CALL_OP is a
+ register which contains the branch target. XASM is the assembly
+ template for CALL_OP. Branch is a tail call if SIBCALL_P is true.
@ -586,7 +586,7 @@ index b91a456..ebc9a90 100644 @@ -586,7 +586,7 @@ index b91a456..ebc9a90 100644
+}
+
/* Output the assembly for a call instruction. */

const char *
ix86_output_call_insn (rtx insn, rtx call_op)
{
@ -596,10 +596,10 @@ index b91a456..ebc9a90 100644 @@ -596,10 +596,10 @@ index b91a456..ebc9a90 100644
+ && cfun->machine->indirect_branch_type != indirect_branch_keep);
bool seh_nop_p = false;
const char *xasm;

@@ -24092,9 +24580,17 @@ ix86_output_call_insn (rtx insn, rtx call_op)
else if (TARGET_SEH)
xasm = "rex.W jmp %A0";
xasm = "rex.W jmp %A0";
else
- xasm = "jmp\t%A0";
+ {
@ -608,7 +608,7 @@ index b91a456..ebc9a90 100644 @@ -608,7 +608,7 @@ index b91a456..ebc9a90 100644
+ else
+ xasm = "jmp\t%A0";
+ }

- output_asm_insn (xasm, &call_op);
+ if (output_indirect_p && !direct_p)
+ ix86_output_indirect_branch (call_op, xasm, true);
@ -616,7 +616,7 @@ index b91a456..ebc9a90 100644 @@ -616,7 +616,7 @@ index b91a456..ebc9a90 100644
+ output_asm_insn (xasm, &call_op);
return "";
}

@@ -24131,9 +24627,17 @@ ix86_output_call_insn (rtx insn, rtx call_op)
if (direct_p)
xasm = "call\t%P0";
@ -628,17 +628,17 @@ index b91a456..ebc9a90 100644 @@ -628,17 +628,17 @@ index b91a456..ebc9a90 100644
+ else
+ xasm = "call\t%A0";
+ }

- output_asm_insn (xasm, &call_op);
+ if (output_indirect_p && !direct_p)
+ ix86_output_indirect_branch (call_op, xasm, false);
+ else
+ output_asm_insn (xasm, &call_op);

if (seh_nop_p)
return "nop";
@@ -35436,7 +35940,7 @@ ix86_handle_struct_attribute (tree *node, tree name,

static tree
ix86_handle_fndecl_attribute (tree *node, tree name,
- tree args ATTRIBUTE_UNUSED,
@ -675,7 +675,7 @@ index b91a456..ebc9a90 100644 @@ -675,7 +675,7 @@ index b91a456..ebc9a90 100644
+
return NULL_TREE;
}

@@ -38963,6 +39490,8 @@ static const struct attribute_spec ix86_attribute_table[] =
false },
{ "callee_pop_aggregate_return", 1, 1, false, true, true,
@ -692,7 +692,7 @@ index 87fd381..8183cee7 100644 @@ -692,7 +692,7 @@ index 87fd381..8183cee7 100644
@@ -2322,6 +2322,13 @@ struct GTY(()) machine_function {
stack below the return address. */
BOOL_BITFIELD static_chain_on_stack : 1;

+ /* How to generate indirec branch. */
+ ENUM_BITFIELD(indirect_branch) indirect_branch_type : 3;
+
@ -713,7 +713,7 @@ index e09e961..b943849 100644 @@ -713,7 +713,7 @@ index e09e961..b943849 100644
operands[0] = convert_memory_address (word_mode, operands[0]);
+ cfun->machine->has_local_indirect_jump = true;
})

(define_insn "*indirect_jump"
[(set (pc) (match_operand:W 0 "indirect_branch_operand" "rw"))]
""
@ -726,15 +726,15 @@ index e09e961..b943849 100644 @@ -726,15 +726,15 @@ index e09e961..b943849 100644
+ (const_string "multi")
+ (const_string "ibr")))
(set_attr "length_immediate" "0")])

(define_expand "tablejump"
@@ -11324,14 +11329,19 @@

if (TARGET_X32)
operands[0] = convert_memory_address (word_mode, operands[0]);
+ cfun->machine->has_local_indirect_jump = true;
})

(define_insn "*tablejump_1"
[(set (pc) (match_operand:W 0 "indirect_branch_operand" "rw"))
(use (label_ref (match_operand 1)))]
@ -763,7 +763,7 @@ index e09e961..b943849 100644 @@ -763,7 +763,7 @@ index e09e961..b943849 100644
+ (const_string "multi")
+ (const_string "ibr")))
(set_attr "length_immediate" "0")])

(define_insn "nop"
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index e93aa5a..0f6965a 100644
@ -812,7 +812,7 @@ index e495af5..847991c 100644 @@ -812,7 +812,7 @@ index e495af5..847991c 100644
+@samp{thunk-extern} converts indirect call and jump to external call
+and return thunk provided in a separate object file.
@end table

On the PowerPC, the following options are allowed:
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 313a6c5..b299fbf 100644
@ -825,13 +825,13 @@ index 313a6c5..b299fbf 100644 @@ -825,13 +825,13 @@ index 313a6c5..b299fbf 100644
--mavx256-split-unaligned-load -mavx256-split-unaligned-store}
+-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
+-mindirect-branch=@var{choice}}

@emph{i386 and x86-64 Windows Options}
@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
@@ -14646,6 +14647,17 @@ to 255, 8-bit unsigned integer divide is used instead of
@opindex avx256-split-unaligned-store
Split 32-byte AVX unaligned load and store.

+@item -mindirect-branch=@var{choice}
+@opindex -mindirect-branch
+Convert indirect call and jump with @var{choice}. The default is
@ -844,7 +844,7 @@ index 313a6c5..b299fbf 100644 @@ -844,7 +844,7 @@ index 313a6c5..b299fbf 100644
+function attribute @code{indirect_branch}. @xref{Function Attributes}.
+
@end table

These @samp{-m} switches are supported in addition to the above
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
new file mode 100644

170
SOURCES/gcc48-rh1535655-3.patch

@ -9,11 +9,11 @@ index ecdf108..4e4b210 100644 @@ -9,11 +9,11 @@ index ecdf108..4e4b210 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -307,6 +307,7 @@ extern enum attr_cpu ix86_schedule;

extern const char * ix86_output_call_insn (rtx insn, rtx call_op);
extern const char * ix86_output_indirect_jmp (rtx call_op, bool ret_p);
+extern const char * ix86_output_function_return (bool long_p);

#ifdef RTX_CODE
/* Target data for multipass lookahead scheduling.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
@ -22,7 +22,7 @@ index ebc9a90..9dffd02f 100644 @@ -22,7 +22,7 @@ index ebc9a90..9dffd02f 100644
+++ b/gcc/config/i386/i386.c
@@ -4635,6 +4635,31 @@ ix86_set_indirect_branch_type (tree fndecl)
else
cfun->machine->indirect_branch_type = ix86_indirect_branch;
cfun->machine->indirect_branch_type = ix86_indirect_branch;
}
+
+ if (cfun->machine->function_return_type == indirect_branch_unset)
@ -50,11 +50,11 @@ index ebc9a90..9dffd02f 100644 @@ -50,11 +50,11 @@ index ebc9a90..9dffd02f 100644
+ cfun->machine->function_return_type = ix86_function_return;
+ }
}

/* Remember the last target of ix86_set_current_function. */
@@ -8733,8 +8758,11 @@ static int indirect_thunks_used;
/* Fills in the label name that should be used for the indirect thunk. */

static void
-indirect_thunk_name (char name[32], int regno)
+indirect_thunk_name (char name[32], int regno, bool ret_p)
@ -66,8 +66,8 @@ index ebc9a90..9dffd02f 100644 @@ -66,8 +66,8 @@ index ebc9a90..9dffd02f 100644
{
if (regno >= 0)
@@ -8748,14 +8776,22 @@ indirect_thunk_name (char name[32], int regno)
reg_prefix, reg_names[regno]);
}
reg_prefix, reg_names[regno]);
}
else
- sprintf (name, "__x86_indirect_thunk");
+ {
@ -78,7 +78,7 @@ index ebc9a90..9dffd02f 100644 @@ -78,7 +78,7 @@ index ebc9a90..9dffd02f 100644
else
{
if (regno >= 0)
ASM_GENERATE_INTERNAL_LABEL (name, "LITR", regno);
ASM_GENERATE_INTERNAL_LABEL (name, "LITR", regno);
else
- ASM_GENERATE_INTERNAL_LABEL (name, "LIT", 0);
+ {
@ -89,20 +89,20 @@ index ebc9a90..9dffd02f 100644 @@ -89,20 +89,20 @@ index ebc9a90..9dffd02f 100644
+ }
}
}

@@ -8841,7 +8877,7 @@ output_indirect_thunk_function (int regno)
tree decl;

/* Create __x86_indirect_thunk. */
- indirect_thunk_name (name, regno);
+ indirect_thunk_name (name, regno, false);
decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
get_identifier (name),
build_function_type_list (void_type_node, NULL_TREE));
get_identifier (name),
build_function_type_list (void_type_node, NULL_TREE));
@@ -8885,6 +8921,36 @@ output_indirect_thunk_function (int regno)
ASM_OUTPUT_LABEL (asm_out_file, name);
ASM_OUTPUT_LABEL (asm_out_file, name);
}

+ if (regno < 0)
+ {
+ /* Create alias for __x86.return_thunk/__x86.return_thunk_bnd. */
@ -137,9 +137,9 @@ index ebc9a90..9dffd02f 100644 @@ -137,9 +137,9 @@ index ebc9a90..9dffd02f 100644
current_function_decl = decl;
allocate_struct_function (decl, false);
@@ -24353,7 +24419,7 @@ ix86_output_indirect_branch_via_reg (rtx call_op, bool sibcall_p)
i -= (FIRST_REX_INT_REG - LAST_INT_REG - 1);
indirect_thunks_used |= 1 << i;
}
i -= (FIRST_REX_INT_REG - LAST_INT_REG - 1);
indirect_thunks_used |= 1 << i;
}
- indirect_thunk_name (thunk_name_buf, regno);
+ indirect_thunk_name (thunk_name_buf, regno, false);
thunk_name = thunk_name_buf;
@ -148,7 +148,7 @@ index ebc9a90..9dffd02f 100644 @@ -148,7 +148,7 @@ index ebc9a90..9dffd02f 100644
@@ -24437,7 +24503,7 @@ ix86_output_indirect_branch_via_push (rtx call_op, const char *xasm,
{
if (cfun->machine->indirect_branch_type == indirect_branch_thunk)
indirect_thunk_needed = true;
indirect_thunk_needed = true;
- indirect_thunk_name (thunk_name_buf, regno);
+ indirect_thunk_name (thunk_name_buf, regno, false);
thunk_name = thunk_name_buf;
@ -157,7 +157,7 @@ index ebc9a90..9dffd02f 100644 @@ -157,7 +157,7 @@ index ebc9a90..9dffd02f 100644
@@ -24559,6 +24625,37 @@ ix86_output_indirect_jmp (rtx call_op, bool ret_p)
return "jmp\t%A0";
}

+/* Output function return. CALL_OP is the jump target. Add a REP
+ prefix to RET if LONG_P is true and function return is kept. */
+
@ -190,12 +190,12 @@ index ebc9a90..9dffd02f 100644 @@ -190,12 +190,12 @@ index ebc9a90..9dffd02f 100644
+}
+
/* Output the assembly for a call instruction. */

const char *
@@ -35972,6 +36069,28 @@ ix86_handle_fndecl_attribute (tree *node, tree name,
}
}
}

+ if (is_attribute_p ("function_return", name))
+ {
+ tree cst = TREE_VALUE (args);
@ -220,7 +220,7 @@ index ebc9a90..9dffd02f 100644 @@ -220,7 +220,7 @@ index ebc9a90..9dffd02f 100644
+
return NULL_TREE;
}

@@ -39492,6 +39611,9 @@ static const struct attribute_spec ix86_attribute_table[] =
ix86_handle_callee_pop_aggregate_return, true },
{ "indirect_branch", 1, 1, true, false, false,
@ -238,7 +238,7 @@ index 8183cee7..8ff7026 100644 @@ -238,7 +238,7 @@ index 8183cee7..8ff7026 100644
@@ -2329,6 +2329,9 @@ struct GTY(()) machine_function {
"indirect_jump" or "tablejump". */
BOOL_BITFIELD has_local_indirect_jump : 1;

+ /* How to generate function return. */
+ ENUM_BITFIELD(indirect_branch) function_return_type : 3;
+
@ -274,7 +274,7 @@ index 0f6965a..9dfa2cb 100644 @@ -274,7 +274,7 @@ index 0f6965a..9dfa2cb 100644
@@ -635,9 +635,13 @@ mindirect-branch=
Target Report RejectNegative Joined Enum(indirect_branch) Var(ix86_indirect_branch) Init(indirect_branch_keep)
Convert indirect call and jump to call and return thunks.

+mfunction-return=
+Target Report RejectNegative Joined Enum(indirect_branch) Var(ix86_function_return) Init(indirect_branch_keep)
+Convert function return to call and return thunk.
@ -283,7 +283,7 @@ index 0f6965a..9dfa2cb 100644 @@ -283,7 +283,7 @@ index 0f6965a..9dfa2cb 100644
Name(indirect_branch) Type(enum indirect_branch)
-Known indirect branch choices (for use with the -mindirect-branch= option):
+Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options):

EnumValue
Enum(indirect_branch) String(keep) Value(indirect_branch_keep)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
@ -304,7 +304,7 @@ index 847991c..add4f18 100644 @@ -304,7 +304,7 @@ index 847991c..add4f18 100644
+call and return thunk. @samp{thunk-extern} converts function return to
+external call and return thunk provided in a separate object file.
@end table

On the PowerPC, the following options are allowed:
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index b299fbf..5acd23a 100644
@ -316,13 +316,13 @@ index b299fbf..5acd23a 100644 @@ -316,13 +316,13 @@ index b299fbf..5acd23a 100644
-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
--mindirect-branch=@var{choice}}
+-mindirect-branch=@var{choice} -mfunction-return==@var{choice}}

@emph{i386 and x86-64 Windows Options}
@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
@@ -14658,6 +14658,17 @@ to external call and return thunk provided in a separate object file.
You can control this behavior for a specific function by using the
function attribute @code{indirect_branch}. @xref{Function Attributes}.

+@item -mfunction-return=@var{choice}
+@opindex -mfunction-return
+Convert function return with @var{choice}. The default is @samp{keep},
@ -335,7 +335,7 @@ index b299fbf..5acd23a 100644 @@ -335,7 +335,7 @@ index b299fbf..5acd23a 100644
+@xref{Function Attributes}.
+
@end table

These @samp{-m} switches are supported in addition to the above
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
index 87f6dae..034b4cc 100644
@ -345,9 +345,9 @@ index 87f6dae..034b4cc 100644 @@ -345,9 +345,9 @@ index 87f6dae..034b4cc 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
index 6bc4f0a..e0c57cb 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
@ -356,9 +356,9 @@ index 6bc4f0a..e0c57cb 100644 @@ -356,9 +356,9 @@ index 6bc4f0a..e0c57cb 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
index f20d35c..3c0d4c3 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
@ -367,13 +367,13 @@ index f20d35c..3c0d4c3 100644 @@ -367,13 +367,13 @@ index f20d35c..3c0d4c3 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

typedef void (*dispatch_t)(long offset);

@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
return 0;
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
@ -387,13 +387,13 @@ index 0eff8fb..14d4ef6 100644 @@ -387,13 +387,13 @@ index 0eff8fb..14d4ef6 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

typedef void (*dispatch_t)(long offset);

@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
return 0;
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
@ -407,13 +407,13 @@ index afdb600..bc6b47a 100644 @@ -407,13 +407,13 @@ index afdb600..bc6b47a 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

void func0 (void);
void func1 (void);
@@ -35,7 +35,7 @@ bar (int i)
}
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
@ -427,9 +427,9 @@ index efccdec..7c45142 100644 @@ -427,9 +427,9 @@ index efccdec..7c45142 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
index ca3814e..9eebc84 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
@ -438,9 +438,9 @@ index ca3814e..9eebc84 100644 @@ -438,9 +438,9 @@ index ca3814e..9eebc84 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
index 97744d6..f938db0 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
@ -449,13 +449,13 @@ index 97744d6..f938db0 100644 @@ -449,13 +449,13 @@ index 97744d6..f938db0 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

@@ -14,7 +14,7 @@ male_indirect_jump (long offset)
return 0;
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
@ -469,13 +469,13 @@ index bfce3ea..4e58599 100644 @@ -469,13 +469,13 @@ index bfce3ea..4e58599 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

@@ -13,7 +13,7 @@ male_indirect_jump (long offset)
return 0;
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
@ -489,13 +489,13 @@ index 0833606..b8d5024 100644 @@ -489,13 +489,13 @@ index 0833606..b8d5024 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

@@ -14,7 +14,7 @@ male_indirect_jump (long offset)
return 0;
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
@ -509,13 +509,13 @@ index 2eba0fb..455adab 100644 @@ -509,13 +509,13 @@ index 2eba0fb..455adab 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

@@ -13,7 +13,7 @@ male_indirect_jump (long offset)
return 0;
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
@ -529,13 +529,13 @@ index f58427e..4595b84 100644 @@ -529,13 +529,13 @@ index f58427e..4595b84 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */

void func0 (void);
void func1 (void);
@@ -36,7 +36,7 @@ bar (int i)
}
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
@ -549,7 +549,7 @@ index 564ed39..d730d31 100644 @@ -549,7 +549,7 @@ index 564ed39..d730d31 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

void func0 (void);
void func1 (void);
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
@ -560,9 +560,9 @@ index 7fd01d6..f424181 100644 @@ -560,9 +560,9 @@ index 7fd01d6..f424181 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
index 825f6b2..ac54868 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
@ -571,9 +571,9 @@ index 825f6b2..ac54868 100644 @@ -571,9 +571,9 @@ index 825f6b2..ac54868 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
index 395634e..06ebf1c 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
@ -582,13 +582,13 @@ index 395634e..06ebf1c 100644 @@ -582,13 +582,13 @@ index 395634e..06ebf1c 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

typedef void (*dispatch_t)(long offset);

@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
return 0;
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
@ -602,13 +602,13 @@ index fd3f633..1c8f944 100644 @@ -602,13 +602,13 @@ index fd3f633..1c8f944 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

typedef void (*dispatch_t)(long offset);

@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
return 0;
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
@ -622,13 +622,13 @@ index 6652523..86e9fd1 100644 @@ -622,13 +622,13 @@ index 6652523..86e9fd1 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

void func0 (void);
void func1 (void);
@@ -35,7 +35,7 @@ bar (int i)
}
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
@ -642,9 +642,9 @@ index 48c4dd4..4117a35 100644 @@ -642,9 +642,9 @@ index 48c4dd4..4117a35 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
index 355dad5..650d55c 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
@ -653,9 +653,9 @@ index 355dad5..650d55c 100644 @@ -653,9 +653,9 @@ index 355dad5..650d55c 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
index 244fec7..9540996 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
@ -664,13 +664,13 @@ index 244fec7..9540996 100644 @@ -664,13 +664,13 @@ index 244fec7..9540996 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

typedef void (*dispatch_t)(long offset);

@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
return 0;
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
@ -684,13 +684,13 @@ index 107ebe3..f3db6e2 100644 @@ -684,13 +684,13 @@ index 107ebe3..f3db6e2 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

typedef void (*dispatch_t)(long offset);

@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
return 0;
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
@ -704,13 +704,13 @@ index d02b1dc..764a375 100644 @@ -704,13 +704,13 @@ index d02b1dc..764a375 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

void func0 (void);
void func1 (void);
@@ -35,7 +35,7 @@ bar (int i)
}
}

-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */

141
SOURCES/gcc48-rh1535655-4.patch

@ -9,14 +9,14 @@ index d567fd7..43faabb 100644 @@ -9,14 +9,14 @@ index d567fd7..43faabb 100644
--- a/gcc/config/i386/constraints.md
+++ b/gcc/config/i386/constraints.md
@@ -135,7 +135,8 @@

(define_constraint "w"
"@internal Call memory operand."
- (and (not (match_test "TARGET_X32"))
+ (and (not (match_test "ix86_indirect_branch_register"))
+ (not (match_test "TARGET_X32"))
(match_operand 0 "memory_operand")))

;; Integer constant constraints.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index ef16cf5..228f8f6 100644
@ -32,9 +32,9 @@ index ef16cf5..228f8f6 100644 @@ -32,9 +32,9 @@ index ef16cf5..228f8f6 100644
cfun->machine->has_local_indirect_jump = true;
})
@@ -11327,7 +11327,7 @@
OPTAB_DIRECT);
OPTAB_DIRECT);
}

- if (TARGET_X32)
+ if (TARGET_X32 || ix86_indirect_branch_register)
operands[0] = convert_memory_address (word_mode, operands[0]);
@ -42,28 +42,28 @@ index ef16cf5..228f8f6 100644 @@ -42,28 +42,28 @@ index ef16cf5..228f8f6 100644
})
@@ -11514,7 +11514,7 @@
})

(define_insn "*call_pop"
- [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lzm"))
+ [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lwz"))
(match_operand 1))
(match_operand 1))
(set (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
@@ -11612,7 +11612,7 @@

(define_insn "*call_value_pop"
[(set (match_operand 0)
- (call (mem:QI (match_operand:SI 1 "call_insn_operand" "lzm"))
+ (call (mem:QI (match_operand:SI 1 "call_insn_operand" "lwz"))
(match_operand 2)))
(match_operand 2)))
(set (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index 9dfa2cb..0a8ae8f 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -654,3 +654,7 @@ Enum(indirect_branch) String(thunk-inline) Value(indirect_branch_thunk_inline)

EnumValue
Enum(indirect_branch) String(thunk-extern) Value(indirect_branch_thunk_extern)
+
@ -81,19 +81,19 @@ index 61614e1..6c7a593 100644 @@ -81,19 +81,19 @@ index 61614e1..6c7a593 100644
- (and (not (match_test "TARGET_X32"))
+ (and (not (match_test "ix86_indirect_branch_register"))
+ (not (match_test "TARGET_X32"))
(match_operand 0 "memory_operand"))))

(match_operand 0 "memory_operand"))))
;; Test for a valid operand for a call instruction.
@@ -549,8 +550,9 @@
(ior (match_test "constant_call_address_operand
(op, mode == VOIDmode ? mode : Pmode)")
(op, mode == VOIDmode ? mode : Pmode)")
(match_operand 0 "call_register_no_elim_operand")
- (and (not (match_test "TARGET_X32"))
- (match_operand 0 "memory_operand"))))
+ (and (not (match_test "ix86_indirect_branch_register"))
+ (and (not (match_test "TARGET_X32"))
+ (match_operand 0 "memory_operand")))))

;; Similarly, but for tail calls, in which we cannot allow memory references.
(define_special_predicate "sibcall_insn_operand"
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
@ -107,19 +107,19 @@ index 5acd23a..4a365c7 100644 @@ -107,19 +107,19 @@ index 5acd23a..4a365c7 100644
--mindirect-branch=@var{choice} -mfunction-return==@var{choice}}
+-mindirect-branch=@var{choice} -mfunction-return==@var{choice}
+-mindirect-branch-register}

@emph{i386 and x86-64 Windows Options}
@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
@@ -14669,6 +14670,10 @@ object file. You can control this behavior for a specific function by
using the function attribute @code{function_return}.
@xref{Function Attributes}.

+@item -mindirect-branch-register
+@opindex -mindirect-branch-register
+Force indirect call and jump via register.
+
@end table

These @samp{-m} switches are supported in addition to the above
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
index 034b4cc..321db77 100644
@ -129,9 +129,9 @@ index 034b4cc..321db77 100644 @@ -129,9 +129,9 @@ index 034b4cc..321db77 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
index e0c57cb..d584516 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
@ -140,9 +140,9 @@ index e0c57cb..d584516 100644 @@ -140,9 +140,9 @@ index e0c57cb..d584516 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
index 3c0d4c3..9e24a38 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
@ -151,9 +151,9 @@ index 3c0d4c3..9e24a38 100644 @@ -151,9 +151,9 @@ index 3c0d4c3..9e24a38 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
index 14d4ef6..127b5d9 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
@ -162,9 +162,9 @@ index 14d4ef6..127b5d9 100644 @@ -162,9 +162,9 @@ index 14d4ef6..127b5d9 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
index bc6b47a..17c2d0f 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
@ -173,7 +173,7 @@ index bc6b47a..17c2d0f 100644 @@ -173,7 +173,7 @@ index bc6b47a..17c2d0f 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

void func0 (void);
void func1 (void);
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
@ -184,9 +184,9 @@ index 7c45142..cd7e8d7 100644 @@ -184,9 +184,9 @@ index 7c45142..cd7e8d7 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
index 9eebc84..4dbd7a5 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
@ -195,9 +195,9 @@ index 9eebc84..4dbd7a5 100644 @@ -195,9 +195,9 @@ index 9eebc84..4dbd7a5 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
index f938db0..4aeec18 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
@ -206,9 +206,9 @@ index f938db0..4aeec18 100644 @@ -206,9 +206,9 @@ index f938db0..4aeec18 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
index 4e58599..ac0e599 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
@ -217,9 +217,9 @@ index 4e58599..ac0e599 100644 @@ -217,9 +217,9 @@ index 4e58599..ac0e599 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
index b8d5024..573cf1e 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
@ -228,9 +228,9 @@ index b8d5024..573cf1e 100644 @@ -228,9 +228,9 @@ index b8d5024..573cf1e 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
index 455adab..b2b37fc 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
@ -239,9 +239,9 @@ index 455adab..b2b37fc 100644 @@ -239,9 +239,9 @@ index 455adab..b2b37fc 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
index 4595b84..4a43e19 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
@ -250,7 +250,7 @@ index 4595b84..4a43e19 100644 @@ -250,7 +250,7 @@ index 4595b84..4a43e19 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */

void func0 (void);
void func1 (void);
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
@ -261,9 +261,9 @@ index f424181..72de88e 100644 @@ -261,9 +261,9 @@ index f424181..72de88e 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
index ac54868..d4137b3 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
@ -272,9 +272,9 @@ index ac54868..d4137b3 100644 @@ -272,9 +272,9 @@ index ac54868..d4137b3 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
index 06ebf1c..d9964c2 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
@ -283,9 +283,9 @@ index 06ebf1c..d9964c2 100644 @@ -283,9 +283,9 @@ index 06ebf1c..d9964c2 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
index 1c8f944..d4dca4d 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
@ -294,9 +294,9 @@ index 1c8f944..d4dca4d 100644 @@ -294,9 +294,9 @@ index 1c8f944..d4dca4d 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
index 86e9fd1..aece938 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
@ -305,7 +305,7 @@ index 86e9fd1..aece938 100644 @@ -305,7 +305,7 @@ index 86e9fd1..aece938 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

void func0 (void);
void func1 (void);
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
@ -316,9 +316,9 @@ index 4117a35..e3cea3f 100644 @@ -316,9 +316,9 @@ index 4117a35..e3cea3f 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
index 650d55c..6222996 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
@ -327,9 +327,9 @@ index 650d55c..6222996 100644 @@ -327,9 +327,9 @@ index 650d55c..6222996 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
index 9540996..2eef6f3 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
@ -338,9 +338,9 @@ index 9540996..2eef6f3 100644 @@ -338,9 +338,9 @@ index 9540996..2eef6f3 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
index f3db6e2..e825a10 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
@ -349,9 +349,9 @@ index f3db6e2..e825a10 100644 @@ -349,9 +349,9 @@ index f3db6e2..e825a10 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

typedef void (*dispatch_t)(long offset);

diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
index 764a375..c67066c 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
@ -360,7 +360,7 @@ index 764a375..c67066c 100644 @@ -360,7 +360,7 @@ index 764a375..c67066c 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

void func0 (void);
void func1 (void);
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c
@ -450,9 +450,9 @@ index 3a6727b..e6fea84 100644 @@ -450,9 +450,9 @@ index 3a6727b..e6fea84 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */

extern void (*bar) (void);

diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
index b8f6818..e239ec4 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
@ -461,9 +461,9 @@ index b8f6818..e239ec4 100644 @@ -461,9 +461,9 @@ index b8f6818..e239ec4 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */

extern void (*bar) (void);

diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
index 01b0a02..fa31813 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
@ -472,9 +472,9 @@ index 01b0a02..fa31813 100644 @@ -472,9 +472,9 @@ index 01b0a02..fa31813 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */

extern void (*bar) (void);

diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
index 4b497b5..fd5b41f 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
@ -483,7 +483,7 @@ index 4b497b5..fd5b41f 100644 @@ -483,7 +483,7 @@ index 4b497b5..fd5b41f 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */

extern void (*bar) (void);
extern int foo (void) __attribute__ ((function_return("thunk")));
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
@ -494,9 +494,9 @@ index 4ae4c44..d606373 100644 @@ -494,9 +494,9 @@ index 4ae4c44..d606373 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */

extern void (*bar) (void);

diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
index 5b5bc76..75e45e2 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
@ -505,9 +505,9 @@ index 5b5bc76..75e45e2 100644 @@ -505,9 +505,9 @@ index 5b5bc76..75e45e2 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */

extern void (*bar) (void);

diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
index fa24a1f..d1db41c 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
@ -516,5 +516,6 @@ index fa24a1f..d1db41c 100644 @@ -516,5 +516,6 @@ index fa24a1f..d1db41c 100644
/* { dg-do compile } */
-/* { dg-options "-O2 -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */

extern void (*bar) (void);

20
SOURCES/gcc48-rh1535655-5.patch

@ -14,21 +14,21 @@ index 9dffd02f..e73389b 100644 @@ -14,21 +14,21 @@ index 9dffd02f..e73389b 100644
If CODE is 'd', duplicate the operand for AVX instruction.
+ If CODE is 'V', print naked full integer register name without %.
*/

void
@@ -14506,7 +14507,7 @@ print_reg (rtx x, int code, FILE *file)
unsigned int regno;
bool duplicated = code == 'd' && TARGET_AVX;

- if (ASSEMBLER_DIALECT == ASM_ATT)
+ if (ASSEMBLER_DIALECT == ASM_ATT && code != 'V')
putc ('%', file);

if (x == pc_rtx)
@@ -14542,6 +14543,14 @@ print_reg (rtx x, int code, FILE *file)
else
code = GET_MODE_SIZE (GET_MODE (x));

+ if (code == 'V')
+ {
+ if (GENERAL_REGNO_P (regno))
@ -49,13 +49,13 @@ index 9dffd02f..e73389b 100644 @@ -49,13 +49,13 @@ index 9dffd02f..e73389b 100644
; -- print a semicolon (after prefixes due to bug in older gas).
~ -- print "i" if TARGET_AVX2, "f" otherwise.
@@ -14919,6 +14929,7 @@ ix86_print_operand (FILE *file, rtx x, int code)
case 'X':
case 'P':
case 'p':
case 'X':
case 'P':
case 'p':
+ case 'V':
break;

case 's':
break;
case 's':
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c
new file mode 100644
index 0000000..f0cd9b7

16
SOURCES/gcc48-rh1535655-6.patch

@ -9,9 +9,9 @@ index e73389b..15cfe83 100644 @@ -9,9 +9,9 @@ index e73389b..15cfe83 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4634,6 +4634,19 @@ ix86_set_indirect_branch_type (tree fndecl)
}
}
else
cfun->machine->indirect_branch_type = ix86_indirect_branch;
cfun->machine->indirect_branch_type = ix86_indirect_branch;
+
+ /* -mcmodel=large is not compatible with -mindirect-branch=thunk
+ nor -mindirect-branch=thunk-extern. */
@ -26,12 +26,12 @@ index e73389b..15cfe83 100644 @@ -26,12 +26,12 @@ index e73389b..15cfe83 100644
+ == indirect_branch_thunk_extern)
+ ? "thunk-extern" : "thunk"));
}

if (cfun->machine->function_return_type == indirect_branch_unset)
@@ -4659,6 +4672,19 @@ ix86_set_indirect_branch_type (tree fndecl)
}
}
else
cfun->machine->function_return_type = ix86_function_return;
cfun->machine->function_return_type = ix86_function_return;
+
+ /* -mcmodel=large is not compatible with -mfunction-return=thunk
+ nor -mfunction-return=thunk-extern. */
@ -47,7 +47,7 @@ index e73389b..15cfe83 100644 @@ -47,7 +47,7 @@ index e73389b..15cfe83 100644
+ ? "thunk-extern" : "thunk"));
}
}

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 4a365c7..7b33803 100644
--- a/gcc/doc/invoke.texi
@ -55,7 +55,7 @@ index 4a365c7..7b33803 100644 @@ -55,7 +55,7 @@ index 4a365c7..7b33803 100644
@@ -14659,6 +14659,11 @@ to external call and return thunk provided in a separate object file.
You can control this behavior for a specific function by using the
function attribute @code{indirect_branch}. @xref{Function Attributes}.

+Note that @option{-mcmodel=large} is incompatible with
+@option{-mindirect-branch=thunk} nor
+@option{-mindirect-branch=thunk-extern} since the thunk function may
@ -67,7 +67,7 @@ index 4a365c7..7b33803 100644 @@ -67,7 +67,7 @@ index 4a365c7..7b33803 100644
@@ -14670,6 +14675,11 @@ object file. You can control this behavior for a specific function by
using the function attribute @code{function_return}.
@xref{Function Attributes}.

+Note that @option{-mcmodel=large} is incompatible with
+@option{-mfunction-return=thunk} nor
+@option{-mfunction-return=thunk-extern} since the thunk function may

38
SOURCES/gcc48-rh1537828-1.patch

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
2018-04-10 Segher Boessenkool <segher@kernel.crashing.org>

PR target/85287
* gcc/config/rs6000/rs6000.md (allocate_stack): Put the residual size
for stack clash protection in a register whenever we need it to be in
a register.


--- a/gcc/config/rs6000/rs6000.md 2018/04/10 21:09:30 259298
+++ b/gcc/config/rs6000/rs6000.md 2018/04/10 21:37:34 259299
@@ -9783,14 +9783,12 @@
/* Now handle residuals. We just have to set operands[1] correctly
and let the rest of the expander run. */
operands[1] = residual;
- if (!CONST_INT_P (residual))
- operands[1] = force_reg (Pmode, operands[1]);
}
- if (GET_CODE (operands[1]) != CONST_INT
- || INTVAL (operands[1]) < -32767
- || INTVAL (operands[1]) > 32768)
+ if (!(CONST_INT_P (operands[1])
+ && IN_RANGE (INTVAL (operands[1]), -32767, 32768)))
{
+ operands[1] = force_reg (Pmode, operands[1]);
neg_op0 = gen_reg_rtx (Pmode);
if (TARGET_32BIT)
emit_insn (gen_negsi2 (neg_op0, operands[1]));
@@ -9798,7 +9796,7 @@
emit_insn (gen_negdi2 (neg_op0, operands[1]));
}
else
- neg_op0 = GEN_INT (- INTVAL (operands[1]));
+ neg_op0 = GEN_INT (-INTVAL (operands[1]));
insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
: gen_movdi_di_update_stack))

91
SOURCES/gcc48-rh1537828-10.patch

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
diff --git a/gcc/testsuite/gcc.dg/stack-check-5.c b/gcc/testsuite/gcc.dg/stack-check-5.c
index 850e023ea4e..604fa3cf6c5 100644
--- a/gcc/testsuite/gcc.dg/stack-check-5.c
+++ b/gcc/testsuite/gcc.dg/stack-check-5.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
-/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */
/* Otherwise the S/390 back-end might save the stack pointer in f2 ()
diff --git a/gcc/testsuite/gcc.dg/stack-check-6.c b/gcc/testsuite/gcc.dg/stack-check-6.c
index ab4b0e8894c..fe75612b737 100644
--- a/gcc/testsuite/gcc.dg/stack-check-6.c
+++ b/gcc/testsuite/gcc.dg/stack-check-6.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
-/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */
extern void foo (char *);
diff --git a/gcc/testsuite/gcc.dg/stack-check-6a.c b/gcc/testsuite/gcc.dg/stack-check-6a.c
index 468d649a4fa..8fb9c621585 100644
--- a/gcc/testsuite/gcc.dg/stack-check-6a.c
+++ b/gcc/testsuite/gcc.dg/stack-check-6a.c
@@ -4,7 +4,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=16" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
-/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */
#include "stack-check-6.c"
diff --git a/gcc/testsuite/gcc.target/i386/stack-check-11.c b/gcc/testsuite/gcc.target/i386/stack-check-11.c
index fe5b2c2b844..43a291857b6 100644
--- a/gcc/testsuite/gcc.target/i386/stack-check-11.c
+++ b/gcc/testsuite/gcc.target/i386/stack-check-11.c
@@ -1,6 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstack-clash-protection" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */
+
#include <stdint.h>
diff --git a/gcc/testsuite/gcc.target/i386/stack-check-17.c b/gcc/testsuite/gcc.target/i386/stack-check-17.c
index dcd29305a2c..da6ea016815 100644
--- a/gcc/testsuite/gcc.target/i386/stack-check-17.c
+++ b/gcc/testsuite/gcc.target/i386/stack-check-17.c
@@ -1,6 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fomit-frame-pointer" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */
+
int x0, x1;
diff --git a/gcc/testsuite/gcc.target/i386/stack-check-18.c b/gcc/testsuite/gcc.target/i386/stack-check-18.c
index 1638f776267..1cf4bbcfafb 100644
--- a/gcc/testsuite/gcc.target/i386/stack-check-18.c
+++ b/gcc/testsuite/gcc.target/i386/stack-check-18.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fdump-rtl-expand" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
-/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */
int f1 (char *);
diff --git a/gcc/testsuite/gcc.target/i386/stack-check-19.c b/gcc/testsuite/gcc.target/i386/stack-check-19.c
index c341801189c..49f3a20af8b 100644
--- a/gcc/testsuite/gcc.target/i386/stack-check-19.c
+++ b/gcc/testsuite/gcc.target/i386/stack-check-19.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fdump-rtl-expand" } */
/* { dg-require-effective-target supports_stack_clash_protection } */
-/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */
int f1 (char *);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save