[LLVMdev] linker_private* linkage
reed kotler
rkotler at mips.com
Thu Jun 7 14:19:38 PDT 2012
On 06/07/2012 09:49 AM, Nuno Lopes wrote:
> Hi,
>
> I'm trying to understand better how linker_private (and friends) work.
> From what I can understand from the manual
> (http://llvm.org/docs/LangRef.html#linkage_linker_private), it seems
> that a linker_private function cannot be removed by the optimizers.
> Only the linker can discard the symbol. However, I tested with 'opt
> -O1' and a function with *no users* is removed. Same thing happens
> with the other linker_private_* linkage types.
>
> Is my reading of the documentation correct (i.e., is this a bug in LLVM)?
>
> Thanks,
> Nuno
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
The point behind private symbols for a linker is usually so that people
cannot disassemble or in some other way misuse the final image that you
create.
I don't think this has anything to do with the optimizer.
So after the shared object or executable is created, you can't find
anymore, by name, where the code or data for that symbol resides.
In the case of shared objects, it means that you cannot write code that
does a dllopen and tries to find the entrypoint by name.
More information about the llvm-dev
mailing list