Skip to contentSkip to conversation

package/clang: default linker to the cross GNU

PATCH New Matt Weber 2 participants 2 messages Oct 21, 2018

lore
Share & tools
lore

Matt Weber

author
#0 lore raw

PATCH v2 1/1 package/clang: default linker to the cross GNU

By default clang is assuming the system linker /usr/bin/ld. This patchset updates the default to point at the cross toolchain ld.

Previously clang had been used on target only, this update is required for host clang/clang++ to be used as a frontend for cross-compiling.

Example build command:

output/host/bin/clang++ -mcpu=cortex-a53 \
--sysroot /<abs path>/output/staging/ \
-B /<abs path>/output/host/opt/ext-toolchain/ \
foobar.cc -o foobar

---
Changes
v1 -> v2
[Romain
- Added example build command in commit description as example for an eventual wrapper
- Moved setting of ld path option to be with other path assignments

---
 package/clang/clang.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/clang/clang.mk +2 -1
index 52e0b98..f9d4ae3 100644
@@ -49,7 +49,8 @@ CLANG_CONF_OPTS += \
 	-DCLANG_INCLUDE_DOCS=OFF \
 	-DCLANG_INCLUDE_TESTS=OFF
 
-HOST_CLANG_CONF_OPTS += -DLLVM_CONFIG:FILEPATH=$(HOST_DIR)/bin/llvm-config
+HOST_CLANG_CONF_OPTS += -DLLVM_CONFIG:FILEPATH=$(HOST_DIR)/bin/llvm-config \
+	-DCLANG_DEFAULT_LINKER=$(TARGET_LD)
 CLANG_CONF_OPTS += -DLLVM_CONFIG:FILEPATH=$(STAGING_DIR)/usr/bin/llvm-config \
 	-DCLANG_TABLEGEN:FILEPATH=$(HOST_DIR)/bin/clang-tblgen \
 	-DLLVM_TABLEGEN_EXE:FILEPATH=$(HOST_DIR)/bin/llvm-tblgen
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 package/clang: default linker to the cross GNU

Hello,

Quoted 24 lines · Matt Weber

By default clang is assuming the system linker /usr/bin/ld. This patchset updates the default to point at the cross toolchain ld.

Previously clang had been used on target only, this update is required for host clang/clang++ to be used as a frontend for cross-compiling.

Example build command:

output/host/bin/clang++ -mcpu=cortex-a53 \
--sysroot /<abs path>/output/staging/ \
-B /<abs path>/output/host/opt/ext-toolchain/ \
foobar.cc -o foobar

---
Changes
v1 -> v2
[Romain
- Added example build command in commit description as example for an eventual wrapper
- Moved setting of ld path option to be with other path assignments

Quoted 3 lines
---
 package/clang/clang.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com