[LLVMdev] How to use clang -intergrated-as to compile cross-(os/target) assembly file.

Reid Kleckner rnk at google.com
Wed Oct 23 09:43:05 PDT 2013


Use the flags "-x assembler-with-cpp" to force clang to think it needs
preprocessing.  That should work with gcc.


On Tue, Oct 22, 2013 at 10:42 PM, 罗勇刚(Yonggang Luo)
<luoyonggang at gmail.com>wrote:

>
>
>
> 2013/10/23 Rafael Espíndola <rafael.espindola at gmail.com>
>
>> > Sorry for the  unclear statements, I didn't means the assembler to
>> mangle
>> > symbols declared in assembly source files, I means directly use assembly
>> > directive to choice which symbol should be used. The compiler just need
>> to
>> > follow the directive.
>> > For example, in assembly files, there is a directive
>> > https://sourceware.org/binutils/docs-2.23.1/as/If.html#If
>> > to act like C macro #ifdef #if, so i wanna to know how to use this
>> directive
>> > to detect if it's target to x86/win32. if that's true, then I can
>> control
>> > which code to be generate.
>> >>
>>
>>
>> I don't think there is anything in plain .s files. In .S files you can
>> use any of the C predefined macros, in particular,
>> __USER_LABEL_PREFIX__ might be what you want.
>>
> Thanks, Rafael, this is acceptable if GCC/binutils also support for this,
> I want to keep compatible with GCC/binutils,
> besides, is there any command option to force use C predefined macros?
> because use .S is too tricky.
>
>>
>> Cheers,
>> Rafael
>>
>
>
>
> --
>          此致
>> 罗勇刚
> Yours
>     sincerely,
> Yonggang Luo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131023/5190056c/attachment.html>


More information about the llvm-dev mailing list