From patchwork Thu Mar 27 18:47:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 317 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (caibbdcaabij.dreamhost.com [208.113.200.189]) by wilcox.dreamhost.com (Postfix) with ESMTP id 556FE360557 for ; Thu, 27 Mar 2014 11:47:22 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14307373) id EAAA44FC677E; Thu, 27 Mar 2014 11:47:21 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx22.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx22.g.dreamhost.com (Postfix) with ESMTPS id C4CFF4FA3B24 for ; Thu, 27 Mar 2014 11:47:21 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=l+sn/+JFn4EpVJBh 3QngANwhJzNd6So5b6/td9bgvPxe84rKUM1RmTqQPHxi79P2FFa+CUb5drCg9j90 BODV3pXk+iXJoenPPhLNjWvK4PIsmUkzvQCeplSTOXbg0iKqqzZ+lpwTVh1Iy3Pt MfHlMM68dAH6FM+jUbhv8aeW8kk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=default; bh=nouWoFRXTfLZUesWkVloVU DtHzE=; b=gM+Rosea6jHwvnvUBgsEaTCgMhBtItcInd9U9xY1FillhIHDUxROVp GyiSYhLIW+tFl9cllkTd1HGzByJ4qRU7K11Frl0Q9DeGHzHmzCVJMQeWzM8kaEOb GtBr5vl2ObvDa+7z4DvJlxrVs5lrzYZS9jiZDTpsRKrSUkOK1t26I= Received: (qmail 23780 invoked by alias); 27 Mar 2014 18:47:19 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23765 invoked by uid 89); 27 Mar 2014 18:47:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e24smtp01.br.ibm.com Message-ID: <53347225.9040201@linux.vnet.ibm.com> Date: Thu, 27 Mar 2014 15:47:01 -0300 From: Adhemerval Zanella User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: libc-alpha@sourceware.org CC: Roland McGrath Subject: Re: [PATCH] PowerPC: define _CALL_ELF if compiler does not define it References: <532C87B9.6020905@linux.vnet.ibm.com> <20140321201050.CE398744AC@topped-with-meat.com> In-Reply-To: <20140321201050.CE398744AC@topped-with-meat.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14032718-1524-0000-0000-00000951A7BE X-DH-Original-To: glibc@patchwork.siddhesh.in On 21-03-2014 17:10, Roland McGrath wrote: > It seems questionable to modify CFLAGS for this. It probably belongs in > CPPFLAGS, to begin with. But I'm not sure I like it modifying the user's > CPPFLAGS either. It might be best to add a new config.make variable for > configure-deduced (as opposed to user-specified) CPPFLAGS and accumulate > into that. It would be an analogue to config-extra-cflags > (libc_extra_cflags in configure). While you're at it, generalize > libc_extra_cflags so it accumulates and could be used by sysdeps configure > fragments, rather than just being single-purpose as it is today. > Something like this: This patch make the configure adds -D_CALL_ELF=1 when compiler does not define _CALL_ELF (versions before powerpc64le support). It cleans up compiler warnings on old compiler where _CALL_ELF is not defined on powerpc64(be) builds. It does by add a new config.make variable for configure-deduced CPPFLAGS and accumulate into that (confix-extra-cppflags). It also generalizes libc_extra_cflags so it accumulates in sysdeps configure fragmenets. --- * Makeconfig (CPPFLAGS): Add config-extra-cppflags t list. * config.make.in (config-extra-cppflags): Set it from libc_extra_cppflags. * configure.ac (libc_extra_cflags): Make it accumulate over configure fragments. (libc_extra_cppflags): New flag. * configure. Regenerate. * sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac (libc_cv_ppc64_def_call_elf): Define it to yes if compiler does not set _CALL_ELF and add -D_CALL_ELF=1 to libc_extra_cppflags. * sysdeps/unix/sysv/linux/powerpc/powerpc64/configure: Regenerate. --- diff --git a/Makeconfig b/Makeconfig index 3338ab6..f965398 100644 --- a/Makeconfig +++ b/Makeconfig @@ -792,7 +792,8 @@ libio-include = -I$(..)libio # Note that we can't use -std=* in CPPFLAGS, because it overrides # the implicit -lang-asm and breaks cpp behavior for .S files--notably # it causes cpp to stop predefining __ASSEMBLER__. -CPPFLAGS = $(CPPUNDEFS) $(CPPFLAGS-config) $($(subdir)-CPPFLAGS) \ +CPPFLAGS = $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \ + $($(subdir)-CPPFLAGS) \ $(+includes) $(defines) \ -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \ $(CPPFLAGS-$(suffix $@)) \ diff --git a/config.make.in b/config.make.in index 416fb9e..132d179 100644 --- a/config.make.in +++ b/config.make.in @@ -37,6 +37,7 @@ cflags-cpu = @libc_cv_cc_submachine@ asflags-cpu = @libc_cv_cc_submachine@ config-extra-cflags = @libc_extra_cflags@ +config-extra-cppflags = @libc_extra_cppflags@ config-cflags-nofma = @libc_cv_cc_nofma@ defines = @DEFINES@ diff --git a/configure b/configure index d4b5edb..ee139bb 100755 --- a/configure +++ b/configure @@ -591,6 +591,7 @@ libc_cv_slibdir old_glibc_headers use_nscd libc_cv_gcc_unwind_find_fde +libc_extra_cppflags libc_extra_cflags CPPUNDEFS sizeof_long_double @@ -7199,9 +7200,9 @@ fi $as_echo "$libc_cv_predef_stack_protector" >&6; } libc_extra_cflags= if test $libc_cv_predef_stack_protector = yes; then - libc_extra_cflags=-fno-stack-protector + libc_extra_cflags+=-fno-stack-protector fi - +libc_extra_cppflags= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker provides __ehdr_start" >&5 $as_echo_n "checking whether the linker provides __ehdr_start... " >&6; } @@ -7266,6 +7267,9 @@ $as_echo "running configure fragment for $dir" >&6; } fi done + + + if test x$libc_cv_gcc_unwind_find_fde = xyes; then $as_echo "#define EXPORT_UNWIND_FIND_FDE 1" >>confdefs.h diff --git a/configure.ac b/configure.ac index 43bd8a5..46b37b5 100644 --- a/configure.ac +++ b/configure.ac @@ -2042,9 +2042,9 @@ esac], ]) libc_extra_cflags= if test $libc_cv_predef_stack_protector = yes; then - libc_extra_cflags=-fno-stack-protector + libc_extra_cflags+=-fno-stack-protector fi -AC_SUBST(libc_extra_cflags) +libc_extra_cppflags= AC_CACHE_CHECK([whether the linker provides __ehdr_start], libc_cv_ehdr_start, [ @@ -2091,6 +2091,9 @@ for dir in $sysnames; do fi done +AC_SUBST(libc_extra_cflags) +AC_SUBST(libc_extra_cppflags) + if test x$libc_cv_gcc_unwind_find_fde = xyes; then AC_DEFINE(EXPORT_UNWIND_FIND_FDE) fi diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure index fbb6334..7f4a7c4 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure @@ -163,4 +163,31 @@ default-abi = 64-v2" else config_vars="$config_vars default-abi = 64-v1" + # Compiler that do not support ELFv2 ABI does not define _CALL_ELF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler defines _CALL_ELF" >&5 +$as_echo_n "checking whether the compiler defines _CALL_ELF... " >&6; } +if ${libc_cv_ppc64_def_call_elf+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef _CALL_ELF + yes + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then : + libc_cv_ppc64_def_call_elf=yes +else + libc_cv_ppc64_def_call_elf=no +fi +rm -f conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ppc64_def_call_elf" >&5 +$as_echo "$libc_cv_ppc64_def_call_elf" >&6; } + if test $libc_cv_ppc64_def_call_elf = no; then + libc_extra_cppflags+=" -D_CALL_ELF=1" + fi fi diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac index c9cd4bc..5733f79 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac @@ -12,4 +12,14 @@ if test $libc_cv_ppc64_elfv2_abi = yes; then LIBC_CONFIG_VAR([default-abi], [64-v2]) else LIBC_CONFIG_VAR([default-abi], [64-v1]) + # Compiler that do not support ELFv2 ABI does not define _CALL_ELF + AC_CACHE_CHECK([whether the compiler defines _CALL_ELF], + [libc_cv_ppc64_def_call_elf], + [AC_EGREP_CPP(yes,[#ifdef _CALL_ELF + yes + #endif + ], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)]) + if test $libc_cv_ppc64_def_call_elf = no; then + libc_extra_cppflags+=" -D_CALL_ELF=1" + fi fi