diff options
Diffstat (limited to 'sys-libs/musl/files')
-rw-r--r-- | sys-libs/musl/files/ldconfig.in | 144 | ||||
-rw-r--r-- | sys-libs/musl/files/ldconfig.in-r3 | 160 | ||||
-rw-r--r-- | sys-libs/musl/files/musl-1.2.4-arm64-crti-alignment.patch | 32 | ||||
-rw-r--r-- | sys-libs/musl/files/musl-1.2.4-elfutils-0.190-relr.patch | 73 |
4 files changed, 265 insertions, 144 deletions
diff --git a/sys-libs/musl/files/ldconfig.in b/sys-libs/musl/files/ldconfig.in deleted file mode 100644 index 19c94d85353a..000000000000 --- a/sys-libs/musl/files/ldconfig.in +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash -e -# Copyright 1999-2015 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -ROOT="/" - -LDSO_CONF="/etc/ld.so.conf" -if [[ ! -e $LDSO_CONF ]]; then - echo "$LDSO_CONF not found" >&2 - exit 1 -fi - -LDSO_CONF_DIR=$(dirname $LDSO_CONF) - -VERBOSE=0 - -UPDATE_LINKS=1 - -get_options() { - while getopts "vnNXf:C:r:p" opt "$@"; do - case $opt in - v) - echo "ldconfig for musl in Gentoo" - VERBOSE=1 - ;; - r) - ROOT=$OPTARG - ;; - f) - LDSO_CONF=$OPTARG - ;; - X) - UPDATE_LINKS=0 - ;; - \?) - echo "Invalid option: -$opt" >&2 - exit 1 - ;; - n|N|C|p) - echo "Unimplemented option: -$opt" >&2 - exit 1 - ;; - esac - done - - if [[ $UPDATE_LINKS == 1 ]]; then - echo "Updating links is not implemented." - fi -} - - -repeated() { - local l=$1 - local drs="${@:2}" - for m in $drs; do - [[ $m == $l ]] && return 0 - done - return 1 -} - -expand() { - # We are assuming the ld.so.conf's 'include' is not recursive - local f line l - local glob="$LDSO_CONF_DIR/$1" - local drs="${@:2} " - - for f in $glob; do - [[ ! -f $f ]] && continue - while read line; do - line=${line%%#*} - line=${line//:/ } - line=${line//,/ } - for l in $line; do - #We must add this whether or not the directory exists - repeated $l $drs && continue - drs+=" $l " - done - done < $f - done - - echo $drs -} - -read_ldso_conf() { - local drs=" " - - while read line; do - # Sanitize the line - see ldconfig(8) for delimiters - # Note: bash read turns tabs into spaces and read already - # delimits on newlines with the default $IFS - line=${line%%#*} # Remove comments - line=${line//:/ } # Change colon delimiter to space - line=${line//,/ } # Change comma delimiter to space - - next=0 - for l in $line; do - if [[ $next == 1 ]]; then - next=0 - drs=$(expand $l $drs) - elif [[ $l == "include" ]]; then - next=1 - else - # glibc's ldconfig silently skips non directories - if [[ -d $l ]]; then - repeated $l $drs && continue - drs+=" $l " - fi - fi - done - done < $1 - - echo $drs -} - -sanitize() { - local drs=$@ - - repeated "/lib" $drs || drs="/lib $drs" - repeated "/usr/lib" $drs || drs="/usr/lib $drs" - - echo $drs -} - -get_options "$@" -drs=$(read_ldso_conf "$LDSO_CONF") -drs=$(sanitize $drs) - -ARCH=@@ARCH@@ -LDSO_PATH="/lib/ld-musl-${ARCH}.so.1" -if [[ ! -e $LDSO_PATH ]]; then - echo "$LDSO_PATH not found" >&2 - exit 1 -fi - -LDSO_ARCH=$(basename $LDSO_PATH) -LDSO_NAME=${LDSO_ARCH%.so.1} -ETC_LDSO_PATH=/etc/${LDSO_NAME}.path - -X=$(mktemp -p /tmp ${LDSO_NAME}.XXXXXX) -for d in $drs; do - echo $d >> $X -done -chmod 644 $X -mv $X $ETC_LDSO_PATH diff --git a/sys-libs/musl/files/ldconfig.in-r3 b/sys-libs/musl/files/ldconfig.in-r3 new file mode 100644 index 000000000000..60f6cc9e1130 --- /dev/null +++ b/sys-libs/musl/files/ldconfig.in-r3 @@ -0,0 +1,160 @@ +#!/bin/bash -e +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +ROOT="/" +EPREFIX="@GENTOO_PORTAGE_EPREFIX@" +LDSO_CONF_FILE="/etc/ld.so.conf" + +VERBOSE=0 + +UPDATE_LINKS=1 + +get_options() { + LDSO_CONF="" + while getopts "vnNXf:C:r:p" opt "$@"; do + case $opt in + v) + echo "ldconfig for musl in Gentoo" + VERBOSE=1 + ;; + r) + ROOT=${OPTARG} + ;; + f) + LDSO_CONF=${OPTARG} + ;; + X) + UPDATE_LINKS=0 + ;; + \?) + echo "Invalid option: -${opt}" >&2 + exit 1 + ;; + n|N|C|p) + echo "Unimplemented option: -${opt}" >&2 + exit 1 + ;; + esac + done + if [[ -z ${LDSO_CONF} ]]; then + LDSO_CONF=${ROOT}${EPREFIX}${LDSO_CONF_FILE} + fi + + if [[ ${UPDATE_LINKS} == 1 ]]; then + echo "Updating links is not implemented." + fi +} + + +repeated() { + local l=${1} + local drs="${@:2}" + for m in ${drs}; do + [[ ${m} == ${l} ]] && return 0 + done + return 1 +} + +expand() { + # We are assuming the ld.so.conf's 'include' is not recursive + local f line l + local glob="${LDSO_CONF_DIR}/${1}" + local drs="${@:2} " + + for f in ${glob}; do + [[ ! -f ${f} ]] && continue + while read line; do + line=${line%%#*} + line=${line//:/ } + line=${line//,/ } + for l in ${line}; do + # We must add this whether or not the directory exists + repeated ${l} ${drs} && continue + drs+=" ${l} " + done + done < ${f} + done + + echo ${drs} +} + +read_ldso_conf() { + local drs=" " + + while read line; do + # Sanitize the line - see ldconfig(8) for delimiters + # Note: bash read turns tabs into spaces and read already + # delimits on newlines with the default $IFS + line=${line%%#*} # Remove comments + line=${line//:/ } # Change colon delimiter to space + line=${line//,/ } # Change comma delimiter to space + + next=0 + for l in ${line}; do + if [[ ${next} == 1 ]]; then + next=0 + drs=$(expand ${l} ${drs}) + elif [[ ${l} == "include" ]]; then + next=1 + else + # glibc's ldconfig silently skips non directories + if [[ -d ${l} ]]; then + repeated ${l} ${drs} && continue + drs+=" ${l} " + fi + fi + done + done < ${1} + + echo ${drs} +} + +sanitize() { + local drs=$@ + + repeated "${EPREFIX}/lib" ${drs} || drs="${EPREFIX}/lib ${drs}" + repeated "${EPREFIX}/usr/lib" ${drs} || drs="${EPREFIX}/usr/lib ${drs}" + + echo ${drs} +} + +changed() { + [[ -f ${ETC_LDSO_PATH} ]] || return 0 + local current=$(<${ETC_LDSO_PATH}) + current=${current//$'\n'/ } + [[ ${current} != ${drs} ]] || return 1 +} + +get_options "$@" + +if [[ ! -e ${LDSO_CONF} ]]; then + echo "${LDSO_CONF} not found" >&2 + exit 1 +fi + +LDSO_CONF_DIR=$(dirname ${LDSO_CONF}) + +drs=$(read_ldso_conf "${LDSO_CONF}") +drs=$(sanitize ${drs}) + +ARCH=@@ARCH@@ +LDSO_PATH="${ROOT}${EPREFIX}/lib/ld-musl-${ARCH}.so.1" +if [[ ! -e ${LDSO_PATH} ]]; then + echo "${LDSO_PATH} not found" >&2 + exit 1 +fi + +LDSO_ARCH=$(basename ${LDSO_PATH}) +LDSO_NAME=${LDSO_ARCH%.so.1} +ETC_LDSO_PATH="${ROOT}${EPREFIX}/etc/${LDSO_NAME}.path" + +changed || exit 0 +X=$(mktemp -p /tmp ${LDSO_NAME}.XXXXXX) +for d in ${drs}; do + echo ${d} >> ${X} +done +chmod 644 ${X} +# busybox doesn't support mz -Z +cp ${X} ${ETC_LDSO_PATH} +rm ${X} diff --git a/sys-libs/musl/files/musl-1.2.4-arm64-crti-alignment.patch b/sys-libs/musl/files/musl-1.2.4-arm64-crti-alignment.patch new file mode 100644 index 000000000000..8b548bdb255f --- /dev/null +++ b/sys-libs/musl/files/musl-1.2.4-arm64-crti-alignment.patch @@ -0,0 +1,32 @@ +https://git.musl-libc.org/cgit/musl/commit/?id=cbf59dd662cea8786c2f3a5ea21f8da64f002b30 +https://github.com/rui314/mold/issues/1255 +https://bugs.gentoo.org/931782 + +From cbf59dd662cea8786c2f3a5ea21f8da64f002b30 Mon Sep 17 00:00:00 2001 +From: mojyack <mojyack@gmail.com> +Date: Sun, 12 May 2024 12:13:06 -0400 +Subject: aarch64 crti.o: fix alignment of _init/_fini + +without explicit alignment directives, whether they end up at the +necessary alignment depends on linker/linking conditions. initially +reported as mold issue 1255. +--- a/crt/aarch64/crti.s ++++ b/crt/aarch64/crti.s +@@ -1,6 +1,7 @@ + .section .init + .global _init + .type _init,%function ++.align 2 + _init: + stp x29,x30,[sp,-16]! + mov x29,sp +@@ -8,6 +9,7 @@ _init: + .section .fini + .global _fini + .type _fini,%function ++.align 2 + _fini: + stp x29,x30,[sp,-16]! + mov x29,sp +-- +cgit v1.2.1 diff --git a/sys-libs/musl/files/musl-1.2.4-elfutils-0.190-relr.patch b/sys-libs/musl/files/musl-1.2.4-elfutils-0.190-relr.patch new file mode 100644 index 000000000000..e5eaf46f7810 --- /dev/null +++ b/sys-libs/musl/files/musl-1.2.4-elfutils-0.190-relr.patch @@ -0,0 +1,73 @@ +https://www.openwall.com/lists/musl/2023/11/06/3 +https://inbox.vuxu.org/musl/20231106113336.3664-2-ncopa@alpinelinux.org/T/#u +https://sourceware.org/bugzilla/show_bug.cgi?id=31034 +https://bugs.gentoo.org/916857 + +From mboxrd@z Thu Jan 1 00:00:00 1970 +X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org +X-Spam-Level: +X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, + MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, + RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham + autolearn_force=no version=3.4.4 +Received: (qmail 5179 invoked from network); 6 Nov 2023 11:46:34 -0000 +Received: from second.openwall.net (193.110.157.125) + by inbox.vuxu.org with ESMTPUTF8; 6 Nov 2023 11:46:34 -0000 +Received: (qmail 30570 invoked by uid 550); 6 Nov 2023 11:46:29 -0000 +Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm +Precedence: bulk +List-Post: <mailto:musl@lists.openwall.com> +List-Help: <mailto:musl-help@lists.openwall.com> +List-Unsubscribe: <mailto:musl-unsubscribe@lists.openwall.com> +List-Subscribe: <mailto:musl-subscribe@lists.openwall.com> +List-ID: <musl.lists.openwall.com> +Reply-To: musl@lists.openwall.com +Received: (qmail 30538 invoked from network); 6 Nov 2023 11:46:29 -0000 +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alpinelinux.org; + s=smtp; t=1699271177; + h=from:from:reply-to:subject:subject:date:date:message-id:message-id: + to:to:cc:cc:mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding; + bh=73HDLjg72r1JGckDGbEyPxYrYL7dC7MB3gMwy/yp7hc=; + b=pSGCs/DrFDbs9eEA89un578pZbyzpmTw81QGH7xK4ZAAkYiXx1ysaXlsllwxGd076F+plw + kE1QbGVndutc+ieeUOiHomF4O8IP4AqO/8xCy52LlYmnhMTcxgoXD/GWHfVcXmIgFb+8Uc + jvgM9nXFOXceFSlHLLOwJBQFE2dyBrU= +From: Natanael Copa <ncopa@alpinelinux.org> +To: musl@lists.openwall.com +Cc: Natanael Copa <ncopa@alpinelinux.org> +Date: Mon, 6 Nov 2023 12:33:37 +0100 +Message-ID: <20231106113336.3664-2-ncopa@alpinelinux.org> +X-Mailer: git-send-email 2.42.1 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Subject: [musl] [PATCH] elf.h: add typedefs for Elf*_Relr + +Add typedefs for Elf32_Relr and Elf64_Relr as a follow-up to commit +d32dadd60efb (ldso: support DT_RELR relative relocation format) + +--- +This fixes build of iproute2 with elfutils 0.190, which assumes that +Elf*_Relr are typedef'ed when SHT_RELR is defined. + +ref: https://sourceware.org/git/?p=elfutils.git;a=commit;h=39f2c500542f69c2f1a13fd0ae4eaa5778d2ed8d +ref: https://sourceware.org/bugzilla/show_bug.cgi?id=31034 + + include/elf.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/include/elf.h b/include/elf.h +index 23f2c4bc..aa186d9d 100644 +--- a/include/elf.h ++++ b/include/elf.h +@@ -32,6 +32,9 @@ typedef uint16_t Elf64_Section; + typedef Elf32_Half Elf32_Versym; + typedef Elf64_Half Elf64_Versym; + ++typedef Elf32_Word Elf32_Relr; ++typedef Elf64_Xword Elf64_Relr; ++ + #define EI_NIDENT (16) + + typedef struct { +-- +2.42.1 |