GLibc optimizations required

大憨熊 提交于 2019-12-10 15:26:31

问题


Why is it not possible recompile GLibc turning off all the optimizations (i.e., -O0)?

Particularly in doing this:

make CFLAGS='-O0 -w' CXXFLAGS='-O0 -w'

I get:

 #error "glibc cannot be compiled without optimization"

回答1:


When I Google the error, the first result tells me exactly why.

"In the early startup of the dynamic loader (_dl_start), before relocation of the PLT, you cannot make function calls. You must inline the functions you will use during early startup, or call compiler builtins (__builtin_*).

Without optimizations enabled GCC will not inline functions. The early startup of the dynamic loader will make function calls via an unrelocated PLT and crash." -- Carlos O'Donell




回答2:


Basically: "glibc is voodoo!" This one "library of all libraries" has a very special place in any system, because virtually(?) everything else in the entire system relies upon it.

Therefore, if "someone out there" took the time to prevent you from compiling this library "without optimizations," I cordially invite you to take him/her at their word. "There must be a [very good] reason."



来源:https://stackoverflow.com/questions/30089652/glibc-optimizations-required

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!