mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00
rust: Use patchelf in place of chrpath to edit rpaths
chrpath has limitations e.g. the original rpath in ELF have to bigger in size than the one being edited into it by chrpath, some toolchains do not use RPATH but emit the RUNPATHs into ELF files and chrpath is not able to handle the runpaths, this is the case with mips and pp32 build of rust, especially when using clang compiler to build them. patchelf can do more: Modify RUNPATH entries Add RPATH/RUNPATH where none existed Set longer paths than the original Convert between RPATH and RUNPATH (From OE-Core rev: 22b903f6620455e142e836412d3f7f6a4f03bea7) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
94019980ea
commit
522af6e5ce
|
@ -64,7 +64,7 @@ do_rust_setup_snapshot () {
|
|||
# are used internally by rust and result in symbol mismatches if we don't
|
||||
if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then
|
||||
for bin in cargo rustc rustdoc; do
|
||||
patchelf-uninative ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER}
|
||||
patchelf ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER}
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ addtask rust_setup_snapshot after do_unpack before do_configure
|
|||
addtask do_test_compile after do_configure do_rust_gen_targets
|
||||
do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot"
|
||||
do_rust_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER"
|
||||
do_rust_setup_snapshot[depends] += "patchelf-native:do_populate_sysroot"
|
||||
|
||||
RUSTC_BOOTSTRAP = "${STAGING_BINDIR_NATIVE}/rustc"
|
||||
CARGO_BOOTSTRAP = "${STAGING_BINDIR_NATIVE}/cargo"
|
||||
|
@ -207,9 +208,9 @@ rust_runx () {
|
|||
mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}`
|
||||
cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH}
|
||||
if [ -e ${STAGING_LIBDIR_NATIVE}/libc++.so.1 ]; then
|
||||
chrpath -r \$ORIGIN/../../../../../`basename ${STAGING_DIR_NATIVE}`${libdir_native} ${RUST_ALTERNATE_EXE_PATH}
|
||||
patchelf --set-rpath \$ORIGIN/../../../../../`basename ${STAGING_DIR_NATIVE}`${libdir_native} ${RUST_ALTERNATE_EXE_PATH}
|
||||
else
|
||||
chrpath -d ${RUST_ALTERNATE_EXE_PATH}
|
||||
patchelf --remove-rpath ${RUST_ALTERNATE_EXE_PATH}
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -266,7 +267,7 @@ rust_do_install:class-nativesdk() {
|
|||
install -d ${D}${bindir}
|
||||
for i in cargo-clippy clippy-driver rustfmt; do
|
||||
cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir}
|
||||
chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i
|
||||
patchelf --set-rpath "\$ORIGIN/../lib" ${D}${bindir}/$i
|
||||
done
|
||||
|
||||
chown root:root ${D}/ -R
|
||||
|
@ -301,7 +302,7 @@ rust_do_install:class-target() {
|
|||
install -d ${D}${bindir}
|
||||
for i in ${EXTRA_TOOLS}; do
|
||||
cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir}
|
||||
chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i
|
||||
patchelf --set-rpath "\$ORIGIN/../lib" ${D}${bindir}/$i
|
||||
done
|
||||
|
||||
install -d ${D}${libdir}/rustlib/${RUST_HOST_SYS}
|
||||
|
|
Loading…
Reference in New Issue
Block a user