在一些项目中,我明确地没有链接到 libgcc,因此缺少了一些东西。
在某些情况下,这可能会导致函数 undefined reference 失败,例如在指定 -Os
优化时 __gnu_thumb1_case_uqi
。
如何防止 gcc 在编译期间发出这些函数?
最佳答案
你可以试试:
-fno-builtin -fno-builtin-function
Don’t recognize built-in functions that do not begin with ‘
__builtin_
’ as prefix. See Other built-in functions provided by GCC, for details of the functions affected, including those which are not built-in functions when-ansi
or-std
options for strict ISO C conformance are used because they do not have an ISO standard meaning.<子> GCC Online Docs
但是,如果您的 #include
头文件包含扩展为对 GCC 内置函数的调用的宏,那么您只能通过不包含这些头文件来阻止它。如果您不链接标准库,您可能也不想从标准头文件中包含。
关于c - 是否可以将编译期间发出的某些内置函数列入黑名单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46415376/