[PATCH] Pass -I flags to the integrated assembler
Rafael EspĂndola
rafael.espindola at gmail.com
Tue Nov 12 14:27:07 PST 2013
> Rafael asked,
>> We should pass it to non integrated assemblers too, no?
>
> It seems that sometimes it does get passed to non-integrated assemblers.
> From what I can tell it seems to depend on passing -target.
>
> $ clang -c test/ias.s -Ifoo_dir -no-integrated-as -### 2>&1 | grep -- -I
>
> clang: warning: argument unused during compilation: '-I foo_dir'
>
> $ clang -c test/ias.s -Ifoo_dir -no-integrated-as -target x86 -### 2>&1 |
> grep -- -I
> "/usr/bin/gcc" "-I" "foo_dir" "-c" "-o" "ias.o" "-x" "assembler"
> "test/ias.s"
>
> Currently, clang will not pass on to the integrated assembler even when
> passing -target.
>
> $ clang -c test/ias.s -Ifoo_dir -integrated-as -target x86 -### 2>&1 |
> grep -- -I
> clang: warning: argument unused during compilation: '-I foo_dir'
>
> I'm not sure if this behavior is by design.
Looks like a bug. It is passing it only when it is using gcc as the
assembler, not running as directly.
> Joerg asked,
>> What's the precedent for this? I would expect -I options to only affect
>> the *C* preprocessor. -Wa can be used for assembler specific options.
>
> Hmm, yes I'm see two different behaviors with different gcc versions on my
> system. One gcc (4.4.3) does not pass on -I to as, but another version does
> (4.6.1).
Yes, it looks like it is a new "feature" in gcc. I see the same with 4.8.1.
> It looks like -Wa,-Ifoo is not supported by current clang:
>
> $ clang -c test/ias.s -Ifoo_dir -integrated-as -target x86 -Wa,-I -###
> 2>&1 | grep -- -I
> clang: error: unsupported argument '-I' to option 'Wa,'
>
> But it does get passed to the non-integrated assembler:
>
> $ ./bin/clang.sh -c test/ias.s -Ifoo_dir -no-integrated-as -target x86
> -Wa,-I -### 2>&1 | grep -- -I
> "/usr/bin/gcc" "-I" "foo_dir" "-Wa,-I" "-c" "-o" "ias.o" "-I" "-x"
> "assembler" "test/ias.s"
That is probably an independent bug.
In any case, if passing -I to the integrated assembler, please make
sure we also pass it to the external one.
Cheers,
Rafael
More information about the cfe-commits
mailing list