diff --git a/sdk_container/src/third_party/portage-stable/sys-libs/glibc/files/glibc-2.43-hurd-link-helpers.patch b/sdk_container/src/third_party/portage-stable/sys-libs/glibc/files/glibc-2.43-hurd-link-helpers.patch new file mode 100644 index 0000000000..24a3fc887d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-libs/glibc/files/glibc-2.43-hurd-link-helpers.patch @@ -0,0 +1,34 @@ +https://salsa.debian.org/glibc-team/glibc/-/raw/sid/debian/patches/hurd-i386/tg-mach-hurd-link.diff + +From: Samuel Thibault +Subject: [PATCH] Add -lmachuser -lhurduser to libc.so on GNU/Hurd. + +http://lists.gnu.org/archive/html/bug-hurd/2011-03/msg00112.html + +2011-03-29 Samuel Thibault + + * Makerules ($(inst_libdir)/libc.so): Add -lmachuser -lhurduser to + libc.so on GNU/Hurd. + +It's still unclear what we want to aim for. + +--- + Makerules | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/Makerules b/Makerules +index 53eabfaba8..b0f5e1b3a0 100644 +--- a/Makerules ++++ b/Makerules +@@ -1066,6 +1066,9 @@ $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ + '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ + ' AS_NEEDED (' $(rtlddir)/$(rtld-installed-name) ') )' \ + ) > $@.new ++ifeq ($(patsubst gnu%,,$(config-os)),) ++ echo 'INPUT ( AS_NEEDED ( -lmachuser -lhurduser ) )' >> $@.new ++endif + mv -f $@.new $@ + + endif +-- +tg: (7bb5f8a836..) t/mach-hurd-link (depends on: baseline) diff --git a/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-2.42-r5.ebuild b/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-2.42-r5.ebuild index b5bd16ec72..95b782d7b5 100644 --- a/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-2.42-r5.ebuild +++ b/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-2.42-r5.ebuild @@ -246,6 +246,15 @@ is_crosscompile() { [[ ${CHOST} != ${CTARGET} ]] } +is_linux() { + [[ ${CTARGET} == *-linux-* ]] +} + +is_hurd() { + # Let's hope this holds for a long time + [[ ${CTARGET} != *-linux-* ]] +} + just_headers() { is_crosscompile && use headers-only } @@ -1454,47 +1463,56 @@ glibc_do_src_install() { # if the main library set isn't installed into the right place. Maybe # we should query the active gcc for info instead of hardcoding it ? local i ldso_abi ldso_name - local ldso_abi_list=( - # x86 - amd64 /lib64/ld-linux-x86-64.so.2 - x32 /libx32/ld-linux-x32.so.2 - x86 /lib/ld-linux.so.2 - # mips - o32 /lib/ld.so.1 - n32 /lib32/ld.so.1 - n64 /lib64/ld.so.1 - # powerpc - ppc /lib/ld.so.1 - # riscv - ilp32d /lib/ld-linux-riscv32-ilp32d.so.1 - ilp32 /lib/ld-linux-riscv32-ilp32.so.1 - lp64d /lib/ld-linux-riscv64-lp64d.so.1 - lp64 /lib/ld-linux-riscv64-lp64.so.1 - # s390 - s390 /lib/ld.so.1 - s390x /lib/ld64.so.1 - # sparc - sparc32 /lib/ld-linux.so.2 - sparc64 /lib64/ld-linux.so.2 - ) - case $(tc-endian) in - little) - ldso_abi_list+=( - # arm - arm64 /lib/ld-linux-aarch64.so.1 - # ELFv2 (glibc does not support ELFv1 on LE) - ppc64 /lib64/ld64.so.2 + if is_linux ; then + local ldso_abi_list=( + # x86 + amd64 /lib64/ld-linux-x86-64.so.2 + x32 /libx32/ld-linux-x32.so.2 + x86 /lib/ld-linux.so.2 + # mips + o32 /lib/ld.so.1 + n32 /lib32/ld.so.1 + n64 /lib64/ld.so.1 + # powerpc + ppc /lib/ld.so.1 + # riscv + ilp32d /lib/ld-linux-riscv32-ilp32d.so.1 + ilp32 /lib/ld-linux-riscv32-ilp32.so.1 + lp64d /lib/ld-linux-riscv64-lp64d.so.1 + lp64 /lib/ld-linux-riscv64-lp64.so.1 + # s390 + s390 /lib/ld.so.1 + s390x /lib/ld64.so.1 + # sparc + sparc32 /lib/ld-linux.so.2 + sparc64 /lib64/ld-linux.so.2 ) - ;; - big) - ldso_abi_list+=( - # arm - arm64 /lib/ld-linux-aarch64_be.so.1 - # ELFv1 (glibc does not support ELFv2 on BE) - ppc64 /lib64/ld64.so.1 + case $(tc-endian) in + little) + ldso_abi_list+=( + # arm + arm64 /lib/ld-linux-aarch64.so.1 + # ELFv2 (glibc does not support ELFv1 on LE) + ppc64 /lib64/ld64.so.2 + ) + ;; + big) + ldso_abi_list+=( + # arm + arm64 /lib/ld-linux-aarch64_be.so.1 + # ELFv1 (glibc does not support ELFv2 on BE) + ppc64 /lib64/ld64.so.1 + ) + ;; + esac + else + # we must be using hurd then + local ldso_abi_list=( + # x86 + amd64 /lib64/ld-x86-64.so.1 + x86 /lib/ld.so.1 ) - ;; - esac + fi if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib fi @@ -1508,26 +1526,42 @@ glibc_do_src_install() { fi done - # In the LSB 5.0 definition, someone had the excellent idea to "standardize" - # the runtime loader name, see also https://xkcd.com/927/ - # Normally, in Gentoo one should never come across executables that require this. - # However, binary commercial packages are known to adhere to weird practices. - # https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB - local lsb_ldso_name native_ldso_name lsb_ldso_abi - local lsb_ldso_abi_list=( - # x86 - amd64 ld-linux-x86-64.so.2 ld-lsb-x86-64.so.3 - ) - for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do - lsb_ldso_abi=${lsb_ldso_abi_list[i]} - native_ldso_name=${lsb_ldso_abi_list[i+1]} - lsb_ldso_name=${lsb_ldso_abi_list[i+2]} - has ${lsb_ldso_abi} $(get_install_abis) || continue + if is_linux ; then + # In the LSB 5.0 definition, someone had the excellent idea to "standardize" + # the runtime loader name, see also https://xkcd.com/927/ + # Normally, in Gentoo one should never come across executables that require this. + # However, binary commercial packages are known to adhere to weird practices. + # https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB + local lsb_ldso_name native_ldso_name lsb_ldso_abi + local lsb_ldso_abi_list=( + # x86 + amd64 ld-linux-x86-64.so.2 ld-lsb-x86-64.so.3 + ) + for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do + lsb_ldso_abi=${lsb_ldso_abi_list[i]} + native_ldso_name=${lsb_ldso_abi_list[i+1]} + lsb_ldso_name=${lsb_ldso_abi_list[i+2]} + has ${lsb_ldso_abi} $(get_install_abis) || continue - if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then - dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}" + if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then + dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}" + fi + done + fi + + if is_hurd && has x86 $(get_install_abis) ; then + # On ix86, glibc and (unpatched) gcc disagree about the proper location for the dynamic loader. + # Which is maximally stupid since this one information is hardcoded into every single + # binary... + + # First, let's check for sanity + if [[ -f "$(alt_prefix)/$(get_abi_LIBDIR x86)/ld.so" ]] ; then + die "Somehow your hurd glibc installed a literal ld.so ... this should not happen." fi - done + + # Then make a compatibility symlink. + dosym ld.so.1 "$(alt_prefix)/$(get_abi_LIBDIR x86)/ld.so" + fi # With devpts under Linux mounted properly, we do not need the pt_chown # binary to be setuid. This is because the default owners/perms will be diff --git a/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-2.43.ebuild b/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-2.43.ebuild index 5779dfe29e..43c6ac5e29 100644 --- a/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-2.43.ebuild +++ b/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-2.43.ebuild @@ -151,7 +151,15 @@ if [[ ${CATEGORY} == cross-* ]] ; then >=${CATEGORY}/binutils-2.27 >=${CATEGORY}/gcc-6.2 )" - [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" + + case ${CATEGORY} in + *-linux*) + DEPEND+=" ${CATEGORY}/linux-headers" + ;; + *-gnu) + DEPEND+=" ${CATEGORY}/gnumach[-headers-only]" + ;; + esac else BDEPEND+=" >=sys-devel/binutils-2.27 @@ -249,6 +257,15 @@ is_crosscompile() { [[ ${CHOST} != ${CTARGET} ]] } +is_linux() { + [[ ${CTARGET} == *-linux-* ]] +} + +is_hurd() { + # Let's hope this holds for a long time + [[ ${CTARGET} != *-linux-* ]] +} + just_headers() { is_crosscompile && use headers-only } @@ -499,6 +516,16 @@ setup_flags() { # #829583 filter-lfs-flags + case ${CTARGET} in + *-linux*) + ;; + *-gnu) + # -g3 confuses MIG which relies on preprocessed input + replace-flags -ggdb[3-9] -ggdb2 + replace-flags -g3 -g + ;; + esac + unset CBUILD_OPT CTARGET_OPT if use multilib ; then CTARGET_OPT=$(get_abi_CTARGET) @@ -992,6 +1019,9 @@ src_prepare() { einfo "Applying Gentoo Glibc patchset ${patchsetname}" eapply "${WORKDIR}"/patches einfo "Done." + + # TODO: Put into our patchset + eapply "${FILESDIR}"/glibc-2.43-hurd-link-helpers.patch fi case ${CTARGET} in @@ -1097,7 +1127,6 @@ glibc_do_configure() { --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion="$(glibc_banner)" $(use_multiarch || echo --disable-multi-arch) - $(use_enable systemtap) $(use_enable nscd) # /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if @@ -1123,6 +1152,12 @@ glibc_do_configure() { # We rely on sys-libs/timezone-data for timezone tools normally. myconf+=( $(use_enable vanilla timezone-tools) ) + if is_crosscompile ; then + myconf+=( --disable-systemtap ) + else + myconf+=( $(use_enable systemtap) ) + fi + # These libs don't have configure flags. ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no) ac_cv_lib_cap_cap_init=$(usex caps || echo no) @@ -1457,47 +1492,56 @@ glibc_do_src_install() { # if the main library set isn't installed into the right place. Maybe # we should query the active gcc for info instead of hardcoding it ? local i ldso_abi ldso_name - local ldso_abi_list=( - # x86 - amd64 /lib64/ld-linux-x86-64.so.2 - x32 /libx32/ld-linux-x32.so.2 - x86 /lib/ld-linux.so.2 - # mips - o32 /lib/ld.so.1 - n32 /lib32/ld.so.1 - n64 /lib64/ld.so.1 - # powerpc - ppc /lib/ld.so.1 - # riscv - ilp32d /lib/ld-linux-riscv32-ilp32d.so.1 - ilp32 /lib/ld-linux-riscv32-ilp32.so.1 - lp64d /lib/ld-linux-riscv64-lp64d.so.1 - lp64 /lib/ld-linux-riscv64-lp64.so.1 - # s390 - s390 /lib/ld.so.1 - s390x /lib/ld64.so.1 - # sparc - sparc32 /lib/ld-linux.so.2 - sparc64 /lib64/ld-linux.so.2 - ) - case $(tc-endian) in - little) - ldso_abi_list+=( - # arm - arm64 /lib/ld-linux-aarch64.so.1 - # ELFv2 (glibc does not support ELFv1 on LE) - ppc64 /lib64/ld64.so.2 + if is_linux ; then + local ldso_abi_list=( + # x86 + amd64 /lib64/ld-linux-x86-64.so.2 + x32 /libx32/ld-linux-x32.so.2 + x86 /lib/ld-linux.so.2 + # mips + o32 /lib/ld.so.1 + n32 /lib32/ld.so.1 + n64 /lib64/ld.so.1 + # powerpc + ppc /lib/ld.so.1 + # riscv + ilp32d /lib/ld-linux-riscv32-ilp32d.so.1 + ilp32 /lib/ld-linux-riscv32-ilp32.so.1 + lp64d /lib/ld-linux-riscv64-lp64d.so.1 + lp64 /lib/ld-linux-riscv64-lp64.so.1 + # s390 + s390 /lib/ld.so.1 + s390x /lib/ld64.so.1 + # sparc + sparc32 /lib/ld-linux.so.2 + sparc64 /lib64/ld-linux.so.2 ) - ;; - big) - ldso_abi_list+=( - # arm - arm64 /lib/ld-linux-aarch64_be.so.1 - # ELFv1 (glibc does not support ELFv2 on BE) - ppc64 /lib64/ld64.so.1 + case $(tc-endian) in + little) + ldso_abi_list+=( + # arm + arm64 /lib/ld-linux-aarch64.so.1 + # ELFv2 (glibc does not support ELFv1 on LE) + ppc64 /lib64/ld64.so.2 + ) + ;; + big) + ldso_abi_list+=( + # arm + arm64 /lib/ld-linux-aarch64_be.so.1 + # ELFv1 (glibc does not support ELFv2 on BE) + ppc64 /lib64/ld64.so.1 + ) + ;; + esac + else + # we must be using hurd then + local ldso_abi_list=( + # x86 + amd64 /lib64/ld-x86-64.so.1 + x86 /lib/ld.so.1 ) - ;; - esac + fi if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib fi @@ -1511,26 +1555,42 @@ glibc_do_src_install() { fi done - # In the LSB 5.0 definition, someone had the excellent idea to "standardize" - # the runtime loader name, see also https://xkcd.com/927/ - # Normally, in Gentoo one should never come across executables that require this. - # However, binary commercial packages are known to adhere to weird practices. - # https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB - local lsb_ldso_name native_ldso_name lsb_ldso_abi - local lsb_ldso_abi_list=( - # x86 - amd64 ld-linux-x86-64.so.2 ld-lsb-x86-64.so.3 - ) - for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do - lsb_ldso_abi=${lsb_ldso_abi_list[i]} - native_ldso_name=${lsb_ldso_abi_list[i+1]} - lsb_ldso_name=${lsb_ldso_abi_list[i+2]} - has ${lsb_ldso_abi} $(get_install_abis) || continue + if is_linux ; then + # In the LSB 5.0 definition, someone had the excellent idea to "standardize" + # the runtime loader name, see also https://xkcd.com/927/ + # Normally, in Gentoo one should never come across executables that require this. + # However, binary commercial packages are known to adhere to weird practices. + # https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB + local lsb_ldso_name native_ldso_name lsb_ldso_abi + local lsb_ldso_abi_list=( + # x86 + amd64 ld-linux-x86-64.so.2 ld-lsb-x86-64.so.3 + ) + for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do + lsb_ldso_abi=${lsb_ldso_abi_list[i]} + native_ldso_name=${lsb_ldso_abi_list[i+1]} + lsb_ldso_name=${lsb_ldso_abi_list[i+2]} + has ${lsb_ldso_abi} $(get_install_abis) || continue - if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then - dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}" + if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then + dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}" + fi + done + fi + + if is_hurd && has x86 $(get_install_abis) ; then + # On ix86, glibc and (unpatched) gcc disagree about the proper location for the dynamic loader. + # Which is maximally stupid since this one information is hardcoded into every single + # binary... + + # First, let's check for sanity + if [[ -f "$(alt_prefix)/$(get_abi_LIBDIR x86)/ld.so" ]] ; then + die "Somehow your hurd glibc installed a literal ld.so ... this should not happen." fi - done + + # Then make a compatibility symlink. + dosym ld.so.1 "$(alt_prefix)/$(get_abi_LIBDIR x86)/ld.so" + fi # With devpts under Linux mounted properly, we do not need the pt_chown # binary to be setuid. This is because the default owners/perms will be diff --git a/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-9999.ebuild b/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-9999.ebuild index 8e93624a19..2a072bed25 100644 --- a/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-9999.ebuild +++ b/sdk_container/src/third_party/portage-stable/sys-libs/glibc/glibc-9999.ebuild @@ -151,7 +151,15 @@ if [[ ${CATEGORY} == cross-* ]] ; then >=${CATEGORY}/binutils-2.27 >=${CATEGORY}/gcc-6.2 )" - [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" + + case ${CATEGORY} in + *-linux*) + DEPEND+=" ${CATEGORY}/linux-headers" + ;; + *-gnu) + DEPEND+=" ${CATEGORY}/gnumach[-headers-only]" + ;; + esac else BDEPEND+=" >=sys-devel/binutils-2.27 @@ -249,6 +257,15 @@ is_crosscompile() { [[ ${CHOST} != ${CTARGET} ]] } +is_linux() { + [[ ${CTARGET} == *-linux-* ]] +} + +is_hurd() { + # Let's hope this holds for a long time + [[ ${CTARGET} != *-linux-* ]] +} + just_headers() { is_crosscompile && use headers-only } @@ -499,6 +516,16 @@ setup_flags() { # #829583 filter-lfs-flags + case ${CTARGET} in + *-linux*) + ;; + *-gnu) + # -g3 confuses MIG which relies on preprocessed input + replace-flags -ggdb[3-9] -ggdb2 + replace-flags -g3 -g + ;; + esac + unset CBUILD_OPT CTARGET_OPT if use multilib ; then CTARGET_OPT=$(get_abi_CTARGET) @@ -992,6 +1019,9 @@ src_prepare() { einfo "Applying Gentoo Glibc patchset ${patchsetname}" eapply "${WORKDIR}"/patches einfo "Done." + + # TODO: Put into our patchset + eapply "${FILESDIR}"/glibc-2.43-hurd-link-helpers.patch fi case ${CTARGET} in @@ -1097,7 +1127,6 @@ glibc_do_configure() { --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion="$(glibc_banner)" $(use_multiarch || echo --disable-multi-arch) - $(use_enable systemtap) $(use_enable nscd) # /usr/bin/mtrace has a Perl shebang. Gentoo Prefix QA checks fail if @@ -1123,6 +1152,12 @@ glibc_do_configure() { # We rely on sys-libs/timezone-data for timezone tools normally. myconf+=( $(use_enable vanilla timezone-tools) ) + if is_crosscompile ; then + myconf+=( --disable-systemtap ) + else + myconf+=( $(use_enable systemtap) ) + fi + # These libs don't have configure flags. ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no) ac_cv_lib_cap_cap_init=$(usex caps || echo no) @@ -1457,47 +1492,56 @@ glibc_do_src_install() { # if the main library set isn't installed into the right place. Maybe # we should query the active gcc for info instead of hardcoding it ? local i ldso_abi ldso_name - local ldso_abi_list=( - # x86 - amd64 /lib64/ld-linux-x86-64.so.2 - x32 /libx32/ld-linux-x32.so.2 - x86 /lib/ld-linux.so.2 - # mips - o32 /lib/ld.so.1 - n32 /lib32/ld.so.1 - n64 /lib64/ld.so.1 - # powerpc - ppc /lib/ld.so.1 - # riscv - ilp32d /lib/ld-linux-riscv32-ilp32d.so.1 - ilp32 /lib/ld-linux-riscv32-ilp32.so.1 - lp64d /lib/ld-linux-riscv64-lp64d.so.1 - lp64 /lib/ld-linux-riscv64-lp64.so.1 - # s390 - s390 /lib/ld.so.1 - s390x /lib/ld64.so.1 - # sparc - sparc32 /lib/ld-linux.so.2 - sparc64 /lib64/ld-linux.so.2 - ) - case $(tc-endian) in - little) - ldso_abi_list+=( - # arm - arm64 /lib/ld-linux-aarch64.so.1 - # ELFv2 (glibc does not support ELFv1 on LE) - ppc64 /lib64/ld64.so.2 + if is_linux ; then + local ldso_abi_list=( + # x86 + amd64 /lib64/ld-linux-x86-64.so.2 + x32 /libx32/ld-linux-x32.so.2 + x86 /lib/ld-linux.so.2 + # mips + o32 /lib/ld.so.1 + n32 /lib32/ld.so.1 + n64 /lib64/ld.so.1 + # powerpc + ppc /lib/ld.so.1 + # riscv + ilp32d /lib/ld-linux-riscv32-ilp32d.so.1 + ilp32 /lib/ld-linux-riscv32-ilp32.so.1 + lp64d /lib/ld-linux-riscv64-lp64d.so.1 + lp64 /lib/ld-linux-riscv64-lp64.so.1 + # s390 + s390 /lib/ld.so.1 + s390x /lib/ld64.so.1 + # sparc + sparc32 /lib/ld-linux.so.2 + sparc64 /lib64/ld-linux.so.2 ) - ;; - big) - ldso_abi_list+=( - # arm - arm64 /lib/ld-linux-aarch64_be.so.1 - # ELFv1 (glibc does not support ELFv2 on BE) - ppc64 /lib64/ld64.so.1 + case $(tc-endian) in + little) + ldso_abi_list+=( + # arm + arm64 /lib/ld-linux-aarch64.so.1 + # ELFv2 (glibc does not support ELFv1 on LE) + ppc64 /lib64/ld64.so.2 + ) + ;; + big) + ldso_abi_list+=( + # arm + arm64 /lib/ld-linux-aarch64_be.so.1 + # ELFv1 (glibc does not support ELFv2 on BE) + ppc64 /lib64/ld64.so.1 + ) + ;; + esac + else + # we must be using hurd then + local ldso_abi_list=( + # x86 + amd64 /lib64/ld-x86-64.so.1 + x86 /lib/ld.so.1 ) - ;; - esac + fi if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib fi @@ -1511,26 +1555,42 @@ glibc_do_src_install() { fi done - # In the LSB 5.0 definition, someone had the excellent idea to "standardize" - # the runtime loader name, see also https://xkcd.com/927/ - # Normally, in Gentoo one should never come across executables that require this. - # However, binary commercial packages are known to adhere to weird practices. - # https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB - local lsb_ldso_name native_ldso_name lsb_ldso_abi - local lsb_ldso_abi_list=( - # x86 - amd64 ld-linux-x86-64.so.2 ld-lsb-x86-64.so.3 - ) - for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do - lsb_ldso_abi=${lsb_ldso_abi_list[i]} - native_ldso_name=${lsb_ldso_abi_list[i+1]} - lsb_ldso_name=${lsb_ldso_abi_list[i+2]} - has ${lsb_ldso_abi} $(get_install_abis) || continue + if is_linux ; then + # In the LSB 5.0 definition, someone had the excellent idea to "standardize" + # the runtime loader name, see also https://xkcd.com/927/ + # Normally, in Gentoo one should never come across executables that require this. + # However, binary commercial packages are known to adhere to weird practices. + # https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB + local lsb_ldso_name native_ldso_name lsb_ldso_abi + local lsb_ldso_abi_list=( + # x86 + amd64 ld-linux-x86-64.so.2 ld-lsb-x86-64.so.3 + ) + for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do + lsb_ldso_abi=${lsb_ldso_abi_list[i]} + native_ldso_name=${lsb_ldso_abi_list[i+1]} + lsb_ldso_name=${lsb_ldso_abi_list[i+2]} + has ${lsb_ldso_abi} $(get_install_abis) || continue - if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then - dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}" + if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then + dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}" + fi + done + fi + + if is_hurd && has x86 $(get_install_abis) ; then + # On ix86, glibc and (unpatched) gcc disagree about the proper location for the dynamic loader. + # Which is maximally stupid since this one information is hardcoded into every single + # binary... + + # First, let's check for sanity + if [[ -f "$(alt_prefix)/$(get_abi_LIBDIR x86)/ld.so" ]] ; then + die "Somehow your hurd glibc installed a literal ld.so ... this should not happen." fi - done + + # Then make a compatibility symlink. + dosym ld.so.1 "$(alt_prefix)/$(get_abi_LIBDIR x86)/ld.so" + fi # With devpts under Linux mounted properly, we do not need the pt_chown # binary to be setuid. This is because the default owners/perms will be