[PATCH] Forward #pragma comment(lib/linker) through as flags metadata

Reid Kleckner rnk at google.com
Mon May 6 13:09:06 PDT 2013


OK, I sent an updated patch that moves /defaultlib into TargetCodeGenInfo.

Adding Daniel if he has any thoughts, since this was basically his
autolinking RFC.

After sending, I also see some unecessary cruft in the diff that I
need to remove...

On Tue, Apr 30, 2013 at 3:37 PM, Robinson, Paul
<Paul_Robinson at playstation.sony.com> wrote:
> Per your request in the email chain on the LLVM part...
>
> In ActOnPragmaMSComment you embed "/DEFAULTLIB:" in the linker options.
> This should be in a target-sensitive hook so it can easily be made to
> work for other toolchains.  While Microsoft defined these pragmas,
> they can be useful on other platforms.
>
> Whether you handle this as new named metadata that totally imitates
> the old deplibs (so the target stuff is done in LLVM) or handle it
> in a target-dependent way in Clang, either way can work.
>
> Thanks,
> --paulr
>
>> -----Original Message-----
>> From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-
>> bounces at cs.uiuc.edu] On Behalf Of Reid Kleckner
>> Sent: Wednesday, April 24, 2013 1:31 PM
>> To: rnk at google.com
>> Cc: cfe-commits at cs.uiuc.edu
>> Subject: [PATCH] Forward #pragma comment(lib/linker) through as flags
>> metadata
>>
>> Most of this change is wiring the pragma all the way through from the
>> lexer, parser, and sema to codegen.  I considered adding a Decl AST node
>> for this, but it seemed too heavyweight.
>>
>> Mach-O already uses a metadata flag called "Linker Options" to do this
>> kind of auto-linking.  This change follows that pattern.
>>
>> The MC layer change to forward the metadata into the .drectve section is
>> forthcoming.
>>
>> This is related to auto-linking, which is http://llvm.org/PR13016.
>>
>> http://llvm-reviews.chandlerc.com/D723
>>
>> Files:
>>   include/clang/AST/ASTConsumer.h
>>   include/clang/Basic/PragmaKinds.h
>>   include/clang/Basic/TokenKinds.def
>>   include/clang/Parse/Parser.h
>>   include/clang/Sema/Sema.h
>>   lib/CodeGen/CodeGenAction.cpp
>>   lib/CodeGen/CodeGenModule.cpp
>>   lib/CodeGen/CodeGenModule.h
>>   lib/CodeGen/ModuleBuilder.cpp
>>   lib/Lex/Lexer.cpp
>>   lib/Lex/Pragma.cpp
>>   lib/Parse/ParsePragma.cpp
>>   lib/Parse/Parser.cpp
>>   lib/Sema/SemaAttr.cpp
>>   test/CodeGen/pragma-comment.c



More information about the cfe-commits mailing list