[llvm-commits] [llvm] r154645 - /llvm/trunk/lib/Transforms/IPO/Internalize.cpp

Nick Lewycky nicholas at mxc.ca
Thu Apr 12 22:30:17 PDT 2012


Bill Wendling wrote:
> Author: void
> Date: Thu Apr 12 20:06:27 2012
> New Revision: 154645
>
> URL: http://llvm.org/viewvc/llvm-project?rev=154645&view=rev
> Log:
> Code-gen may inject code into the IR before it emits the ASM. The linker
> obviously cannot know that this code is present, let alone used. So prevent the
> internalize pass from internalizing those global values which code-gen may
> insert.

This is a problem for other functions too, what about them? Could you 
use TargetLibraryInfo? If not, the best place would probably be an API 
to the backend. Anyhow, please move this to libLTO's 
applyScopeRestrictions at least. It doesn't belong here.

Nick

>
> Modified:
>      llvm/trunk/lib/Transforms/IPO/Internalize.cpp
>
> Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Internalize.cpp?rev=154645&r1=154644&r2=154645&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/IPO/Internalize.cpp (original)
> +++ llvm/trunk/lib/Transforms/IPO/Internalize.cpp Thu Apr 12 20:06:27 2012
> @@ -122,6 +122,9 @@
>
>     bool Changed = false;
>
> +  // Never internalize functions which code-gen might insert.
> +  ExternalNames.insert("__stack_chk_fail");
> +
>     // Mark all functions not in the api as internal.
>     // FIXME: maybe use private linkage?
>     for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
> @@ -150,6 +153,9 @@
>     ExternalNames.insert("llvm.global_dtors");
>     ExternalNames.insert("llvm.global.annotations");
>
> +  // Never internalize symbols code-gen inserts.
> +  ExternalNames.insert("__stack_chk_guard");
> +
>     // Mark all global variables with initializers that are not in the api as
>     // internal as well.
>     // FIXME: maybe use private linkage?
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list