我如何使用自定义汇编器为clang?

时间:2022-12-27 12:13:11

I've compiled clang to use it as a cross compiler for ARM (by configuring it with ./configure --target=armv7l-unknown-linux-gnueabihf ), but when I try to compile any C code, it tries to use /usr/bin/as. I already have binutils compiled for ARM, and they are in a separate directory. How do I direct clang (or llvm) to use the assembler that I specify?

我已经编译了clang,将它用作ARM的交叉编译器(通过配置./configure——target=armv7l-unknown-linux-gnueabihf),但是当我试图编译任何C代码时,它都会尝试使用/usr/bin/ asf。我已经为ARM编译了binutils,它们位于一个单独的目录中。如何指示clang(或llvm)使用我指定的汇编程序?

2 个解决方案

#1


2  

try passing the --host option to configure which will cause all the cc ar etc utilities to prefix with armv7l-unknown-linux-gnueabihf- eg:

尝试传递-host选项来配置它,这会导致所有cc ar等实用程序前缀为armv7l-unknown-linux-gnueabihf—例如:

./configure --host=armv7l-unknown-linux-gnueabihf --build=i686-unknown-linux-gnu

Since you are using configure with hopefully autotools take a look at: automake Cross compiling

由于您正在使用配置,希望自动工具可以查看:自动交叉编译。

#2


0  

I've always had trouble configuring from the source directory using ./configure and gave up in the end. These days I always configure from a separate directory i.e. ..//configure although I'm told it's recommended to use an absolute path for configure.

我总是在使用./configure从源目录进行配置时遇到麻烦,最后放弃了。这些天我总是在一个单独的目录中配置。//configure,尽管我被告知建议使用绝对路径进行配置。

Your ARM binutils should be installed in the same prefix you're using for clang and make sure that they're in the path when you configure & build clang - i.e. PATH=/some/prefix/bin:$PATH; /configure --target=armv7l-unknown-linux-gnueabihf. If you're keeping them in separate directories for packaging purposes then make install DESTDIR= should help.

您的ARM binutils应该安装在您用于clang的前缀中,并确保在配置和构建clang时它们位于路径中—即path =/some/prefix/bin:$ path;= armv7l-unknown-linux-gnueabihf /配置——目标。如果为了打包目的而将它们保存在单独的目录中,那么让install DESTDIR=应该会有所帮助。

I don't generally build clang but the buildscripts I use for devkitARM might be helpful - http://sourceforge.net/p/devkitpro/buildscripts/ci/c372699fc7b4de90eb044314ce5bed04db640291/tree/

我一般不构建clang,但是我为devkitARM使用的构建脚本可能会有帮助——http://sourceforge.net/p/devkitpro/buildscripts/ci/c372699fc7b4b4de90eb044314ce5bed0db640291/tree/

#1


2  

try passing the --host option to configure which will cause all the cc ar etc utilities to prefix with armv7l-unknown-linux-gnueabihf- eg:

尝试传递-host选项来配置它,这会导致所有cc ar等实用程序前缀为armv7l-unknown-linux-gnueabihf—例如:

./configure --host=armv7l-unknown-linux-gnueabihf --build=i686-unknown-linux-gnu

Since you are using configure with hopefully autotools take a look at: automake Cross compiling

由于您正在使用配置,希望自动工具可以查看:自动交叉编译。

#2


0  

I've always had trouble configuring from the source directory using ./configure and gave up in the end. These days I always configure from a separate directory i.e. ..//configure although I'm told it's recommended to use an absolute path for configure.

我总是在使用./configure从源目录进行配置时遇到麻烦,最后放弃了。这些天我总是在一个单独的目录中配置。//configure,尽管我被告知建议使用绝对路径进行配置。

Your ARM binutils should be installed in the same prefix you're using for clang and make sure that they're in the path when you configure & build clang - i.e. PATH=/some/prefix/bin:$PATH; /configure --target=armv7l-unknown-linux-gnueabihf. If you're keeping them in separate directories for packaging purposes then make install DESTDIR= should help.

您的ARM binutils应该安装在您用于clang的前缀中,并确保在配置和构建clang时它们位于路径中—即path =/some/prefix/bin:$ path;= armv7l-unknown-linux-gnueabihf /配置——目标。如果为了打包目的而将它们保存在单独的目录中,那么让install DESTDIR=应该会有所帮助。

I don't generally build clang but the buildscripts I use for devkitARM might be helpful - http://sourceforge.net/p/devkitpro/buildscripts/ci/c372699fc7b4de90eb044314ce5bed04db640291/tree/

我一般不构建clang,但是我为devkitARM使用的构建脚本可能会有帮助——http://sourceforge.net/p/devkitpro/buildscripts/ci/c372699fc7b4b4de90eb044314ce5bed0db640291/tree/