From patchwork Thu Mar 16 13:43:10 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: 739832 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3vkV6p2DRZz9ryZ for ; Fri, 17 Mar 2017 00:43:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="CIAm+bZR"; dkim-atps=neutral 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:in-reply-to :references; q=dns; s=default; b=H+N/V2qF3EyaYLK8oCMbJ0jsEthP5Il Xkjoxf3QzlQjgIdMr5qtorMukI5I3q9IYoG5nwgGUzTJzsUWd2eCzSP6YR7VW/rs aWSWOSUJ2Gv2Gcsk9ZnMtOfuU3+mO45AMiHt/kOBwUU5xVVsGVR7fqAl9oaSWan6 62ses4C5x8bY= 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:in-reply-to :references; s=default; bh=PCD5cQP4bLTQDVIIBkKtSzm2KaM=; b=CIAm+ bZRMxGUbt2zL3EKgjV0mz8dH1yLh4cgvqB/dDkuWNzNfddNOCYJlHFjPGidwBKvz 6bH2H+UcN4X+JdxRN2adikzh5PH/m2EE+T0DdniM8ACBvd6NDyX4Nvv8pdKrOvKc JvRhhDLKl6UHZsXefh3CZ2v+qTUYBdMRetwbpQ= Received: (qmail 92770 invoked by alias); 16 Mar 2017 13:43:21 -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 92570 invoked by uid 89); 16 Mar 2017 13:43:20 -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=U*$ X-HELO: mail-qt0-f170.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:in-reply-to :references; bh=BBsujHjXmEo/6XxmXY45kOvGNeioliYFCprcC5aGziM=; b=ppkhir66S1oTckEh+s6sD8CbMBVCbYj4r2xqdNMkGhkeGlaSTAieymsUCroG/EiFuc ztuFvf/Q4gAHPZ92rzuaJ71FfONiAzvik6Tud7d1Hle1biYHqfAytdTkdzVK37FEcUED v0qjQWx+W04XUqY4eQhL48GYgz38iDIivzptKiFWeSD38gdb38Vbw2+1zMRqjnxp/z3z nIdeeDkFUX3GQz8UqL8CMGmQjGDHGx/xsr+mzoB1cWaJTCLBf7EURsUhjNVQY0JvJiRo KLfXR5dQGaH4gZ0J1Q7rI22VoMs/I5Wx4zrdZ9FOxM2RZlNH2nFSUDdToXun3jdEjMlb CS0Q== X-Gm-Message-State: AFeK/H1J2pg7BKVEeFb1an5YiBvLAJBtWKD5x1QcGBo9PDHDxsV7mPycuAzaTv5uW9uKMZs0 X-Received: by 10.200.47.161 with SMTP id l30mr8281940qta.248.1489671798336; Thu, 16 Mar 2017 06:43:18 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/2] sparc: Fix .udiv plt on libc Date: Thu, 16 Mar 2017 10:43:10 -0300 Message-Id: <1489671790-7611-2-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1489671790-7611-1-git-send-email-adhemerval.zanella@linaro.org> References: <1489671790-7611-1-git-send-email-adhemerval.zanella@linaro.org> With the removal of divdi3 object from sparcv9-linux-gnu build, its definition came from libgcc and its functions internall calls .udiv. Since glibc also exports these symbols for compatibility reasons, it will end up creating PLT calls internally in libc.so. To avoid it, this patch uses the linker option --wrap to replace all the internal libc.so .udiv calls to the wrapper __wrap_.udiv. Along with strong alias in the udiv implementations, it makes linker do local calls. Checked on sparcv9-linux-gnu. * sysdeps/sparc/sparc32/Makefile (libc.so-gnulib): New rule. * sysdeps/sparc/sparc32/sparcv8/udiv.S (.udiv): Make a strong_alias to __wrap_.udiv. * sysdeps/sparc/sparc32/sparcv9/udiv.S (.udiv): Likewise. * sysdeps/sparc/sparc32/udiv.S (.udiv): Likewise. --- ChangeLog | 6 ++++++ sysdeps/sparc/sparc32/Makefile | 6 ++++++ sysdeps/sparc/sparc32/sparcv8/udiv.S | 1 + sysdeps/sparc/sparc32/sparcv9/udiv.S | 1 + sysdeps/sparc/sparc32/udiv.S | 1 + 5 files changed, 15 insertions(+) diff --git a/sysdeps/sparc/sparc32/Makefile b/sysdeps/sparc/sparc32/Makefile index da20589..6d2a196 100644 --- a/sysdeps/sparc/sparc32/Makefile +++ b/sysdeps/sparc/sparc32/Makefile @@ -47,3 +47,9 @@ $(divrem:%=$(sysdep_dir)/sparc/sparc32/%.S): $(sysdep_dir)/sparc/sparc32/divrem. mv -f $@-tmp $@ sysdep-realclean := $(sysdep-realclean) $(divrem:%=sysdeps/sparc/sparc32/%.S) + +# libgcc __divdi3 and __moddi3 use .udiv and since it is also exported by +# libc.so linker will create PLTs for the symbol. To avoid it we strong alias +# the exported libc one to __wrap_.udiv and use linker option --wrap to make any +# call to .udiv to call the wrapper symbol. +libc.so-gnulib += -Wl,--wrap=.udiv diff --git a/sysdeps/sparc/sparc32/sparcv8/udiv.S b/sysdeps/sparc/sparc32/sparcv8/udiv.S index d719543..e9cab4e 100644 --- a/sysdeps/sparc/sparc32/sparcv8/udiv.S +++ b/sysdeps/sparc/sparc32/sparcv8/udiv.S @@ -13,3 +13,4 @@ ENTRY(.udiv) udiv %o0, %o1, %o0 END(.udiv) +strong_alias (.udiv, __wrap_.udiv) diff --git a/sysdeps/sparc/sparc32/sparcv9/udiv.S b/sysdeps/sparc/sparc32/sparcv9/udiv.S index de79899..368f85e 100644 --- a/sysdeps/sparc/sparc32/sparcv9/udiv.S +++ b/sysdeps/sparc/sparc32/sparcv9/udiv.S @@ -15,3 +15,4 @@ ENTRY(.udiv) udiv %o0, %o1, %o0 END(.udiv) +strong_alias (.udiv, __wrap_.udiv) diff --git a/sysdeps/sparc/sparc32/udiv.S b/sysdeps/sparc/sparc32/udiv.S index 8dfff66..ade0afd 100644 --- a/sysdeps/sparc/sparc32/udiv.S +++ b/sysdeps/sparc/sparc32/udiv.S @@ -344,3 +344,4 @@ LOC(got_result): mov %o2, %o0 END(.udiv) +strong_alias (.udiv, __wrap_.udiv)