Hello,
Le jeu. 23 janv. 2025 à 05:53, hongxu via lists.openembedded.org
<[email protected]> a écrit :
> We have patch 0016-handle-sysroot-support-for-nativesdk-gcc.patch to handle
> sysroot support for nativesdk-gcc, and add %r target_relocatable_prefix
> into spec file for nativesdk-gcc relocation. It was used for injected
> paths SYSTEMLIBS_DIR
>
> Due to the supported SDKMACHINE includes:
>
> aarch64, i586, i686, loongarch64, ppc64, ppc64le, riscv64, x86_64
>
> Only i586 and x86_64, i686 and x86_64 have multilib relationship,
> for i586,i686 and x86_64, this commit:
>
> - Tweak target_relocatable_prefix, set ${root_prefix} to it , and tweak
> libdir32 based on ${root_prefix} prefix with "/lib" suffix
>
> - For i686 and i586, hard code `lib' to 32bit osdirname, `lib64' to
> libdir64 and 64bit osdirname, whether multlib or not
>
> - For x86_64, use variable baselib to set libdir64 and 64bit osdirnames,
> baselib is set to `lib64' for multilib, and `lib' for non multilib
>
> Above setting also covers gcc-nativesdk without multilib
>
> For other situation, the configuration is the same as usual
>
> [ YOCTO #15722 ]
>
> Signed-off-by: Hongxu Jia <[email protected]>
> ---
> Changed in v2,
> Fix `cargo build' failded in SDK, the interpreter of dynamical loader
> is not right
>
> $ rustc build.rs
> $ ./build
> ./build: cannot execute: required file not found
> $ file build
> build: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV),
> dynamically linked, interpreter
> sdk-path-to/sysroots/x86_64-pokysdk-linux/lib64/ld-linux-x86-64.so.2, for
> GNU/Linux 3.2.0, BuildID[sha1]=4e012c629e30ebc91c3252eb0fd40358cc5b2dfa,
> not stripped
> $ ls sdk-path-to/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2
> sdk-path-to/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2
>
> For x86_64, use variable baselib to set libdir64 and 64bit osdirnames,
> baselib is set to `lib64' for multilib, and `lib' for non multilib
>
This is the v2 of single patch in the middle of a patch series. Can you send
version iteration of the full series?
Thanks!
> meta/recipes-devtools/gcc/gcc-configure-common.inc | 9 +++++++++
> meta/recipes-devtools/gcc/gcc-multilib-config.inc | 11 +++++++++++
> ...016-handle-sysroot-support-for-nativesdk-gcc.patch | 2 +-
> 3 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc
> b/meta/recipes-devtools/gcc/gcc-configure-common.inc
> index 5c79936242..bd5c953334 100644
> --- a/meta/recipes-devtools/gcc/gcc-configure-common.inc
> +++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc
> @@ -73,6 +73,14 @@ SYSTEMHEADERS = "${target_includedir}"
> SYSTEMLIBS = "${target_base_libdir}/"
> SYSTEMLIBS1 = "${target_libdir}/"
>
> +def tune_target_relocatable_prefix(d):
> + if d.getVar("SDK_ARCH") in ["x86_64", "i686", "i586"]:
> + return d.getVar("root_prefix")
> + else:
> + return d.getVar("SYSTEMLIBS")
> +TARGET_RELOCATE_PREFIX = "${SYSTEMLIBS}"
> +TARGET_RELOCATE_PREFIX:class-nativesdk =
> "${@tune_target_relocatable_prefix(d)}"
> +
> do_configure:prepend () {
> # teach gcc to find correct target includedir when checking libc
> ssp support
> mkdir -p ${B}/gcc
> @@ -83,6 +91,7 @@ do_configure:prepend () {
> #define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
> #define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
> #define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
> +#define TARGET_RELOCATE_PREFIX "${TARGET_RELOCATE_PREFIX}"
> #endif /* ! GCC_DEFAULTS_H */
> _EOF
> mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
> diff --git a/meta/recipes-devtools/gcc/gcc-multilib-config.inc
> b/meta/recipes-devtools/gcc/gcc-multilib-config.inc
> index 2dbbc23c94..997bb6029b 100644
> --- a/meta/recipes-devtools/gcc/gcc-multilib-config.inc
> +++ b/meta/recipes-devtools/gcc/gcc-multilib-config.inc
> @@ -172,6 +172,17 @@ python gcc_multilib_setup() {
> target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL') if mlprefix
> else d.getVar('TARGET_ARCH'))
> if pn == "nativesdk-gcc":
> + sdk_arch = d.getVar('SDK_ARCH')
> + if sdk_arch in ['x86_64', 'i686', 'i586']:
> + libdir32 = '%r/lib'
> + if sdk_arch == 'x86_64':
> + libdir64 = '%r/' + d.getVar('baselib')
> + osdirnames = ['../'+d.getVar('baselib') ,'../lib']
> + else:
> + libdir64 = '%r/lib64'
> + osdirnames = ['../lib64', '../lib']
> + target_config_files =
> gcc_target_config_files[d.getVar("SDK_ARCH")]
> + write_config(builddir, target_config_files, ['m64', 'm32'],
> ['64', '32'], osdirnames)
> header_config_files =
> gcc_header_config_files[d.getVar("SDK_ARCH")]
> write_headers(builddir, header_config_files, libdir32, libdir64,
> libdirx32, libdirn32)
> return
> diff --git
> a/meta/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch
> b/meta/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch
> index edd100ee46..7d96a42027 100644
> ---
> a/meta/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch
> +++
> b/meta/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch
> @@ -389,7 +389,7 @@ index e3e9374d1cc..b080609341b 100644
> #endif
> static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT;
>
> -+static char target_relocatable_prefix[4096] __attribute__ ((section
> (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
> ++static char target_relocatable_prefix[4096] __attribute__ ((section
> (".gccrelocprefix"))) = TARGET_RELOCATE_PREFIX;
> +
> /* Nonzero means pass the updated target_system_root to the compiler. */
>
> --
> 2.34.1
>
>
>
>
>
--
Yoann Congal
Smile ECS - Tech expert
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#210199):
https://lists.openembedded.org/g/openembedded-core/message/210199
Mute This Topic: https://lists.openembedded.org/mt/110767332/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-