[llvm-commits] [llvm-gcc-4.2] r56386 - /llvm-gcc-4.2/trunk/gcc/config/darwin.c
Bill Wendling
isanbard at gmail.com
Sat Sep 20 02:58:11 PDT 2008
Author: void
Date: Sat Sep 20 04:58:10 2008
New Revision: 56386
URL: http://llvm.org/viewvc/llvm-project?rev=56386&view=rev
Log:
Fix a segfault. If we had a version string like "i386-apple-darwin9.5.0", then
this would return a non-zero value, but wouldn't fill the "new_triple" variable
which is then used to make a string. I don't know if this fix is 100% correct.
That is, I don't know if it catches all cases.
Modified:
llvm-gcc-4.2/trunk/gcc/config/darwin.c
Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=56386&r1=56385&r2=56386&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Sat Sep 20 04:58:10 2008
@@ -2672,19 +2672,21 @@
}
/* APPLE LOCAL end radar 4985544 */
-/* APPLE LOCAL begin radar 6230142 */
+/* LLVM LOCAL begin radar 6230142 */
unsigned darwin_llvm_override_target_version(const char *triple, char **new_triple) {
int len = 0, version = 0;
if (!darwin_macosx_version_min)
return 0;
- /* Triple string is expected to look something like 'i386-apple-darwin?'. */
+ /* Triple string is expected to look something like 'i386-apple-darwin?' or
+ 'i386-apple-darwin9.5.0' */
len = strlen (triple);
if (len < 7)
return 0;
- if (strncmp (&triple[len - 7], "darwin", 6) != 0)
- return (char *)triple;
+ if ((strncmp (&triple[len - 7], "darwin", 6) != 0) &&
+ (len < 11 || strncmp (&triple[len - 11], "darwin", 6) != 0))
+ return 0;
/* llvm-gcc doesn't support pre-10.0 systems. */
version = strverscmp (darwin_macosx_version_min, "10.0");
@@ -2709,5 +2711,5 @@
return 1;
}
-/* APPLE LOCAL end radar 6230142 */
+/* LLVM LOCAL end radar 6230142 */
#include "gt-darwin.h"
More information about the llvm-commits
mailing list