[llvmlinux] [GSoC: Static analysis] Report 1 + PATCH
Jan-Simon Möller
dl9pf at gmx.de
Wed Jun 26 17:36:03 UTC 2013
Hi !!
See my comment inline!
On Wednesday 26 June 2013 19:29:37 Eduard Bachmakov wrote:
> Alright after tons of tinkering I came up with the following conclusions.
>
> 1. I can't confirm if this is arm specific or just non-x64 because
> every other arch failed to compile for me.
> 2. It is not an issue with environment or make variables.
> 3. There is no compilation issue, it's just the analysis run that
> fails (that was clear before but know it's definite)
> 4. The offending line is in here:
>
> '/home/e/llvmlinux/toolchain/clang/install/bin/clang-3.4' '-cc1'
> '-triple' 'x86_64-unknown-linux-gnu' '-analyze' '-disable-free'
^^^^^^^^^^^^^^^^^^^^^^^^^^
The triple setting is for x86_64 (probably your host arch).
Later we ask for -target-cpu armv7-a (which does not exist on x86_64).
> '-disable-llvm-verifier' '-main-file-name' 'bounds.c'
> '-analyzer-store=region' '-analyzer-opt-analyze-nested-blocks'
> '-analyzer-eagerly-assume' '-analyzer-checker=core'
> '-analyzer-checker=unix' '-analyzer-checker=deadcode'
> '-analyzer-checker=security.insecureAPI.UncheckedReturn'
> '-analyzer-checker=security.insecureAPI.getpw'
> '-analyzer-checker=security.insecureAPI.gets'
> '-analyzer-checker=security.insecureAPI.mktemp'
> '-analyzer-checker=security.insecureAPI.mkstemp'
> '-analyzer-checker=security.insecureAPI.vfork' '-analyzer-output'
> 'plist' '-w' '-mrelocation-model' 'static' '-mdisable-fp-elim'
> '-fmath-errno' '-masm-verbose' '-mconstructor-aliases'
> '-munwind-tables' '-fuse-init-array' '-no-implicit-float'
> '-target-cpu' 'armv7-a' '-nostdsysteminc' '-nobuiltininc'
> '-resource-dir'
> '/home/e/llvmlinux/toolchain/clang/install/bin/../lib/clang/3.4'
> '-isystem'
> '/home/e/llvmlinux/toolchain/clang/install/bin/../lib/clang/3.4/include'
> '-include'
> '/home/e/llvmlinux/targets/vexpress/src/linux/include/linux/kconfig.h' '-D'
> '__KERNEL__' '-D' '__LINUX_ARM_ARCH__=7' '-D' 'KBUILD_STR(s)=#s' '-D'
> 'KBUILD_BASENAME=KBUILD_STR(bounds)' '-D'
> 'KBUILD_MODNAME=KBUILD_STR(bounds)' '-I'
> '/home/e/llvmlinux/targets/vexpress/src/linux/arch/arm/include' '-I'
> 'arch/arm/include/generated' '-I' 'include' '-I'
> '/home/e/llvmlinux/targets/vexpress/src/linux/arch/arm/include/uapi'
> '-I' 'arch/arm/include/generated/uapi' '-I'
> '/home/e/llvmlinux/targets/vexpress/src/linux/include/uapi' '-I'
> 'include/generated/uapi' '-Wno-trigraphs' '-Wno-format-security'
> '-Wno-asm-operand-widths' '-Wno-unused-variable'
> '-Wno-format-invalid-specifier' '-Wno-tautological-compare'
> '-Wno-pointer-sign' '-fdebug-compilation-dir'
> '/home/e/llvmlinux/targets/vexpress/src/linux' '-ferror-limit' '19'
> '-fmessage-length' '0' '-mstackrealign' '-fno-builtin'
> '-fobjc-runtime=gcc' '-fobjc-default-synthesize-properties'
> '-fdiagnostics-show-option' '-backend-option' '-vectorize-loops'
> '-analyzer-display-progress' '-analyzer-output=html' '-o'
> '/home/e/llvmlinux/targets/vexpress/tmp/scan-build-2013-06-26-6' '-x'
> 'c' 'kernel/bounds.c'
>
> In particular, '-target-cpu' 'armv7-a' doesn't work. I'm not sure how
> target-cpu works so I started guessing things like armv7 or arm but
> that didn't work either. According to clang -cc1 -help, target-cpu
> seems to be the only thing to have an influence on target architecture
> (with -cc1 -arch or -march or -mtune don't seem to be supported). I
> did a few tests with clang -### and it turns out that -march=xyz is
> translated to -target-cpu xyz .
>
> A quick test on my host clang 3.3 I getting the same issue for a
> trivial test like "clang -march=armv7-a bla.c", which surprises me
> since we're using -march for the actual built
>
> My current guess is that '-triple' 'x86_64-unknown-linux-gnu' might
> be the real reason behind the problem because ...
>
> clang -\#\#\# -target arm-none-linux-gnueabi bla.c
> includes "-triple" "armv4t-none-linux-gnueabi" and "-target-cpu" "arm7tdmi"
>
> and it compiles on my system (doesn't assemble but that's another issue)
>
> ... does anyone know how targets/triples are defined? Or what they're
> really called so I can search for docs online?
>
> On Wed, Jun 26, 2013 at 10:24 AM, Jan-Simon Möller <dl9pf at gmx.de> wrote:
> > Comments inline ...
> > --
> >
> > Dipl.-Ing.
> > Jan-Simon Möller
> >
> > jansimon.moeller at gmx.de
> >
> > On Monday 24 June 2013 20:57:00 Eduard Bachmakov wrote:
> >> Hey everyone,
> >>
> >> After what felt like a million do-overs I think I found a workable
> >> location for the integration of clang-analyzer. See patch below.
> >>
> >> The GOOD: x64 works. How?
> >>
> >> cd targets/x86_64; make kernel-scan-build; scan-view <watch end of
> >>
> >> output, last line before time statistics>
> >>
> >> The BAD: Should work for other targets, however, it seems some flags
> >> aren't passed down in cases of cross-compilation, I'm ironing that
> >> out. Feel free to try though!
> >
> > Check:
> > ccc-analyzer ~ line 693 . Seems like "@Archs" is empty in the ARM case
> > and
> > thus we don't set it properly (and seem like to default to x86).
> >
> >> The UGLY: takes forever. However, JSM might donate a stripped down
> >> .config soon. That would speed things up a bit.
> >
> > Best,
> > JS
More information about the LLVMLinux
mailing list