我遇到此错误消息:“regparm”在此平台上无效

kev*_*999 6 llvm clang

我的构建和主机平台是 X86_64 和 suse Linux。我的目标平台是arm-linux-gnueabi。我用版本 3.6.0 的 clang 编译源代码。编译器使用 -target = arm-linux-gnueabi 运行 我失败了,并显示以下信息

/usr/include/pthread.h:655:6: error: 'regparm' is not valid on this platform
     __cleanup_fct_attribute;
     ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/bits/pthreadtypes.h:222:50: note: expanded from macro '__cleanup_fct_attribute'
# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
                                                 ^            ~
Run Code Online (Sandbox Code Playgroud)

有什么问题吗?

Ant*_*kov 2

你的问题是什么?'regparm' 是仅限 x86 的属性,因此编译器在这里是正确的,并且您的代码已损坏。很可能您没有使用适合您的目标平台的正确标头。

  • ...你是如何解决这个问题的? (3认同)