[英]g++ inlining failed in call to always_inline "int _rdrand16_step()"
我使用英特爾函數_rdrand16_step()
編寫了一個代碼,在 Windows(Visual Studio 2017)上運行良好,但在 Linux(g++)上我無法讓它工作。 我在代碼中調用了該函數 2 次:
#include <immintrin.h>
...
unsigned short val = 0;
if (_rdrand16_step(&val))
...
_rdrand16_step(&val);
...
和 g++ 輸出這個:
/usr/lib/gcc/x86_64-linux-gnu/8/include/immintrin.h: In member function ‘int otp_s7c::crypt(std::__cxx11::string, std::__cxx11::string, long long unsigned int)’:
/usr/lib/gcc/x86_64-linux-gnu/8/include/immintrin.h:129:1: error: inlining failed in call to always_inline ‘int _rdrand16_step(short unsigned int*)’: target specific option mismatch
_rdrand16_step (unsigned short *__P)
^~~~~~~~~~~~~~
otp_s7c.cpp:139:24: note: called from here
if (_rdrand16_step(&val))
~~~~~~~~~~~~~~^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/8/include/immintrin.h:129:1: error: inlining failed in call to always_inline ‘int _rdrand16_step(short unsigned int*)’: target specific option mismatch
_rdrand16_step (unsigned short *__P)
^~~~~~~~~~~~~~
otp_s7c.cpp:148:23: note: called from here
_rdrand16_step(&val);
~~~~~~~~~~~~~~^~~~~~
一周前我在cmake
遇到了同樣的問題。 但是當添加以下命令時,這個問題就消失了。
SET(CMAKE_C_FLAGS "-mrdrnd")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.