From patchwork Tue Oct 24 09:31:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 829840 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-464933-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Jnuda93b"; dkim-atps=neutral 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 3yLp2B1bbhz9sBd for ; Tue, 24 Oct 2017 20:32:00 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=Nc07ypoQb+slAMiB8 Q0xA3+o4OVvOQXXuc4Xu/d4qjqb5ZkOcCavU4AIuVMud1waYGglNJdMN2d00VJ8f POMrp1bAMinaJo8kF0Rq7n9fTb+2rpCjksbnM24INVnJVhtS6Y8toKkEm/8c9Lsl AkEX42h+0Yb0TK+dkWBXrlCiFw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=mzcRemGRma/SU1ZZ811l5Am P8/w=; b=Jnuda93bIyCbFXFbjUTOA+a6BvhoUDybtudBi7T+cWgvM6twIc1QFA6 ksGY2zcC+JHHL9TYKsGOT8d99QJQTt1A3j8nT0wvhBBSgTWwng/BvAP31A+/DeJd LuDrPnvNwxM6rO/Od3rkIxyQZjn8MFewoQ335LQEcr1ZtiE5YNLM= Received: (qmail 107420 invoked by alias); 24 Oct 2017 09:31:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 106795 invoked by uid 89); 24 Oct 2017 09:31:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=endless X-HELO: mail-pf0-f173.google.com Received: from mail-pf0-f173.google.com (HELO mail-pf0-f173.google.com) (209.85.192.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Oct 2017 09:31:46 +0000 Received: by mail-pf0-f173.google.com with SMTP id t188so19261404pfd.10 for ; Tue, 24 Oct 2017 02:31:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=v5txwLJh9KZCeti6LcUB3DiZM9BYEoggTFy/9dPdAAg=; b=T0wqvlCUl214cJ0FI62VpZ5gGhpNG6c0oi95zhJjBoNTZc8a+grZmGzPLkrDeJdEBF eFeWRxCvt+9uF3lFPZMAMtCrPeBJgHIFceNWsdTDtLVulImTkSTSezva0lX6EVWFGxRL Dky/Ph2WUgzO6OEzpaTFcdyXZOEOYLIDDnVj7lG9IXoPbyiHjpbuAlS3BO+AVf7WTryw 05Em9sr/U08OqGrH0m4Qrnd11vJQL8L4/leYJ/z2/MD5q29T7q/0orLrnp08biRHM875 OCsX4yjkycWnpSkkrUSF8DQcAR8efo2yYsZvRY71TRKeaKFv4iJ7pFiet4vsqKvp5wJZ nGmQ== X-Gm-Message-State: AMCzsaVgtWaMl2VRWerO9GJQexcOoVaX9tTn8LMvSyC0tqgNVW+WAqrt +DbV/xyCoe4CP0JGJpzV24HOZA== X-Google-Smtp-Source: ABhQp+Sodv8bAgOt1GdvQt/cxhAn0AOTll3g6JvNMEzgj4K+WhlLNwYJQIu/JT8zJ+fsqnmnZy1pUA== X-Received: by 10.99.111.6 with SMTP id k6mr14329918pgc.308.1508837504388; Tue, 24 Oct 2017 02:31:44 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-175-73-248.czqe1.win.bigpond.net.au. [58.175.73.248]) by smtp.gmail.com with ESMTPSA id g16sm15213527pgn.43.2017.10.24.02.31.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 02:31:43 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 508BEC2E3B; Tue, 24 Oct 2017 20:01:39 +1030 (ACDT) Date: Tue, 24 Oct 2017 20:01:39 +1030 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: rguenther@suse.de Subject: PR82687, g++.dg/asan/default-options-1.C fails with PR82575 fix Message-ID: <20171024093139.GF27132@bubble.grove.modra.org> References: <20171019133004.GX27132@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171019133004.GX27132@bubble.grove.modra.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Was Re: PR82575, lto debugobj references __gnu_lto_slim, ld test liblto-17 fails On Fri, Oct 20, 2017 at 12:00:04AM +1030, Alan Modra wrote: > PR lto/82575 > * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): > Make discarded non-local symbols weak and hidden. The problem with making discarded symbols hidden is that the non-default visibility is sticky. When symbols other than the __gnu_lto ones are discarded that turns out to be a bad idea. Bootstrapped and regression tested powerpc64le-linux. OK? PR lto/82687 PR lto/82575 * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Only make __gnu_lto symbols hidden. Delete outdated comment. Silence ISO C warning. diff --git a/libiberty/simple-object-elf.c b/libiberty/simple-object-elf.c index 1afd3eb..14f7105 100644 --- a/libiberty/simple-object-elf.c +++ b/libiberty/simple-object-elf.c @@ -1088,6 +1088,7 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, off_t shstroff; unsigned char *names; unsigned int i; + int changed; int *pfnret; const char **pfnname; @@ -1161,7 +1162,6 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, /* Mark sections as preserved that are required by to be preserved sections. */ - int changed; do { changed = 0; @@ -1349,9 +1349,6 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, and __gnu_lto_slim which otherwise cause endless LTO plugin invocation. */ if (st_shndx == SHN_COMMON) - /* Setting st_name to "" seems to work to purge - COMMON symbols (in addition to setting their - size to zero). */ discard = 1; /* We also need to remove symbols refering to sections we'll eventually remove as with fat LTO objects @@ -1368,17 +1365,29 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, /* Make discarded symbols undefined and unnamed in case it is local. */ int bind = ELF_ST_BIND (*st_info); + int other = STV_DEFAULT; + size_t st_name; + if (bind == STB_LOCAL) - { - ELF_SET_FIELD (type_functions, ei_class, Sym, - ent, st_name, Elf_Word, 0); - *st_other = STV_DEFAULT; - } + ELF_SET_FIELD (type_functions, ei_class, Sym, + ent, st_name, Elf_Word, 0); else { bind = STB_WEAK; - *st_other = STV_HIDDEN; + st_name = ELF_FETCH_FIELD (type_functions, ei_class, + Sym, ent, st_name, + Elf_Word); + if (st_name < strsz) + { + char *p = strings + st_name; + if (p[0] == '_' + && p[1] == '_' + && strncmp (p + (p[2] == '_'), + "__gnu_lto_", 10) == 0) + other = STV_HIDDEN; + } } + *st_other = other; *st_info = ELF_ST_INFO (bind, STT_NOTYPE); ELF_SET_FIELD (type_functions, ei_class, Sym, ent, st_value, Elf_Addr, 0);