linux-test-project / ltp

Linux Test Project (mailing list: https://lists.linux.it/listinfo/ltp)
https://linux-test-project.readthedocs.io/
GNU General Public License v2.0
2.28k stars 999 forks source link

The presence of "emmintrin.h" shouldn't be used for x86 detection. #980

Closed ilyakurdyukov closed 1 year ago

ilyakurdyukov commented 1 year ago

testcases/cve/meltdown.c:

#ifdef HAVE_EMMINTRIN_H
#include <emmintrin.h>

And below this ifdef is the assembly code for x86/x86_64.

But emmintrin.h may exist for some non-x86 platforms (such as e2k) as an emulation of Intel SIMD intrinsics. So there's a compilation error here.

metan-ucw commented 1 year ago

Good catch, I had quick look into gcc sources and it looks like there is emulation for Power ISA as well.

I guess that the code should be ifdefed with #if defined(HAVE_EMMINTRIN_H) && (defined(__x86_64__) || defined(__i386__))

Will you send a patch to the LTP mailing list?

ilyakurdyukov commented 1 year ago

Don't want to figure out how to send a patch to the mailing list. Please accept this pull request or submit it yourself (I don't care about the patch authorship).