Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
Date: Sun, 05 Sep 2021 10:49:24
Message-Id: 1630837796.ccbf773bca3510785a1c6655c77f5d457ded43af.grobian@gentoo
1 commit: ccbf773bca3510785a1c6655c77f5d457ded43af
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 5 10:29:56 2021 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 5 10:29:56 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ccbf773b
7
8 sys-devel/gcc-10.2.0-r5: add patch for Xcode 12.5
9
10 Closes: https://bugs.gentoo.org/799170
11 Package-Manager: Portage-3.0.21-prefix, Repoman-3.0.3
12 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
13
14 sys-devel/gcc/files/gcc-10.2.0-xcode-12.5.patch | 147 ++++++++++++++++++++++++
15 sys-devel/gcc/gcc-10.2.0-r5.ebuild | 3 +
16 2 files changed, 150 insertions(+)
17
18 diff --git a/sys-devel/gcc/files/gcc-10.2.0-xcode-12.5.patch b/sys-devel/gcc/files/gcc-10.2.0-xcode-12.5.patch
19 new file mode 100644
20 index 0000000000..f8b6b04232
21 --- /dev/null
22 +++ b/sys-devel/gcc/files/gcc-10.2.0-xcode-12.5.patch
23 @@ -0,0 +1,147 @@
24 +From 743b8dd6fd757e997eb060d70fd4ae8e04fb56cd Mon Sep 17 00:00:00 2001
25 +From: Iain Sandoe <iain@×××××××××.uk>
26 +Date: Sat, 31 Jul 2021 16:29:03 +0100
27 +Subject: [PATCH 1/1] Darwin, X86, config: Adjust 'as' command lines
28 + [PR100340].
29 +
30 +Versions of the assembler using clang from XCode 12.5/12.5.1
31 +have a bug which produces different code layout between debug and
32 +non-debug input, leading to a compare fail for default configure
33 +parameters.
34 +
35 +This is a workaround fix to disable the optimisation that is
36 +responsible for the bug.
37 +
38 +Signed-off-by: Iain Sandoe <iain@×××××××××.uk>
39 +
40 +PR target/100340 - Bootstrap fails with Clang 12.0.5 (XCode 12.5)
41 +
42 + PR target/100340
43 +
44 +gcc/ChangeLog:
45 +
46 + * config.in: Regenerate.
47 + * config/i386/darwin.h (EXTRA_ASM_OPTS): New
48 + (ASM_SPEC): Pass options to disable branch shortening where
49 + needed.
50 + * configure: Regenerate.
51 + * configure.ac: Detect versions of 'as' that support the
52 + optimisation which has the bug.
53 +---
54 + gcc/config.in | 7 +++++++
55 + gcc/config/i386/darwin.h | 10 +++++++++-
56 + gcc/configure | 35 +++++++++++++++++++++++++++++++++++
57 + gcc/configure.ac | 9 +++++++++
58 + 4 files changed, 60 insertions(+), 1 deletion(-)
59 +
60 +diff --git a/gcc/config.in b/gcc/config.in
61 +index 7f5b01fad76..d8a810bbc91 100644
62 +--- a/gcc/config.in
63 ++++ b/gcc/config.in
64 +@@ -616,6 +616,13 @@
65 + #endif
66 +
67 +
68 ++/* Define if your Mac OS X assembler supports -mllvm -x86-pad-for-align=false.
69 ++ */
70 ++#ifndef USED_FOR_TARGET
71 ++#undef HAVE_AS_MLLVM_X86_PAD_FOR_ALIGN
72 ++#endif
73 ++
74 ++
75 + /* Define if your Mac OS X assembler supports the -mmacos-version-min option.
76 + */
77 + #ifndef USED_FOR_TARGET
78 +diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
79 +index bac32197e83..73b06e2307d 100644
80 +--- a/gcc/config/i386/darwin.h
81 ++++ b/gcc/config/i386/darwin.h
82 +@@ -125,10 +125,18 @@ along with GCC; see the file COPYING3. If not see
83 + %{mfentry*:%eDarwin does not support -mfentry or associated options}" \
84 + DARWIN_CC1_SPEC
85 +
86 ++/* This is a workaround for a tool bug: see PR100340. */
87 ++
88 ++#ifdef HAVE_AS_MLLVM_X86_PAD_FOR_ALIGN
89 ++#define EXTRA_ASM_OPTS " -mllvm -x86-pad-for-align=false"
90 ++#else
91 ++#define EXTRA_ASM_OPTS ""
92 ++#endif
93 ++
94 + #undef ASM_SPEC
95 + #define ASM_SPEC "-arch %(darwin_arch) \
96 + " ASM_OPTIONS " -force_cpusubtype_ALL \
97 +- %{static}" ASM_MMACOSX_VERSION_MIN_SPEC
98 ++ %{static}" ASM_MMACOSX_VERSION_MIN_SPEC EXTRA_ASM_OPTS
99 +
100 + #undef ENDFILE_SPEC
101 + #define ENDFILE_SPEC \
102 +diff --git a/gcc/configure b/gcc/configure
103 +index 08c286764e0..a2d1003a0f5 100755
104 +--- a/gcc/configure
105 ++++ b/gcc/configure
106 +@@ -27082,6 +27082,41 @@ $as_echo "$as_me: WARNING: LTO for $target requires binutils >= 2.20.1, but vers
107 + fi
108 + ;;
109 + esac
110 ++ case $target_os in
111 ++ darwin2[0-9]* | darwin19*)
112 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for llvm assembler x86-pad-for-align option" >&5
113 ++$as_echo_n "checking assembler for llvm assembler x86-pad-for-align option... " >&6; }
114 ++if ${gcc_cv_as_mllvm_x86_pad_for_align+:} false; then :
115 ++ $as_echo_n "(cached) " >&6
116 ++else
117 ++ gcc_cv_as_mllvm_x86_pad_for_align=no
118 ++ if test x$gcc_cv_as != x; then
119 ++ $as_echo '.text' > conftest.s
120 ++ if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mllvm -x86-pad-for-align=false -o conftest.o conftest.s >&5'
121 ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
122 ++ (eval $ac_try) 2>&5
123 ++ ac_status=$?
124 ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
125 ++ test $ac_status = 0; }; }
126 ++ then
127 ++ gcc_cv_as_mllvm_x86_pad_for_align=yes
128 ++ else
129 ++ echo "configure: failed program was" >&5
130 ++ cat conftest.s >&5
131 ++ fi
132 ++ rm -f conftest.o conftest.s
133 ++ fi
134 ++fi
135 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_mllvm_x86_pad_for_align" >&5
136 ++$as_echo "$gcc_cv_as_mllvm_x86_pad_for_align" >&6; }
137 ++if test $gcc_cv_as_mllvm_x86_pad_for_align = yes; then
138 ++
139 ++$as_echo "#define HAVE_AS_MLLVM_X86_PAD_FOR_ALIGN 1" >>confdefs.h
140 ++
141 ++fi
142 ++
143 ++ ;;
144 ++ esac
145 +
146 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -xbrace_comment" >&5
147 + $as_echo_n "checking assembler for -xbrace_comment... " >&6; }
148 +diff --git a/gcc/configure.ac b/gcc/configure.ac
149 +index 653a1cc561d..ad8fa5a4604 100644
150 +--- a/gcc/configure.ac
151 ++++ b/gcc/configure.ac
152 +@@ -4799,6 +4799,15 @@ foo: nop
153 + fi
154 + ;;
155 + esac
156 ++ case $target_os in
157 ++ darwin2[[0-9]]* | darwin19*)
158 ++ gcc_GAS_CHECK_FEATURE([llvm assembler x86-pad-for-align option],
159 ++ gcc_cv_as_mllvm_x86_pad_for_align,,
160 ++ [-mllvm -x86-pad-for-align=false], [.text],,
161 ++ [AC_DEFINE(HAVE_AS_MLLVM_X86_PAD_FOR_ALIGN, 1,
162 ++ [Define if your Mac OS X assembler supports -mllvm -x86-pad-for-align=false.])])
163 ++ ;;
164 ++ esac
165 +
166 + gcc_GAS_CHECK_FEATURE([-xbrace_comment], gcc_cv_as_ix86_xbrace_comment,,
167 + [-xbrace_comment=no], [.text],,
168 +--
169 +2.27.0
170 +
171
172 diff --git a/sys-devel/gcc/gcc-10.2.0-r5.ebuild b/sys-devel/gcc/gcc-10.2.0-r5.ebuild
173 index f146759e09..9baac7c2d6 100644
174 --- a/sys-devel/gcc/gcc-10.2.0-r5.ebuild
175 +++ b/sys-devel/gcc/gcc-10.2.0-r5.ebuild
176 @@ -53,6 +53,9 @@ src_prepare() {
177 find . -name "configure" | xargs \
178 sed -i -e '/^\s*10\.\*)/N' \
179 -e '/^\s*10\.\*)\s*_lt_dar_allow_undefined/s/10\.\*/10.*|11.*/' || die
180 +
181 + # fix interoperation with Xcode 12.5, bug #799170
182 + eapply -p1 "${FILESDIR}"/${PN}-10.2.0-xcode-12.5.patch
183 }
184
185 src_configure() {