Michael Spencer
2010-Sep-18 17:18 UTC
[LLVMdev] Where to emit an undefined fltused symbol if floating point is used?
While working on porting the large test-suite over to lit and running it on Windows I've discovered a major problem with COFF emission. Any test that uses floating point instructions currently fails with the integrated assembler with: runtime error R6002 - floating point support not loaded A quick look with nm shows that MSVC emits an undefined __fltused symbol if _any_ floating point instructions are used. I think this is required for the kernel to save the floating point registers, and thus the Microsoft C runtime complains if you use floating point without __fltused. The attached code duplicates this failure when compiled with (on Windows): % clang -O3 2002-05-02-ArgumentTest.c % 2002-05-02-ArgumentTest.exe The attached code works when compiled as: % clang -O3 -c SingleSource\UnitTests\2002-05-02-ArgumentTest.c % link 2002-05-02-ArgumentTest.o libcmt.lib -include:__fltused % 2002-05-02-ArgumentTest.exe 12, 1.245000, 120, 123456677890, -10, 4500000000000000.000000 My question is where should the code that emits this symbol live? I would assume someplace in the x86 codegen in case the optimizers are somehow able to remove the instructions. And I would prefer someplace before COFF emission. The last, and slightly embarrassing question, is exactly how do you add the symbol? I looked around at the API's but couldn't figure out an easy way to simply add an undefined symbol. Thanks! - Michael Spencer -------------- next part -------------- A non-text attachment was scrubbed... Name: 2002-05-02-ArgumentTest.ll Type: application/octet-stream Size: 1057 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100918/f0df9ba8/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: 2002-05-02-ArgumentTest.s Type: application/octet-stream Size: 1350 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100918/f0df9ba8/attachment-0001.obj>