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

Robinson, Paul Paul_Robinson at playstation.sony.com
Tue Apr 30 12:37:17 PDT 2013


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