Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-devel/gcc-apple/files: gcc-apple-4.2.1_p5666-darwin14.patch
Date: Sat, 31 Jan 2015 16:15:28
Message-Id: 20150131161523.AA24810C4E@oystercatcher.gentoo.org
1 grobian 15/01/31 16:15:23
2
3 Modified: gcc-apple-4.2.1_p5666-darwin14.patch
4 Log:
5 Update darwin14 patch with much better approach by Michael Weisner, not revbumping because darwin14 bootstrapping should be broken anyway
6
7 (Portage version: 2.2.14-prefix/cvs/SunOS i386, signed Manifest commit with key 0x5F75F607C5C74E89)
8
9 Revision Changes Path
10 1.3 sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch?rev=1.3&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch?rev=1.3&content-type=text/plain
14 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch?r1=1.2&r2=1.3
15
16 Index: gcc-apple-4.2.1_p5666-darwin14.patch
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch,v
19 retrieving revision 1.2
20 retrieving revision 1.3
21 diff -u -r1.2 -r1.3
22 --- gcc-apple-4.2.1_p5666-darwin14.patch 21 Oct 2014 18:55:02 -0000 1.2
23 +++ gcc-apple-4.2.1_p5666-darwin14.patch 31 Jan 2015 16:15:23 -0000 1.3
24 @@ -1,43 +1,16 @@
25 -Darwin 14 is 10.10, but the encoding scheme doesn't allow this, so
26 -encode everything from Darwin 14 and up as 10.9.
27 +https://537826.bugs.gentoo.org/attachment.cgi?id=394896
28 +https://bugs.gentoo.org/show_bug.cgi?id=537826
29 +Michael Weiser
30
31 -Darwin 14 has some newer preprocessor stuff in its headers, work around
32 -that.
33 +Backport of https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=218873 (as
34 +per https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407) to correctly encode Mac
35 +OS X versions >10.9 into __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__.
36 +Extended to also encode patch level the way clang and Apple GCC 4.2.1 do.
37 +
38 +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 has a much more generic
39 +patch. But it's not yet in-tree pending legal paperwork. Once that's done, we
40 +can backport that.
41
42 ---- gcc/config/darwin-c.c
43 -+++ gcc/config/darwin-c.c
44 -@@ -945,6 +945,11 @@
45 - result[2] = darwin_macosx_version_min[3];
46 - if (darwin_macosx_version_min[4] != '\0')
47 - {
48 -+ if (ISDIGIT(darwin_macosx_version_min[4]))
49 -+ {
50 -+ result[2] = '9'; /* latest version we can encode */
51 -+ result[3] = '0';
52 -+ } else {
53 - if (darwin_macosx_version_min[4] != '.')
54 - goto fail;
55 - if (! ISDIGIT (darwin_macosx_version_min[5]))
56 -@@ -952,6 +956,7 @@
57 - if (darwin_macosx_version_min[6] != '\0')
58 - goto fail;
59 - result[3] = darwin_macosx_version_min[5];
60 -+ }
61 - }
62 - else
63 - result[3] = '0';
64 ---- gcc/config/darwin-driver.c
65 -+++ gcc/config/darwin-driver.c
66 -@@ -174,8 +174,8 @@
67 - version_p = osversion + 1;
68 - if (ISDIGIT (*version_p))
69 - major_vers = major_vers * 10 + (*version_p++ - '0');
70 - if (major_vers > 4 + 9)
71 -- goto parse_failed;
72 -+ major_vers = 4 + 9;
73 - if (*version_p++ != '.')
74 - goto parse_failed;
75 - version_pend = strchr(version_p, '.');
76 --- gcc/libgcov.c
77 +++ gcc/libgcov.c
78 @@ -34,6 +34,14 @@
79 @@ -55,3 +28,121 @@
80 /* APPLE LOCAL begin instant off 6414141 */
81 #if defined(__APPLE__) && !defined(__STATIC__) && !defined(__ppc__) && !defined(__ppc64__) && !defined(__arm__)
82 #include <vproc.h>
83 +--- gcc/config/darwin-driver.c.orig 2010-10-14 22:27:53.000000000 +0200
84 ++++ gcc/config/darwin-driver.c 2015-01-25 21:15:09.000000000 +0100
85 +@@ -174,8 +174,6 @@
86 + version_p = osversion + 1;
87 + if (ISDIGIT (*version_p))
88 + major_vers = major_vers * 10 + (*version_p++ - '0');
89 +- if (major_vers > 4 + 9)
90 +- goto parse_failed;
91 + if (*version_p++ != '.')
92 + goto parse_failed;
93 + version_pend = strchr(version_p, '.');
94 +--- gcc/config/darwin-c.c.orig 2015-01-25 19:44:40.000000000 +0100
95 ++++ gcc/config/darwin-c.c 2015-01-25 21:05:47.000000000 +0100
96 +@@ -930,31 +930,91 @@
97 +
98 + /* Return the value of darwin_macosx_version_min suitable for the
99 + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
100 +- so '10.4.2' becomes 1042.
101 ++ so '10.4.2' becomes 1042 and '10.10.2' becomes 101002.
102 ++ Cap patch level to 9 in the old format.
103 + Print a warning if the version number is not known. */
104 + static const char *
105 + /* APPLE LOCAL ARM 5683689 */
106 + macosx_version_as_macro (void)
107 + {
108 +- static char result[] = "1000";
109 ++ static char result[7] = "1000";
110 ++ int inputindex = 3, outputindex = 2;
111 +
112 ++ /* make sure version starts with "10." - makes sure we can safely start
113 ++ * parsing at inputindex == 3 */
114 + if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
115 + goto fail;
116 ++
117 ++ /* first character of minor version needs to be digit */
118 + if (! ISDIGIT (darwin_macosx_version_min[3]))
119 + goto fail;
120 +- result[2] = darwin_macosx_version_min[3];
121 +- if (darwin_macosx_version_min[4] != '\0')
122 ++
123 ++ result[outputindex++] = darwin_macosx_version_min[inputindex++];
124 ++
125 ++ if (ISDIGIT (darwin_macosx_version_min[inputindex])) {
126 ++ /* Starting with OS X 10.10, the macro ends '00' rather than '0',
127 ++ i.e. 10.10.x becomes 101000 rather than 10100. */
128 ++ result[outputindex++] = darwin_macosx_version_min[inputindex++];
129 ++ result[4] = '0';
130 ++ result[5] = '0';
131 ++ result[6] = '\0';
132 ++ }
133 ++
134 ++ /* if we're out of input, leave patch level at 0 or 00 and finish */
135 ++ if (darwin_macosx_version_min[inputindex] == '\0')
136 ++ return result;
137 ++
138 ++ /* a dot *must* follow now */
139 ++ if (darwin_macosx_version_min[inputindex++] != '.')
140 ++ goto fail;
141 ++
142 ++ /* a digit must follow after the dot */
143 ++ if (! ISDIGIT (darwin_macosx_version_min[inputindex]))
144 ++ goto fail;
145 ++
146 ++ /* old-style macro */
147 ++ if (outputindex == 3)
148 ++ {
149 ++ /* one-digit patch level */
150 ++ if (darwin_macosx_version_min[inputindex + 1] == '\0')
151 + {
152 +- if (darwin_macosx_version_min[4] != '.')
153 +- goto fail;
154 +- if (! ISDIGIT (darwin_macosx_version_min[5]))
155 +- goto fail;
156 +- if (darwin_macosx_version_min[6] != '\0')
157 +- goto fail;
158 +- result[3] = darwin_macosx_version_min[5];
159 ++ result[outputindex] = darwin_macosx_version_min[inputindex];
160 ++ return result;
161 + }
162 +- else
163 +- result[3] = '0';
164 ++
165 ++ inputindex++;
166 ++ if (! ISDIGIT (darwin_macosx_version_min[inputindex++]))
167 ++ goto fail;
168 ++
169 ++ /* three digits? */
170 ++ if (darwin_macosx_version_min[inputindex] != '\0')
171 ++ goto fail;
172 ++
173 ++ /* no room for another digit. Traditional Apple GCC 4.2.1 doesn't accept
174 ++ * it but current clang caps it to 9. We choose to be in line with clang. */
175 ++ result[outputindex] = '9';
176 ++ return result;
177 ++ }
178 ++
179 ++ /* new-style macro */
180 ++
181 ++ /* leave a leading zero if only one digit is following */
182 ++ if (darwin_macosx_version_min[inputindex + 1] == '\0') {
183 ++ result[outputindex + 1] = darwin_macosx_version_min[inputindex];
184 ++ return result;
185 ++ }
186 ++
187 ++ result[outputindex++] = darwin_macosx_version_min[inputindex++];
188 ++
189 ++ /* a digit must follow now */
190 ++ if (! ISDIGIT (darwin_macosx_version_min[inputindex]))
191 ++ goto fail;
192 ++
193 ++ result[outputindex] = darwin_macosx_version_min[inputindex++];
194 ++
195 ++ /* no more input allowed */
196 ++ if (darwin_macosx_version_min[inputindex] != '\0')
197 ++ goto fail;
198 +
199 + return result;
200 +