This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] 如果 math.h 包含在多个源文件中、TI-CGT-armlvm_1.3.0.LTS 可以报告重新定义的符号错误、具体取决于-std 选项

Guru**** 2589265 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1003391/ti-cgt-armllvm_1-3-0-lts-can-report-report-symbol-redefined-errors-if-math-h-included-in-multiple-source-files-depending-on--std-option

主题中讨论的其他器件:TMS570LC4357

随附的示例工程包含两个 C 源文件、其中包括 ,但不要实际使用 math.h 中的任何定义 使用 ti-cgt-armllvm_1.3.0LTS 编译时、这可能会导致链接器报告看起来是内联函数的符号重新定义错误 。 例如:

**** Build of configuration Debug for project TMS570LC4357_TI_CLANG_math_h ****

/home/mr_halfword/ti/ccs1030/ccs/utils/bin/gmake -k -j 12 all -O 
 
Building file: "../main.c"
Invoking: Arm Compiler
"/home/mr_halfword/ti/ccs1030/ccs/tools/compiler/ti-cgt-armllvm_1.3.0.LTS/bin/tiarmclang" -c -mcpu=cortex-r5 -mbig-endian -O0 -I"/home/mr_halfword/workspace_v10/TMS570LC4357_TI_CLANG_math_h" -I"/home/mr_halfword/ti/ccs1030/ccs/tools/compiler/ti-cgt-armllvm_1.3.0.LTS/include" -save-temps -gstrict-dwarf -gdwarf-3 -MMD -MP -MF"main.d_raw" -MT"main.o" -std=c89  -o"main.o" "../main.c"
Finished building: "../main.c"
 
Building file: "../test_func.c"
Invoking: Arm Compiler
"/home/mr_halfword/ti/ccs1030/ccs/tools/compiler/ti-cgt-armllvm_1.3.0.LTS/bin/tiarmclang" -c -mcpu=cortex-r5 -mbig-endian -O0 -I"/home/mr_halfword/workspace_v10/TMS570LC4357_TI_CLANG_math_h" -I"/home/mr_halfword/ti/ccs1030/ccs/tools/compiler/ti-cgt-armllvm_1.3.0.LTS/include" -save-temps -gstrict-dwarf -gdwarf-3 -MMD -MP -MF"test_func.d_raw" -MT"test_func.o" -std=c89  -o"test_func.o" "../test_func.c"
Finished building: "../test_func.c"
 
Building target: "TMS570LC4357_TI_CLANG_math_h.out"
Invoking: Arm Linker
"/home/mr_halfword/ti/ccs1030/ccs/tools/compiler/ti-cgt-armllvm_1.3.0.LTS/bin/tiarmclang" -mcpu=cortex-r5 -mbig-endian -O0 -save-temps -gstrict-dwarf -gdwarf-3 -Wl,-m"TMS570LC4357_TI_CLANG_math_h.map" -Wl,-i"/home/mr_halfword/ti/ccs1030/ccs/tools/compiler/ti-cgt-armllvm_1.3.0.LTS/lib" -Wl,--reread_libs -Wl,--diag_wrap=off -Wl,--display_error_number -Wl,--warn_sections -Wl,--xml_link_info="TMS570LC4357_TI_CLANG_math_h_linkInfo.xml" -Wl,--rom_model -Wl,--be32 -o "TMS570LC4357_TI_CLANG_math_h.out" "./main.o" "./test_func.o"  
makefile:138: recipe for target 'TMS570LC4357_TI_CLANG_math_h.out' failed
error #10056: symbol "__fpclassify" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__fpclassifyf" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__fpclassifyl" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isfinite" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isfinitef" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isfinitel" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isinf" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isinff" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isinfl" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isnan" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isnanf" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isnanl" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isnormal" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isnormalf" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__isnormall" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__signbit" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__signbitf" redefined: first defined in "./main.o"; redefined in "./test_func.o"
error #10056: symbol "__signbitl" redefined: first defined in "./main.o"; redefined in "./test_func.o"
warning #10247-D: creating output section ".text" without a SECTIONS specification
warning #10247-D: creating output section ".stack" without a SECTIONS specification
warning #10210-D: creating ".stack" section with default size of 0x800; use the -stack option to change the default size
error #10010: errors encountered during linking; "TMS570LC4357_TI_CLANG_math_h.out" not built
tiarmclang: error: tiarmlnk command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [TMS570LC4357_TI_CLANG_math_h.out] Error 1
gmake: *** [all] Error 2
makefile:134: recipe for target 'all' failed

**** Build Finished ****

经调查后、错误会对所使用的"Select s以为 的 C 语言标准(-std)"选项敏感。

std 的以下值会导致重新定义符号的错误:

  • C89
  • C90
  • Gnu90

std 的以下值 允许示例无 误地链接:

  • C99
  • c9x
  • 问题11.
  • c1x
  • C17.
  • C18.
  • c2x
  • Gnu9x
  • Gnu11.
  • Gnu17
  • Gnu18
  • Gnu2x

这是否是 ti-cgt-armllvm_1.3.0.LTS 的运行时库中的错误?

e2e.ti.com/.../TMS570LC4357_5F00_TI_5F00_CLANG_5F00_math_5F00_h.zip

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您将此问题通知我们、并提供一个简洁的测试案例。  我可以重现相同的行为。  我提交了 EXT_EP-10367条目  以进行调查。  欢迎您访问该链接。

    谢谢、此致、

    乔治