[distcc] patch: -Wa,-xarch=v8 incorrectly not distributed
Ben Scarlet
bscarlet at endeca.com
Mon Jan 26 17:00:52 GMT 2004
On Sunday, January 25, 2004 6:46 PM, Martin Pool [mailto:mbp at sourcefrog.net]
wrote
>
>On 23 Jan 2004, Ben Scarlet <bscarlet at endeca.com> wrote:
>> The following patch makes the processing of arguments passed through to
the
>> assembler slightly less conservative. When compiling 32-bit sparc code
with
>> gcc-2.95.3, it is sometimes necessary to tweak assembler's notion of the
>> architecture to allow for the use of some fancier instructions. (e.g. -
the
>> atomic operation instructions used in implementing reference counting in
>> some multithread-safe implementations of the c++ class std::string). One
way
>> to get the appropriate information to the compiler is to use the flag
>> -Wa,-xarch=v8. As of distcc version 2.12.1, this flag would erroneously
>> cause distcc to refuse to distribute a compilation, because that version
>> takes a very simplistic approach to detecting another assembler flag,
>> -Wa,-al=foo. The following patch improves the detection of the "-al" flag
>> just slightly, so as to let compiles without it but still with an '=' in
an
>> assembler flag get distributed.
>
>The basic idea is OK, but I think the implementation is still too
>likely to guess wrong if there happens to be another -al in the
>option.
>
>Since the gcc manual says the option is split at the commas then I
>think we need to look for something like the regexp ,-al[=,]
I was aiming for minimal change, but if you'd prefer something more correct:
Reading the info page for gnu as, actually any "-a...=foo" flag would behave
similarly to -al=foo:
Here's a new patch:
diff -rc distcc-2.12.1/src/arg.c distcc-2.12.1-new/src/arg.c
*** distcc-2.12.1/src/arg.c Wed Oct 8 01:41:49 2003
--- distcc-2.12.1-new/src/arg.c Mon Jan 26 11:53:10 2004
***************
*** 173,187 ****
return EXIT_DISTCC_FAILED;
} else if (str_startswith("-Wa,", a)) {
/* Options passed through to the assembler. The only one
we
! * need to handle so far is -al=output, which directs the
! * listing to the named file and cannot be remote.
Parsing
! * all the options would be complex since you can give
several
! * comma-separated assembler options after -Wa, but
looking
! * for '=' should be safe. */
! if (strchr(a, '=')) {
! rs_trace("%s needs to write out assembly listings and
must be local",
! a);
! return EXIT_DISTCC_FAILED;
}
} else if (!strcmp(a, "-S")) {
seen_opt_s = 1;
--- 173,197 ----
return EXIT_DISTCC_FAILED;
} else if (str_startswith("-Wa,", a)) {
/* Options passed through to the assembler. The only one
we
! * need to handle so far is -a with a filename, which
directs the
! * listing to the named file and cannot be remote. */
! const char *scan = a;
!
! for(;;) {
! /* find the next "-a" flag. if none is found, quit
looking */
! if (!(scan = strstr(scan, ",-a"))) break;
!
! /* find the start of the next argument or a filename,
! whichever comes first. If none is found, there's no
filename
! and nothing more to do, so quit looking */
! if (!(scan = strpbrk(scan + 3,",="))) break;
!
! /* found a filename, not another argument, so run
locally */
! if (*scan == '=') {
! rs_trace("%s needs to write out assembly listings
and must be local",
! a);
! return EXIT_DISTCC_FAILED;
! }
}
} else if (!strcmp(a, "-S")) {
seen_opt_s = 1;
More information about the distcc
mailing list