[PATCH] Pass -I flags to the integrated assembler

David Peixotto dpeixott at codeaurora.org
Tue Nov 12 13:03:32 PST 2013


 
> On Tue, Nov 12, 2013 at 11:49:03AM -0800, David Peixotto wrote:
> > This patch changes the way that clang builds the integrated assembler
> > job to pass all -I arguments down to the integrated assembler. These
> > arguments are needed by the assembler to correctly process '.include'
> > directives.
> 

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.

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).

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"






More information about the cfe-commits mailing list