[PATCH] Pass -I flags to the integrated assembler

David Peixotto dpeixott at codeaurora.org
Thu Nov 14 09:58:50 PST 2013


I have attached a new patch that passes -I args to the integrated assembler
when used with -Wa,-I or -Xassembler -I.

After looking at the code a little more, I can see that when we use gcc to
assemble a file, the -I args are passed down based on forwardToGCC (see
gcc::Common::ConstructJob). My second patch (which is basically the original
patch I sent) changes clang to also pass -I args to the integrated
assembler.

I did not change the behavior when assembling with the system assembler. The
-I args will only be passed to the system assembler when using -Wa,-I. I
think this is the right thing to do. Looking at all the differnt systems
that invoke the assembler:

$ grep ::Assemble::ConstructJob lib/Driver/Tools.cpp 
void hexagon::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void darwin::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void solaris::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void auroraux::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void openbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void bitrig::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void netbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void gnutools::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void minix::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void dragonfly::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
void XCore::Assemble::ConstructJob(Compilation &C, const JobAction &JA,

I am not sure that it makes sense to pass -I on all these systems, because
the assembler might not accept that argument.

With these patches the behavior for -I args will be:

1. Pass '-I', '-Wa,-I', and '-Xassembler -I' down to gcc when assembling
(current behavior)
2. Pass '-I', '-Wa,-I', and '-Xassembler -I' down to integrated assember
when assembling (new behavior)
3. Pass '-Wa,-I', and '-Xassembler -I' to the system assembler (current
behavior)

Please help to review these patches.

-David

> -----Original Message-----
> From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-
> bounces at cs.uiuc.edu] On Behalf Of Rafael EspĂ­ndola
> Sent: Tuesday, November 12, 2013 3:38 PM
> To: llvm cfe
> Subject: Re: [PATCH] Pass -I flags to the integrated assembler
> 
> >> It seems from limited experimentation by Rafael and myself that GCC
> >> implements #3. What should we implement for clang?
> >
> > Only in recent versions. My earlier question still stands -- what is
> > the precendence. I wouldn't expect -I to be honoured, but I wouldn't
> > expect something like .include to exist in the assembler either :)
> 
> It was added in gcc in r127275 (Aug 7, 2007).
> 
> The patch email is
> http://gcc.gnu.org/ml/gcc-patches/2007-08/msg00069.html, so it does look
> intentional and would probably be reasonable for clang to do the same.
> 
> Cheers,
> Rafael
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Pass-Wa-I-and-Xassembler-I-args-to-integrated-assemb.patch
Type: application/octet-stream
Size: 3824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131114/a4f999ae/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Pass-I-flags-to-the-integrated-assembler.patch
Type: application/octet-stream
Size: 2245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131114/a4f999ae/attachment-0001.obj>


More information about the cfe-commits mailing list