C++ pic Vs pie 的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16023637/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between pic Vs pie
提问by Vineet1982
I am looking the options for Binary Encryption Code generation and found two options available that are PIC and PIE. I have tried for find the differences between both but didn't find suitable articles. If anybody can explain the difference with example with pros and corn or provide the link to the good article would be great to learn.
我正在寻找二进制加密代码生成的选项,并找到了两个可用的选项,即 PIC 和 PIE。我试图找到两者之间的差异,但没有找到合适的文章。如果有人可以用专业人士和玉米的例子来解释差异,或者提供指向好文章的链接,那将非常值得学习。
My basic motive is to protect the compiled code as ELF/PE format can be attacked by virus or it can be hacked or with the help of reverse techniques can re-produce code. Kindly also provide any other means for protection of compiled code from attacks and d-compling.
我的基本动机是保护编译后的代码,因为 ELF/PE 格式可能会受到病毒的攻击,也可能会被黑客入侵,或者借助逆向技术可以重新生成代码。还请提供任何其他保护编译代码免受攻击和 d-compling 的方法。
I am using GCC Compiler through Cygwin for building cross platform application.
我正在通过 Cygwin 使用 GCC 编译器来构建跨平台应用程序。
采纳答案by Carl Norum
From the gcc documentation:
从gcc 文档:
-fpic
Generate position-independent code (PIC) suitable for use in a shared library...
-fpie
These options are similar to -fpic and -fPIC, but generated position independent code can be only linked into executables....
-fpic
生成适用于共享库的位置无关代码 (PIC)...
-fpie
这些选项类似于 -fpic 和 -fPIC,但生成的位置无关代码只能链接到可执行文件中....