[llvm-bugs] [Bug 36427] New: clang-cl doesn't respect -Xclang -fno-builtin

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 18 09:18:38 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36427

            Bug ID: 36427
           Summary: clang-cl doesn't respect -Xclang -fno-builtin
           Product: clang
           Version: 5.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: wjk011 at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19891
  --> https://bugs.llvm.org/attachment.cgi?id=19891&action=edit
Repro case for bug

Try to compile the file rot.c (attached to this bug). It redefines several
built-in functions, so by default, Clang will emit errors stating as such.
However, these functions must be compiled as defined in this file to avoid
linker errors later. (This file comes from ReactOS,
<https://github.com/reactos/reactos>, which must maintain compatibility with
many different compilers other than just clang.) Therefore, I use the
-fno-builtin flag to suppress builtin functions, as well as this error.

If I execute the following command, clang compiles the file correctly:
    clang -target i386-pc-mingw32 -fno-builtin -c rot.c

If I execute the equivalent clang-cl invocation however, -fno-builtin appears
to be ignored, and the redefinition-of-builtin error appears:
    clang-cl -Xclang -fno-builtin /c rot.c

However, adding the -v flag to clang-cl (the full output of which is included
below) reveals that -fno-builtin is correctly passed to clang -cc1. As I
understand it, the behavior should be identical whether I pass -fno-builtin to
regular clang, or by using the -Xclang flag to clang-cl.

If there is anything else you would need to help fix this, please just let me
know. Thanks!

=== output of clang-cl -v ===
clang version 5.0.1 (tags/RELEASE_501/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
 "/usr/local/Cellar/llvm/5.0.1/bin/clang-5.0" -cc1 -triple
x86_64-pc-windows-msvc18.0.0 -emit-obj -mrelax-all
-mincremental-linker-compatible -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name rot.c -mrelocation-model pic -pic-level 2
-mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -D_MT
-flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames
-stack-protector 2 -fms-volatile -fdiagnostics-format msvc
-target-linker-version 305 -momit-leaf-frame-pointer -v -dwarf-column-info
-debugger-tuning=gdb -coverage-notes-file /Users/wjk/rot.gcno -resource-dir
/usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1 -internal-isystem
/usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/include -fdebug-compilation-dir
/Users/wjk -ferror-limit 19 -fmessage-length 0 -fms-extensions
-fms-compatibility -fms-compatibility-version=18 -fno-threadsafe-statics
-fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option
-fno-builtin -o rot.obj -x c /tmp/rot.c
clang -cc1 version 5.0.1 based upon LLVM 5.0.1 default target
x86_64-apple-darwin17.4.0
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Cellar/llvm/5.0.1/lib/clang/5.0.1/include
End of search list.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180218/b8a40b57/attachment.html>


More information about the llvm-bugs mailing list