-
Notifications
You must be signed in to change notification settings - Fork 17
zz note: assembler bug on OS X
David Jeske edited this page May 5, 2017
·
1 revision
With about 8000 local symbols, the compiler is triggering a problem with the assembler that ships with Xcode. Luckily, the sources are available here: http://www.opensource.apple.com/tarballs/cctools/ For some reason this function is iterating repeatedly through ~175,000 entries.
The GNU tools I'm sure are deprecated at Apple, so a better approach is to just use clang.
--- cctools-800/as/i386.orig.c 1969-12-31 16:00:00.000000000 -0800
+++ cctools-800/as/i386.c 2011-05-24 14:35:22.000000000 -0700
@@ -6093,6 +6093,7 @@
x86_64_resolve_local_symbol(symbolS *sym)
{
symbolS *prev_symbol;
+ symbolS *answer;
if(sym->sy_has_been_resolved)
return(sym->sy_prev_resolved);
@@ -6113,9 +6114,29 @@
}
}
}
- sym->sy_prev_resolved = prev_symbol;
+ answer = prev_symbol;
+ sym->sy_prev_resolved = answer;
sym->sy_has_been_resolved =1;
- return prev_symbol;
+
+ /* loop through again, pointing *all* locals at the resolved symbol. */
+ for (prev_symbol = sym->sy_prev_by_index; prev_symbol != NULL; prev_symbol = prev_symbol->sy_prev_by_index)
+ {
+ if ((prev_symbol->sy_type & N_SECT) == N_SECT &&
+ (prev_symbol->sy_type & N_STAB) == 0 &&
+ prev_symbol->sy_other == sym->sy_other)
+ {
+ if (!is_local_symbol(prev_symbol))
+ {
+ /* Found our non-local symbol. */
+ break;
+ } else {
+ prev_symbol->sy_prev_resolved = answer;
+ prev_symbol->sy_has_been_resolved = 1;
+ }
+ }
+ }
+
+ return answer;
}
int32_t
After compiling, backup and replace thus:
$ cp ax86_64_dir/as /usr/libexec/gcc/darwin/x86_64/as