From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C6C2F1382C5 for ; Thu, 21 May 2020 18:06:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E63BFE081B; Thu, 21 May 2020 18:06:49 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9C00FE081B for ; Thu, 21 May 2020 18:06:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 324D334F29E for ; Thu, 21 May 2020 18:06:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B0032253 for ; Thu, 21 May 2020 18:06:46 +0000 (UTC) From: "Sergei Trofimovich" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sergei Trofimovich" Message-ID: <1590084390.a0bd7f579bc77f7b1d6b1fa2a1afedcd71bbb0d0.slyfox@gentoo> Subject: [gentoo-commits] proj/binutils-config:master commit in: src/ X-VCS-Repository: proj/binutils-config X-VCS-Files: src/binutils-config src/binutils-config.8 src/binutils.eselect X-VCS-Directories: src/ X-VCS-Committer: slyfox X-VCS-Committer-Name: Sergei Trofimovich X-VCS-Revision: a0bd7f579bc77f7b1d6b1fa2a1afedcd71bbb0d0 X-VCS-Branch: master Date: Thu, 21 May 2020 18:06:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9f62c645-ca8a-4b54-9c83-4563cc705b93 X-Archives-Hash: 214b6322b9ed6d93f26f9a5863a9a8d6 commit: a0bd7f579bc77f7b1d6b1fa2a1afedcd71bbb0d0 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu May 21 18:06:30 2020 +0000 Commit: Sergei Trofimovich gentoo org> CommitDate: Thu May 21 18:06:30 2020 +0000 URL: https://gitweb.gentoo.org/proj/binutils-config.git/commit/?id=a0bd7f57 add binutils-config sources as-is Signed-off-by: Sergei Trofimovich gentoo.org> src/binutils-config | 49 +++++++++++-------------------------- src/binutils-config.8 | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/binutils.eselect | 45 ++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 35 deletions(-) diff --git a/src/binutils-config b/src/binutils-config index 945295c..69ca530 100644 --- a/src/binutils-config +++ b/src/binutils-config @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2017 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # Format of /etc/env.d/binutils/: @@ -41,9 +41,6 @@ ${HILITE}General Options:${NORMAL} ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target ${GOOD}-d, --debug${NORMAL} Execute with debug output -${HILITE}General Cruft:${NORMAL} - ${GOOD}--linker${NORMAL} Switch to specified linker (if supported) - Profile names are of the form: ${BRACKET}-${NORMAL} For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL} @@ -145,21 +142,26 @@ switch_profile() { cd "${ROOT}/${LIBPATH}" || exit 1 if [[ ${TARGET} == ${HOST} ]] ; then dstlib=${EROOT}/usr/${HOST}/lib - elif [[ -d ${EROOT}/usr/${TARGET}/lib ]] ; then - # true for at least avr and msp targets - dstlib=${EROOT}/usr/${TARGET}/lib else dstlib=${EROOT}/usr/${HOST}/${TARGET}/lib fi # When upgrading, we need to clean up ldscripts and libs. # Don't symlink back in the libs -- the binutils-lib package handles # these now. - # TODO: Stop requiring even the ldscripts symlink, except - # we can't for bare-metal toolchains, so... bug #147155 + # TODO: Stop requiring even the ldscripts symlink. mkdir -p "${dstlib}" rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts" - find -L "${dstlib}" -xtype l -name 'lib*' -exec rm -f {} + + find -L "${dstlib}" -xtype l -name 'lib*' -delete + # Detect older binutils w/broken rpaths. #562460 + # We can hardcode the "/lib" part since that's what the binutils + # configure scripts have. They did not include any other path. + if [[ $(scanelf -qF '%r#F' "${ROOT}/${BINPATH}/as") == */lib ]] ; then + ewarn "Old cross-binutils detected; please re-emerge to fix (see bug #562460)." + for x in lib* ; do + atomic_ln "${LIBPATH}/${x}" "${dstlib}" "${x}" + done + fi # # Clean out old generated include symlinks @@ -244,7 +246,7 @@ uninstall_target() { local x for x in \ - addr2line ar as c++filt elf2flt elfedit flthdr gprof \ + addr2line ar as c++filt dwp elf2flt elfedit flthdr gprof \ ld ld.{bfd,gold,real} \ nm objcopy objdump ranlib readelf size strings strip do @@ -342,28 +344,6 @@ list_profiles() { done } -switch_linker() { - local bpath ld=$1 - - case ${ld} in - ld.*) ;; - *) die "not supported: linker must start with 'ld.'" ;; - esac - - setup_env || return 1 - bpath="${ROOT}/${BINPATH}" - - # does this binutils even support the requested linker ? - if [[ ! -e ${bpath}/${ld} ]] ; then - die "sorry, but ${PROFILE} doesn't support the ${ld} linker" - fi - - # switch it up - ebegin "Setting default linker to ${ld} for ${PROFILE}" - atomic_ln ${ld} "${bpath}" ld - eend $? -} - set_HOST() { # Set HOST to CHOST if it isn't already set : ${HOST:=${CHOST:-$(portageq envvar CHOST)}} @@ -395,7 +375,6 @@ while [[ $# -gt 0 ]] ; do -c|--get-current-profile) select_action get_current_profile ;; -l|--list|--list-profiles) select_action list_profiles ;; -u|--uninstall) select_action uninstall_target ;; - --linker) select_action "switch_linker $1"; shift ;; -d|--debug) DEBUG="yes" ;; -h|--help) usage 0 ;; -V|--version) @@ -425,7 +404,7 @@ set_HOST # All operations need to know the profile the user wants case ${DOIT} in -switch_profile|switch_linker_*) +switch_profile) # decode user's profile choice x=${UARG:-$(TARGET=${HOST} set_current_profile)} PROFILE="" diff --git a/src/binutils-config.8 b/src/binutils-config.8 new file mode 100644 index 0000000..e8e64de --- /dev/null +++ b/src/binutils-config.8 @@ -0,0 +1,67 @@ +.TH "BINUTILS-CONFIG" "8" "Jan 2005" "Gentoo" "Gentoo" +.SH "NAME" +binutils-config \- manage active versions of the binutils programs +.SH "DESCRIPTION" +The \fBbinutils-config\fR script allows you to switch between different +versions of binutils when you have installed multiple copies (see +USE=multislot). It also allows you to manage multiple cross-compiling +targets simultaneously. + +Remember, you may have one version of binutils active per \fICTARGET\fR, +and changing the version for one target has no bearing on any other. So +changing an active cross-compiler will not break your native compiler +(i.e. \fICHOST\fR). +.SH "SYNOPSIS" +\fBbinutils-config\fR [\fIcrufty options\fR] \fIPROFILE\fR + +\fBbinutils-config\fR \fB--get-current-profile\fR \fI[TARGET]\fR + +\fBbinutils-config\fR \fB--list-profiles\fR + +\fBbinutils-config\fR \fB--uninstall\fR \fITARGET\fR +.SH "GENERIC OPTIONS" +.TP +\fBPROFILE\fR +Change the system to use the specified binutils version. This may take the +form of the list index number (the number shown on the left in the +\fB\-\-list\-profiles\fR output), a full \fITARGET-VERSION\fR (useful when +working with cross-compilers), just a \fITARGET\fR where the \fIVERSION\fR +is picked from the active, or just a binutils \fIVERSION\fR where the +\fITARGET\fR is assumed to be the native \fIHOST\fR value. +.TP +\fBTARGET\fR +Similiar to \fBPROFILE\fR, but this is only the target and no version info +(i.e. \fICTARGET\fR or \fICHOST\fR). +.TP +\fB\-c\fR, \fB\-\-get\-current\-profile\fR \fI[TARGET]\fR +Display the active profile for \fITARGET\fR. If none is specified, the +host system's \fITARGET\fR will be shown (i.e. \fICHOST\fR). +.TP +\fB\-l\fR, \fB\-\-list\-profiles\fR +Show all the profiles that your system currently has installed and what +versions are active. The active native version is noted with a bright green +asterisk while the active cross-compiler versions are noted with a light blue +asterisk. +.TP +\fB-u\fR, \fB\-\-uninstall\fR \fITARGET\fR +This is really for internal use only. Used to remove all traces of the +\fITARGET\fR binutils from your system. +.SH "REPORTING BUGS" +Please report bugs via https://bugs.gentoo.org/ +.SH "SEE ALSO" +.BR ar (1), +.BR as (1), +.BR ld (1), +.BR nm (1), +.BR objcopy (1), +.BR ranlib (1), +.BR readelf (1), +.BR strings (1), +.BR strip (1) +.SH "FILES" +.nf +.BR /usr/bin/binutils-config +.BR /etc/env.d/binutils/* +.fi +.SH "AUTHORS" +Mike Frysinger diff --git a/src/binutils.eselect b/src/binutils.eselect new file mode 100644 index 0000000..a89655a --- /dev/null +++ b/src/binutils.eselect @@ -0,0 +1,45 @@ +# -*-eselect-*- vim: ft=eselect +# Copyright 2005-2015 Gentoo Foundation +# Distributed under the terms of the GNU GPL version 2 or later + +DESCRIPTION="Manage installed versions of sys-devel/binutils" +MAINTAINER="toolchain@gentoo.org" + +### list action + +describe_list() { + echo "List all installed version of binutils" +} + +do_list() { + binutils-config -l +} + +### set action + +describe_set() { + echo "Activate one of the installed binutils" +} + +describe_set_parameters() { + echo "" +} + +describe_set_options() { + echo "target : Target name or number (from 'list' action)" +} + +do_set() { + [[ $# -eq 1 ]] || die -q "Please specify exactly one version to activate!" + binutils-config "$1" +} + +### show action + +describe_show() { + echo "Print the currently active binutils version" +} + +do_show() { + binutils-config -c +}