This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [google/integration] Add support for powerpc64-grtev2-linux-gnu (issue5659050)


On Mon, Feb 13, 2012 at 6:41 PM, Doug Kwan <dougkwan@google.com> wrote:
> Hi,
>
> This patch adds support for powerpc*-grtev2-linux-gnu. ÂThe changes
> include:
>
> 1. Relocating the dynamic linker using a run-time root prefix.
> 2. Using different library setting in static linking.
>
> This is tested by building PowerPC64 and PowerPC toolchains and ran
> some tests with the resulting toolchain.
>
> This is used by Google and is not meant to be sent to trunk.
>
> -Doug
>
> 2012-02-13 Â Doug Kwan Â<dougkwan@google.com>
>
> Â Â Â Â* gcc/config.gcc (powerpc*-*-linux): Pull in GRTEv2 spec changes if
> Â Â Â Âtarget matches *-grtev2-*.
> Â Â Â Â* gcc/config/rs6000/linux64.h (GLIB_DYNAMIC_LINKER{32,64}): Add
> Â Â Â Âruntime root prefix to glibc's dynamic linker.
> Â Â Â Â* gcc/config/rs6000/linux-grtev2.h: New file.
> Â Â Â Â* gcc/config/rs6000/sysv4.h (GLIB_DYNAMIC_LINKER): Add
> Â Â Â Âruntime root prefix to glibc's dynamic linker.
> Â Â Â Â(LINUX_GRTE_EXTRA_SPECS): Define to be empty if no definition found.
> Â Â Â Â(SUBTARGET_EXTRA_SPECS): Include LINUX_GRTE_EXTRA_SPECS.
>
> Index: gcc/config.gcc
> ===================================================================
> --- gcc/config.gcc   Â(revision 184150)
> +++ gcc/config.gcc   Â(working copy)
> @@ -2040,6 +2040,12 @@ powerpc-*-linux* | powerpc64-*-linux*)
> Â Â Â Âif test x${enable_secureplt} = xyes; then
> Â Â Â Â Â Â Â Âtm_file="rs6000/secureplt.h ${tm_file}"
> Â Â Â Âfi
> + Â Â Â # Pull in spec changes for GRTEv2 configurations.
> + Â Â Â case ${target} in
> + Â Â Â *-grtev2-*)
> + Â Â Â Â Â tm_file="${tm_file} rs6000/linux-grtev2.h"
> + Â Â Â Â Â ;;
> + Â Â Â esac
> Â Â Â Â;;
> Âpowerpc-wrs-vxworks|powerpc-wrs-vxworksae)
> Â Â Â Âtm_file="${tm_file} elfos.h freebsd-spec.h rs6000/sysv4.h"
> Index: gcc/config/rs6000/linux64.h
> ===================================================================
> --- gcc/config/rs6000/linux64.h (revision 184150)
> +++ gcc/config/rs6000/linux64.h (working copy)
> @@ -367,8 +367,8 @@ extern int dot_symbols;
> Â#undef LINK_OS_DEFAULT_SPEC
> Â#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
>
> -#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
> -#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
> +#define GLIBC_DYNAMIC_LINKER32 RUNTIME_ROOT_PREFIX "/lib/ld.so.1"
> +#define GLIBC_DYNAMIC_LINKER64 RUNTIME_ROOT_PREFIX "/lib64/ld64.so.1"
> Â#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
> Â#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
> Â#if DEFAULT_LIBC == LIBC_UCLIBC
> Index: gcc/config/rs6000/linux-grtev2.h
> ===================================================================
> --- gcc/config/rs6000/linux-grtev2.h  Â(revision 0)
> +++ gcc/config/rs6000/linux-grtev2.h  Â(revision 0)
> @@ -0,0 +1,43 @@
> +/* Definitions for Linux-based GRTE (Google RunTime Environment) version 2.
> + Â Copyright (C) 2009,2010,2011,2012 Free Software Foundation, Inc.
> + Â Contributed by Chris Demetriou and Ollie Wild.
> +
> +This file is part of GCC.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> +GNU General Public License for more details.
> +
> +Under Section 7 of GPL version 3, you are granted additional
> +permissions described in the GCC Runtime Library Exception, version
> +3.1, as published by the Free Software Foundation.
> +
> +You should have received a copy of the GNU General Public License and
> +a copy of the GCC Runtime Library Exception along with this program;
> +see the files COPYING3 and COPYING.RUNTIME respectively. ÂIf not, see
> +<http://www.gnu.org/licenses/>. Â*/
> +
> +/* Overrides LIB_LINUX_SPEC from sysv4.h. Â*/
> +#undef LIB_LINUX_SPEC
> +#define LIB_LINUX_SPEC \
> + Â"%{pthread:-lpthread} \
> + Â %{shared:-lc} \
> + Â %{!shared:%{mieee-fp:-lieee} %{profile:%(libc_p)}%{!profile:%(libc)}}"
> +
> +/* When GRTE links statically, it needs its NSS and resolver libraries
> + Â linked in as well. ÂNote that when linking statically, these are
> + Â enclosed in a group by LINK_GCC_C_SEQUENCE_SPEC. Â*/
> +#undef LINUX_GRTE_EXTRA_SPECS
> +#define LINUX_GRTE_EXTRA_SPECS \
> + Â{ "libc", "%{static:%(libc_static);:-lc}" }, \
> + Â{ "libc_p", "%{static:%(libc_p_static);:-lc_p}" }, \
> + Â{ "libc_static", \
> + Â Â"-lc -lnss_borg -lnss_cache -lnss_dns -lnss_files -lresolv" }, \
> + Â{ "libc_p_static", \
> + Â Â"-lc_p -lnss_borg_p -lnss_cache_p -lnss_dns_p -lnss_files_p -lresolv_p" },

Really can't you fix glibc so that libnss.a is not needed.
See http://sourceware.org/bugzilla/show_bug.cgi?id=6528 for those fixes.

Thanks,
Andrew Pinski


> Index: gcc/config/rs6000/sysv4.h
> ===================================================================
> --- gcc/config/rs6000/sysv4.h  (revision 184150)
> +++ gcc/config/rs6000/sysv4.h  (working copy)
> @@ -803,7 +803,10 @@ extern int fixuplabelno;
>
> Â#define LINK_START_LINUX_SPEC ""
>
> -#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
> +#ifndef RUNTIME_ROOT_PREFIX
> +#define RUNTIME_ROOT_PREFIX ""
> +#endif
> +#define GLIBC_DYNAMIC_LINKER RUNTIME_ROOT_PREFIX "/lib/ld.so.1"
> Â#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
> Â#if DEFAULT_LIBC == LIBC_UCLIBC
> Â#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
> @@ -881,6 +884,11 @@ ncrtn.o%s"
> Â#define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
> Â#endif
>
> +/* These may be provided by rs6000/linux-grtev2.h. Â*/
> +#ifndef LINUX_GRTE_EXTRA_SPECS
> +#define LINUX_GRTE_EXTRA_SPECS
> +#endif
> +
> Â/* Define any extra SPECS that the compiler needs to generate. Â*/
> Â/* Override rs6000.h definition. Â*/
> Â#undef SUBTARGET_EXTRA_SPECS
> @@ -949,6 +957,7 @@ ncrtn.o%s"
> Â { "cpp_os_openbsd", Â Â Â Â ÂCPP_OS_OPENBSD_SPEC }, Â Â Â Â Â Â Â Â Â\
> Â { "cpp_os_default", Â Â Â Â ÂCPP_OS_DEFAULT_SPEC }, Â Â Â Â Â Â Â Â Â\
> Â { "fbsd_dynamic_linker", Â Â FBSD_DYNAMIC_LINKER }, Â Â Â Â Â Â Â Â Â\
> + ÂLINUX_GRTE_EXTRA_SPECS Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \
> Â SUBSUBTARGET_EXTRA_SPECS
>
> Â#define    ÂSUBSUBTARGET_EXTRA_SPECS
>
> --
> This patch is available for review at http://codereview.appspot.com/5659050


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]