From patchwork Thu Mar 16 13:43:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 95397 Delivered-To: patch@linaro.org Received: by 10.140.89.134 with SMTP id v6csp823197qgd; Thu, 16 Mar 2017 06:43:42 -0700 (PDT) X-Received: by 10.84.215.23 with SMTP id k23mr12483633pli.58.1489671822097; Thu, 16 Mar 2017 06:43:42 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id u123si5349776pgc.280.2017.03.16.06.43.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Mar 2017 06:43:42 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-77957-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-77957-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-77957-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=tkKyB3QfMhi0rQkVuI5G71Ysh4fUnmN0bXWfL2Q1W0YHO5jAfpOya sZlOaP6E09ueBQZVLEsnnhOD0djv8JrJiaSA9x2oU1PZdU+OT6XQSxai0YGLkstN Uxs2035q1/LsgMC3kYBliY7EbK7K9ho/MZvOry3vU6zDcMHXcNxCQg= 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:from:to:subject:date:message-id; s=default; bh=ATghLRhzg0gxCR/vDOmH8lvmllo=; b=EOlQukf04MsZ8RlOhNM/51Oy1JYU H5+ofWp+6dDSDflGYL61HaxgXOksQ47vogdjtHMDq8BvwGRL3zz71nVW/ob87pE/ kxifgcriIU/9zh5vWKMNvZGImlCcxLMxF7hMe3NHBvtRx+yrY/pFTQfC0tS6qac/ RUI7otwmkoTvY78= Received: (qmail 92787 invoked by alias); 16 Mar 2017 13:43:22 -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 92754 invoked by uid 89); 16 Mar 2017 13:43:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=20042017 X-HELO: mail-qk0-f172.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=wvvYTrcH3g/jxNX1ecf3Z0ec+wbTktBbP48IfMBPR0s=; b=qE6YO2uqSwc9zo1crBabVRthr26nmlEipsorafh/1l3s+LZdtRY1koVBWuAzvN6JJ3 mhOCMK9wnNys3TvIaiuFQoxRcHhUBoBn/Mecns2DuJ4Crz90RuJzZMNmQdCe76aj+oQ2 BMUXqB7ZX1iQo5vosOeeH4HWbUMiKINfP5WHm1+5GkJu0stmhXVOdL6Qz549X+NbujB1 iHIPhTFormohb/WPRhYH4SQKE+bSF+rJ0TVJSPaEK1FHcvdNbO19LFAYLkVJ8aUBvveB Em1GJecg5Gg9UPcaoyivSt5E/t6pJ5KLmu/QaH64JkbkxtMYhZchhn5NEdgu5k78/gy8 s2qQ== X-Gm-Message-State: AFeK/H1mMtqlsmU+ejKjL1jFw0xBkm7vwlrkZkAZE17LxcIOobEFW8CAfm1jm/19hrhoEcl5 X-Received: by 10.55.197.18 with SMTP id p18mr7290864qki.289.1489671796945; Thu, 16 Mar 2017 06:43:16 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/2] Build divdi3 only for architecture that required it Date: Thu, 16 Mar 2017 10:43:09 -0300 Message-Id: <1489671790-7611-1-git-send-email-adhemerval.zanella@linaro.org> As noted in [1], divdi3 object is only exported in a handful ABIs (i386, m68k, powerpc32, s390-32, and ia64), however it is built for all current architectures regardless. This patch refact the make rules for this object to so only the aforementioned architectures that actually require it builds it. Also, to avoid internal PLT calls to the exported symbol from the module, glibc uses an internal header (symbol-hacks.h) which is unrequired (and in fact breaks the build for architectures that intend to get symbol definitions from libgcc.a). The patch also changes it to create its own header (divdi3-symbol-hacks.h) and adjust the architectures that require it accordingly. I checked the build/check (with run-built-tests=no) on the following architectures (which I think must cover all supported ABI/builds) using GCC 6.3: aarch64-linux-gnu alpha-linux-gnu arm-linux-gnueabihf hppa-linux-gnu ia64-linux-gnu m68k-linux-gnu microblaze-linux-gnu mips64-n32-linux-gnu mips-linux-gnu mips64-linux-gnu nios2-linux-gnu powerpc-linux-gnu powerpc-linux-gnu-power4 powerpc64-linux-gnu powerpc64le-linux-gnu s390x-linux-gnu s390-linux-gnu sh4-linux-gnu sh4-linux-gnu-soft sparc64-linux-gnu sparcv9-linux-gnu tilegx-linux-gnu tilegx-linux-gnu-32 tilepro-linux-gnu x86_64-linux-gnu x86_64-linux-gnu-x32 i686-linux-gnu I only saw one regression on sparcv9-linux-gnu (extra PLT call to .udiv) which I address in next patch in the set. It also correctly build SH with GCC 7.0.1 (without any regression from c89721e25d). [1] https://sourceware.org/ml/libc-alpha/2017-03/msg00243.html * sysdeps/i386/symbol-hacks.h: New file. * sysdeps/m68k/symbol-hacks.h: New file. * sysdeps/powerpc/powerpc32/symbol-hacks.h: New file. * sysdeps/s390/s390-32/symbol-hacks.h: New file. * sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = csu] (sysdep_routines): New rule: divdi3 object. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/m68k/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/wordsize-32/Makefile: Remove file. * sysdeps/wordsize-32/symbol-hacks.h: Definitions move to ... * sysdeps/wordsize-32/divdi3-symbol-hacks.h: ... here. --- ChangeLog | 26 ++++++++++++++++++++++ sysdeps/i386/symbol-hacks.h | 21 +++++++++++++++++ sysdeps/m68k/symbol-hacks.h | 21 +++++++++++++++++ sysdeps/powerpc/powerpc32/symbol-hacks.h | 21 +++++++++++++++++ sysdeps/s390/s390-32/symbol-hacks.h | 19 ++++++++++++++++ sysdeps/unix/sysv/linux/i386/Makefile | 5 +++++ sysdeps/unix/sysv/linux/m68k/Makefile | 5 +++++ sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile | 8 +++++++ sysdeps/unix/sysv/linux/s390/s390-32/Makefile | 8 +++++++ sysdeps/wordsize-32/Makefile | 7 ------ .../{symbol-hacks.h => divdi3-symbol-hacks.h} | 8 +++---- 11 files changed, 138 insertions(+), 11 deletions(-) create mode 100644 sysdeps/i386/symbol-hacks.h create mode 100644 sysdeps/m68k/symbol-hacks.h create mode 100644 sysdeps/powerpc/powerpc32/symbol-hacks.h create mode 100644 sysdeps/s390/s390-32/symbol-hacks.h delete mode 100644 sysdeps/wordsize-32/Makefile rename sysdeps/wordsize-32/{symbol-hacks.h => divdi3-symbol-hacks.h} (89%) -- 2.7.4 diff --git a/sysdeps/i386/symbol-hacks.h b/sysdeps/i386/symbol-hacks.h new file mode 100644 index 0000000..36a13c8 --- /dev/null +++ b/sysdeps/i386/symbol-hacks.h @@ -0,0 +1,21 @@ +/* Hacks needed for symbol manipulation. i386 version. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#include_next "symbol-hacks.h" diff --git a/sysdeps/m68k/symbol-hacks.h b/sysdeps/m68k/symbol-hacks.h new file mode 100644 index 0000000..e449d29 --- /dev/null +++ b/sysdeps/m68k/symbol-hacks.h @@ -0,0 +1,21 @@ +/* Hacks needed for symbol manipulation. m68k version. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#include_next "symbol-hacks.h" diff --git a/sysdeps/powerpc/powerpc32/symbol-hacks.h b/sysdeps/powerpc/powerpc32/symbol-hacks.h new file mode 100644 index 0000000..dbb3141 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/symbol-hacks.h @@ -0,0 +1,21 @@ +/* Hacks needed for symbol manipulation. powerpc version. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#include_next "symbol-hacks.h" diff --git a/sysdeps/s390/s390-32/symbol-hacks.h b/sysdeps/s390/s390-32/symbol-hacks.h new file mode 100644 index 0000000..82fb0f6 --- /dev/null +++ b/sysdeps/s390/s390-32/symbol-hacks.h @@ -0,0 +1,19 @@ +/* Hacks needed for symbol manipulation. s390 version. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile index 6aac0df..4080b8c 100644 --- a/sysdeps/unix/sysv/linux/i386/Makefile +++ b/sysdeps/unix/sysv/linux/i386/Makefile @@ -26,6 +26,11 @@ endif ifeq ($(subdir),csu) sysdep-dl-routines += sysdep +ifeq (yes,$(build-shared)) +sysdep_routines += divdi3 +shared-only-routines += divdi3 +CPPFLAGS-divdi3.c = -Din_divdi3_c +endif endif ifeq ($(subdir),nptl) diff --git a/sysdeps/unix/sysv/linux/m68k/Makefile b/sysdeps/unix/sysv/linux/m68k/Makefile index 5c50ce6..ce1f696 100644 --- a/sysdeps/unix/sysv/linux/m68k/Makefile +++ b/sysdeps/unix/sysv/linux/m68k/Makefile @@ -4,6 +4,11 @@ m68k-syntax-flag = -DMOTOROLA_SYNTAX ifeq ($(subdir),csu) sysdep_routines += m68k-helpers +ifeq (yes,$(build-shared)) +sysdep_routines += divdi3 +shared-only-routines += divdi3 +CPPFLAGS-divdi3.c = -Din_divdi3_c +endif endif ifeq ($(subdir),misc) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile index 3d6c150..1f45659 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile @@ -1,2 +1,10 @@ # See Makeconfig regarding the use of default-abi. default-abi := 32 + +ifeq ($(subdir),csu) +ifeq (yes,$(build-shared)) +sysdep_routines += divdi3 +shared-only-routines += divdi3 +CPPFLAGS-divdi3.c = -Din_divdi3_c +endif +endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Makefile b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile index da3b3c7..fd8cf92 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/Makefile +++ b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile @@ -21,3 +21,11 @@ endif ifeq ($(subdir),stdlib) sysdep_routines += __makecontext_ret endif + +ifeq ($(subdir),csu) +ifeq (yes,$(build-shared)) +sysdep_routines += divdi3 +shared-only-routines += divdi3 +CPPFLAGS-divdi3.c = -Din_divdi3_c +endif +endif diff --git a/sysdeps/wordsize-32/Makefile b/sysdeps/wordsize-32/Makefile deleted file mode 100644 index 82beac4..0000000 --- a/sysdeps/wordsize-32/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -ifeq ($(subdir),csu) -ifeq (yes,$(build-shared)) -sysdep_routines += divdi3 -shared-only-routines += divdi3 -CPPFLAGS-divdi3.c = -Din_divdi3_c -endif -endif diff --git a/sysdeps/wordsize-32/symbol-hacks.h b/sysdeps/wordsize-32/divdi3-symbol-hacks.h similarity index 89% rename from sysdeps/wordsize-32/symbol-hacks.h rename to sysdeps/wordsize-32/divdi3-symbol-hacks.h index 0aec1e0..6c90cb7 100644 --- a/sysdeps/wordsize-32/symbol-hacks.h +++ b/sysdeps/wordsize-32/divdi3-symbol-hacks.h @@ -1,4 +1,4 @@ -/* Hacks needed for symbol manipulation. +/* Hacks needed for divdi3 symbol manipulation. Copyright (C) 2004-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,13 +16,13 @@ License along with the GNU C Library; if not, see . */ -#include_next "symbol-hacks.h" - /* A very dirty trick: gcc emits references to __divdi3, __udivdi3, __moddi3, and __umoddi3. These functions are exported and therefore we get PLTs. Unnecessarily so. Changing gcc is a big task which might not be worth it so we play tricks with the - assembler. */ + assembler. + Note: in_divdi3_c is only used to avoid symbol alias on divdi3 + build itself. */ #if !defined __ASSEMBLER__ && !defined in_divdi3_c && IS_IN (libc) && defined SHARED asm ("__divdi3 = __divdi3_internal"); asm ("__udivdi3 = __udivdi3_internal");