Clang accepts x86 specific options when cross compiling for arm

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Clang accepts x86 specific options when cross compiling for arm

Sumner, Brian via cfe-dev
Hi

I am compiling a package which pokes at compiler for -msse4.2 option and
if compiler accepts it then it happily adds the intel specific
intrinsics to code path. This works fine in cross compile environment
with gcc since gcc when configure for cross compiling for arm targets
rejects this option however with clang, configured for multiple targets

LLVM_TARGETS_TO_BUILD = "AArch64;ARM;Mips;PowerPC;X86"

it happily accepts -msse4.2 when called to cross compile for arm.

arm-bec-linux-gnueabi-clang -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard
-mcpu=cortex-a7 -mlittle-endian -march=armv7a
--sysroot=/mnt/a/oe/build/tmp/work/cortexa7t2hf-neon-vfpv4-bec-linux-gnueabi/leveldb/1.20+gitAUTOINC+a53934a3ae-r0/recipe-sysroot
 -O2 -msse4.2
clang-5.0: error: no input files

I believe it would be better if clang could cross check for target
options and error out and flag these kind of incompatible combinations

may be there is already an option to do so, I would be happy to know
since this would fix my issue once for all.

Thanks
-Khem


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (169 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang accepts x86 specific options when cross compiling for arm

Sumner, Brian via cfe-dev
You should have gotten an "argument unused during compilation" warning that you can promote to an error.

~Craig

On Wed, Jul 26, 2017 at 5:41 PM, Khem Raj via cfe-dev <[hidden email]> wrote:
Hi

I am compiling a package which pokes at compiler for -msse4.2 option and
if compiler accepts it then it happily adds the intel specific
intrinsics to code path. This works fine in cross compile environment
with gcc since gcc when configure for cross compiling for arm targets
rejects this option however with clang, configured for multiple targets

LLVM_TARGETS_TO_BUILD = "AArch64;ARM;Mips;PowerPC;X86"

it happily accepts -msse4.2 when called to cross compile for arm.

arm-bec-linux-gnueabi-clang -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard
-mcpu=cortex-a7 -mlittle-endian -march=armv7a
--sysroot=/mnt/a/oe/build/tmp/work/cortexa7t2hf-neon-vfpv4-bec-linux-gnueabi/leveldb/1.20+gitAUTOINC+a53934a3ae-r0/recipe-sysroot
 -O2 -msse4.2
clang-5.0: error: no input files

I believe it would be better if clang could cross check for target
options and error out and flag these kind of incompatible combinations

may be there is already an option to do so, I would be happy to know
since this would fix my issue once for all.

Thanks
-Khem


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang accepts x86 specific options when cross compiling for arm

Sumner, Brian via cfe-dev
Though not having an input file is probably a fatal error that suppresses any other warnings/errors from printing.

~Craig

On Wed, Jul 26, 2017 at 6:13 PM, Craig Topper <[hidden email]> wrote:
You should have gotten an "argument unused during compilation" warning that you can promote to an error.

~Craig

On Wed, Jul 26, 2017 at 5:41 PM, Khem Raj via cfe-dev <[hidden email]> wrote:
Hi

I am compiling a package which pokes at compiler for -msse4.2 option and
if compiler accepts it then it happily adds the intel specific
intrinsics to code path. This works fine in cross compile environment
with gcc since gcc when configure for cross compiling for arm targets
rejects this option however with clang, configured for multiple targets

LLVM_TARGETS_TO_BUILD = "AArch64;ARM;Mips;PowerPC;X86"

it happily accepts -msse4.2 when called to cross compile for arm.

arm-bec-linux-gnueabi-clang -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard
-mcpu=cortex-a7 -mlittle-endian -march=armv7a
--sysroot=/mnt/a/oe/build/tmp/work/cortexa7t2hf-neon-vfpv4-bec-linux-gnueabi/leveldb/1.20+gitAUTOINC+a53934a3ae-r0/recipe-sysroot
 -O2 -msse4.2
clang-5.0: error: no input files

I believe it would be better if clang could cross check for target
options and error out and flag these kind of incompatible combinations

may be there is already an option to do so, I would be happy to know
since this would fix my issue once for all.

Thanks
-Khem


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang accepts x86 specific options when cross compiling for arm

Sumner, Brian via cfe-dev


On 7/26/17 6:14 PM, Craig Topper wrote:
> Though not having an input file is probably a fatal error that
> suppresses any other warnings/errors from printing.

input file is there in original test, I did not add it to the example
I quoted. Relying on unused argument might be useful here, only if
there are no other arguments which appear in same cmdline and are unused
thinks like linker cmds are sometimes added to cflags.

But in short it would be preferable to have same behavior as gcc here
since there are many packages doing this sort of stuff, not that thats
the best way to check for SSE support.

>
> ~Craig
>
> On Wed, Jul 26, 2017 at 6:13 PM, Craig Topper <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     You should have gotten an "argument unused during compilation"
>     warning that you can promote to an error.
>
>     ~Craig
>
>     On Wed, Jul 26, 2017 at 5:41 PM, Khem Raj via cfe-dev
>     <[hidden email] <mailto:[hidden email]>> wrote:
>
>         Hi
>
>         I am compiling a package which pokes at compiler for -msse4.2
>         option and
>         if compiler accepts it then it happily adds the intel specific
>         intrinsics to code path. This works fine in cross compile
>         environment
>         with gcc since gcc when configure for cross compiling for arm
>         targets
>         rejects this option however with clang, configured for multiple
>         targets
>
>         LLVM_TARGETS_TO_BUILD = "AArch64;ARM;Mips;PowerPC;X86"
>
>         it happily accepts -msse4.2 when called to cross compile for arm.
>
>         arm-bec-linux-gnueabi-clang -mthumb -mfpu=neon-vfpv4
>         -mfloat-abi=hard
>         -mcpu=cortex-a7 -mlittle-endian -march=armv7a
>         --sysroot=/mnt/a/oe/build/tmp/work/cortexa7t2hf-neon-vfpv4-bec-linux-gnueabi/leveldb/1.20+gitAUTOINC+a53934a3ae-r0/recipe-sysroot
>          -O2 -msse4.2
>         clang-5.0: error: no input files
>
>         I believe it would be better if clang could cross check for target
>         options and error out and flag these kind of incompatible
>         combinations
>
>         may be there is already an option to do so, I would be happy to know
>         since this would fix my issue once for all.
>
>         Thanks
>         -Khem
>
>
>         _______________________________________________
>         cfe-dev mailing list
>         [hidden email] <mailto:[hidden email]>
>         http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>         <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>
>
>

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (169 bytes) Download Attachment
Loading...