From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 979091381F3 for ; Sun, 18 Aug 2013 12:18:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 57505E0C62; Sun, 18 Aug 2013 12:18:44 +0000 (UTC) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BABB5E0C62 for ; Sun, 18 Aug 2013 12:18:43 +0000 (UTC) Received: by mail-pd0-f175.google.com with SMTP id q10so3887935pdj.6 for ; Sun, 18 Aug 2013 05:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=cNkkgd0dPKy+71sd94mRyq/Azf+yCTNZE4bxW50Wx4o=; b=wahZVRzznRu7FQziTKWgpg6R9amhAZtOqt6T6CyClrPF4lm0jc5A2cbAh5/+Pb85Ma LYWz31MP/htlGRRYy8mzlUaNIf+gQRMuGJagcI8qyzhDMRppiQjO8Fbq7+qX71OyFJ2m 5AsUyrXb6R5NcvSNtZI+2UK3tiu3V/h/ra8lTuFN0yphdI/bXYMffXd6ssdcCDt0xWfU nWHBSmG2srVR3vDTq4Wr0Y67RsqlskAi/b2Sdy4pcXUiGlyWJ1rstRRxyUIDFo9lRRlC sr9bvEnNo8qXMgrzLsrVCnEL0+FCUz7J28DX/jeagkykr32U2/pcBsmUAWYnADgq1p7G jLkQ== X-Received: by 10.68.107.162 with SMTP id hd2mr2310855pbb.126.1376828322360; Sun, 18 Aug 2013 05:18:42 -0700 (PDT) Received: from proton.in.awa.tohoku.ac.jp (ernie02-dmz.awa.tohoku.ac.jp. [130.34.99.37]) by mx.google.com with ESMTPSA id bb1sm8956044pbc.10.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 18 Aug 2013 05:18:41 -0700 (PDT) From: heroxbd To: gentoo-soc@lists.gentoo.org Cc: redlizard@redlizard.nl Subject: Re: [gentoo-soc] Gentoo on Android, Summary for 2013.6.28-7.1 References: <87mwq6mj4v.fsf@proton.in.awa.tohoku.ac.jp> <51D1995A.8050707@gentoo.org> <87bo6mmhqj.fsf@proton.in.awa.tohoku.ac.jp> <51D19FDF.9080004@gentoo.org> <51ED1EFC.7070607@gentoo.org> <87ppuabx4k.fsf@proton.in.awa.tohoku.ac.jp> <51ED266A.7090400@gentoo.org> Date: Sun, 18 Aug 2013 21:16:00 +0900 In-Reply-To: <51ED266A.7090400@gentoo.org> (Luca Barbato's message of "Mon, 22 Jul 2013 14:32:42 +0200") Message-ID: <871u5r19fj.fsf@proton.in.awa.tohoku.ac.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-soc@lists.gentoo.org Reply-to: gentoo-soc@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain X-Archives-Salt: da8c65e4-a9d8-4aaa-83ef-ccb6337e784c X-Archives-Hash: 58f483244d8b613edd6beb40d09959a5 Dear Luca, Picking up gcc again. Luca Barbato writes: > Upstream can be difficult, supporting multiple c runtime is _quite_ > problematic and requires pointless patching in too many part of the > codebase nowadays =/ Yes, for example, the *link section of gcc amd64: *link: %{!static:--eh-frame-hdr} %{m32|mx32:;:-m elf_x86_64} %{m32:-m elf_i386} %{ mx32:-m elf32_x86_64} %{shared:-shared} %{!shared: %{!static: %{rdynamic:-export-dynamic} %{m 32:-dynamic-linker %{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:/opt/gentoo/lib/ld-linux.so.2}}} %{m32|mx32:;:-dynamic-linker %{muclibc:/lib/ld64-uClibc.so.0;:%{mbionic:/system/bin/linker64;:/opt/gentoo/l ib64/ld-linux-x86-64.so.2}}} %{mx32:-dynamic-linker %{muclibc:/lib/ldx32-uClibc.so.0;:%{mbionic:/system/bin /linkerx32;:/opt/gentoo/libx32/ld-linux-x32.so.2}}}} %{static:-static}} >> An alternative: Given the similar situation in binutils, I am thinking >> of another switch (like --{enable,with}-native-sysroot) to turn >> --with-sysroot into a native (non-cross) version for our purpose. (GLEP >> draft follows) What do you say? > > Worth a try, sadly you need to coordinate with upstream. I spent a whole day trying to get a solution to specify dynamic linker via configure. The plan was: 1. let all the ports of gcc have dynamic_linker section in specs, like that of x86. 2. add a configure option, --with-extra-specs to specify an additional EXTRA_SPECS to gcc.c. 3. use toolchain-funcs.eclass to generate dynamic linker specs, as +# Returns location of dynamic linker +gcc-specs-gen-dynamic-linker() { + echo '*dynamic_linker:' + + local dlinkers + case $(tc-arch)-${CTARGET##*-} in + amd64-gnu*) + for abi in ${MULTILIB_ABIS}; do + case ${abi} in + amd64) dlinkers+=( "m32|mx32:;:/lib64/ld-linux-x86-64.so.2" ) ;; + x86) dlinkers+=( m32:/lib/ld-linux.so.2 ) ;; + x32) dlinkers+=( mx32:/libx32/ld-linux-x32.so.2 ) ;; + esac + done + ;; + x86-gnu*) dlinkers=( /lib/ld-linux.so.2 ) ;; + arm-gnu*) + case ${CTARGET//_/-} in + *-hardfloat-*) dlinkers=( /lib/ld-linux-armhf.so.3 ) ;; + *-softfloat-*) dlinkers=( /lib/ld-linux.so.3 ) ;; + esac + ;; + esac + + for dlinker in ${dlinkers[@]}; do + local ldso=${dlinker##*:} + if [[ ${ldso} == ${dlinker} ]]; then + echo -n "${EPREFIX}"${ldso} + else + local switch=${dlinker%:*} + echo -n "%{${switch}:${EPREFIX}${ldso}}" + fi + done +} But there are intrinsic difficulties. The default specs of gcc are all preprocessed as C macros, which means we cannot pass a specs file to make it default. Furthermore, I could not find a way to pass a customized specs file for building (which is necessary that we have to build gcc against glibc from RAP). Therefore, we have to pass raw C into configure options, like, econf --with-extra-specs='{ "dynamic-linker", "/opt/gentoo/lib/ld-linux.so.2" }' However, GNU autoconf/automake system automatically quote this to a string, while we want to pass an array of structures. Another solution is to prepend sysroot to dynamic linker, which is indifferent to the runtime-prefix patch from Google, criticized by you earlier. Up to this point, the solution becomes complex and artificial. I would rather use the present patch'n'prefixify method, as we used in many ebuild, like: --- gcc/config/i386/linux.h 2011-06-04 03:30:39.000000000 +0900 +++ gcc/config/i386/linux.h.new 2013-07-16 19:55:09.610399047 +0900 @@ -21,4 +21,4 @@ along with GCC; see the file COPYING3. . */ #define GNU_USER_LINK_EMULATION "elf_i386" -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" +#define GLIBC_DYNAMIC_LINKER "@GENTOO_PORTAGE_EPREFIX@/lib/ld-linux.so.2" Cheers, Benda