From patchwork Mon Jul 15 13:30:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 1131975 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-505092-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz 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 45nPYZ43VWz9sND for ; Mon, 15 Jul 2019 23:30:55 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type; q=dns; s=default; b=CXOBxyXHpLf0vdX1h9WVs0U1w0Dtpck39uu1V5xHGUbLnGabi4 3y2JAawASn86/MZoLls9aDFEEEQLoF/pjwzMnGLdXa/mXFWjhQxxLz218iqxSFCz hnXeRRHloeDyoKnT4p+44FlRoE9TTofU7iuZGDPKB0N8y6LTm7+/ptHTg= 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:from :subject:to:cc:message-id:date:mime-version:content-type; s= default; bh=IThhvc0iWkMe2kxM3uh8z9aUKU0=; b=nHfIPpknZjJ/Fseg1swb VrvbjJgMdYNVmJDucaSySt17rwKh4+gou+XMkYXgIv49kJrfNFCxfy8HpWI2e3Q8 J2EKuoE7At8zCWO4lhUCBeNy+JUzyIWhocinOTdFeUAF33QfiU90QOvFfB+pwspp zWNq5yVy3KAJi0tzKLio9ic= Received: (qmail 67214 invoked by alias); 15 Jul 2019 13:30:35 -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 67155 invoked by uid 89); 15 Jul 2019 13:30:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=avr, sk:process X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Jul 2019 13:30:27 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C258BB04C; Mon, 15 Jul 2019 13:30:20 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] Do not emit __gnu_lto_v1 symbol. To: gcc-patches@gcc.gnu.org Cc: Richard Biener Message-ID: Date: Mon, 15 Jul 2019 15:30:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 X-IsSubscribed: yes Hi. The patch is about removal of the emission of __gnu_lto_v1. The symbol should not be needed any longer for GCC driver. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: 2019-07-15 Martin Liska * config/avr/avr.c (avr_asm_output_aligned_decl_common): Update comment. * toplev.c (compile_file): Do not emit __gnu_lto_v1 symbol. libgcc/ChangeLog: 2019-07-15 Martin Liska * config/pa/stublib.c: Remove stub symbol __gnu_lto_v1. * config/pa/t-stublib: Likewise. libiberty/ChangeLog: 2019-07-15 Martin Liska * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Do not search for gnu_lto_v1, but search for first '\0'. --- gcc/config/avr/avr.c | 2 +- gcc/toplev.c | 21 --------------------- libgcc/config/pa/stublib.c | 4 ---- libgcc/config/pa/t-stublib | 6 +----- libiberty/simple-object-elf.c | 23 ++++++++--------------- 5 files changed, 10 insertions(+), 46 deletions(-) diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index b97faafdc3b..760e9371a01 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -10163,7 +10163,7 @@ avr_asm_output_aligned_decl_common (FILE * stream, return; } - /* __gnu_lto_v1 etc. are just markers for the linker injected by toplev.c. + /* __gnu_lto_slim is just a marker for the linker injected by toplev.c. There is no need to trigger __do_clear_bss code for them. */ if (!STR_PREFIX_P (name, "__gnu_lto")) diff --git a/gcc/toplev.c b/gcc/toplev.c index 2567fe2e697..56ef63e5adb 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -543,27 +543,6 @@ compile_file (void) process_pending_assemble_externals (); } - /* Emit LTO marker if LTO info has been previously emitted. This is - used by collect2 to determine whether an object file contains IL. - We used to emit an undefined reference here, but this produces - link errors if an object file with IL is stored into a shared - library without invoking lto1. */ - if (flag_generate_lto || flag_generate_offload) - { -#if defined ASM_OUTPUT_ALIGNED_DECL_COMMON - ASM_OUTPUT_ALIGNED_DECL_COMMON (asm_out_file, NULL_TREE, - "__gnu_lto_v1", - HOST_WIDE_INT_1U, 8); -#elif defined ASM_OUTPUT_ALIGNED_COMMON - ASM_OUTPUT_ALIGNED_COMMON (asm_out_file, "__gnu_lto_v1", - HOST_WIDE_INT_1U, 8); -#else - ASM_OUTPUT_COMMON (asm_out_file, "__gnu_lto_v1", - HOST_WIDE_INT_1U, - HOST_WIDE_INT_1U); -#endif - } - /* Let linker plugin know that this is a slim object and must be LTOed even when user did not ask for it. */ if (flag_generate_lto && !flag_fat_lto_objects) diff --git a/libgcc/config/pa/stublib.c b/libgcc/config/pa/stublib.c index b47afe15511..7e79dbfd6c9 100644 --- a/libgcc/config/pa/stublib.c +++ b/libgcc/config/pa/stublib.c @@ -115,7 +115,3 @@ pthread_once (void) return 0; } #endif - -#ifdef L_gnu_lto_v1 -char gnu_lto_v1; -#endif diff --git a/libgcc/config/pa/t-stublib b/libgcc/config/pa/t-stublib index 0a6223d952e..8004c1e46a7 100644 --- a/libgcc/config/pa/t-stublib +++ b/libgcc/config/pa/t-stublib @@ -3,8 +3,7 @@ LIBGCCSTUB_OBJS = rfi-stub.o dfi-stub.o ritm-stub.o ditm-stub.o \ pthread_default_stacksize_np-stub.o \ pthread_mutex_lock-stub.o \ pthread_mutex_unlock-stub.o \ - pthread_once-stub.o \ - gnu_lto_v1-stub.o + pthread_once-stub.o rfi-stub.o: $(srcdir)/config/pa/stublib.c $(gcc_compile) -c -O2 -DL_register_frame_info $< @@ -36,9 +35,6 @@ pthread_mutex_unlock-stub.o: $(srcdir)/config/pa/stublib.c pthread_once-stub.o: $(srcdir)/config/pa/stublib.c $(gcc_compile) -c -O2 -DL_pthread_once $< -gnu_lto_v1-stub.o: $(srcdir)/config/pa/stublib.c - $(gcc_compile) -c -O2 -DL_gnu_lto_v1 $< - libgcc_stub.a: $(LIBGCCSTUB_OBJS) -rm -rf $@ $(AR) rc $@ $(LIBGCCSTUB_OBJS) diff --git a/libiberty/simple-object-elf.c b/libiberty/simple-object-elf.c index 22c9ae7ed2d..502388991a0 100644 --- a/libiberty/simple-object-elf.c +++ b/libiberty/simple-object-elf.c @@ -1358,9 +1358,8 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, return errmsg; } - /* If we are processing .symtab purge __gnu_lto_v1 and - __gnu_lto_slim symbols from it and any symbols in discarded - sections. */ + /* If we are processing .symtab purge __gnu_lto_slim symbol + from it and any symbols in discarded sections. */ if (sh_type == SHT_SYMTAB) { unsigned entsize = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, @@ -1380,14 +1379,9 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, sobj->offset + stroff, (unsigned char *)strings, strsz, &errmsg, err); - /* Find gnu_lto_ in strings. */ - while ((gnu_lto = (char *) memchr (gnu_lto, 'g', - strings + strsz - gnu_lto))) - if (strncmp (gnu_lto, "gnu_lto_v1", - strings + strsz - gnu_lto) == 0) - break; - else - gnu_lto++; + /* Find first '\0' in strings. */ + gnu_lto = (char *) memchr (gnu_lto, '\0', + strings + strsz - gnu_lto + 1); /* Read the section index table if present. */ if (symtab_indices_shndx[i - 1] != 0) { @@ -1461,10 +1455,9 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, undefined and sharing the gnu_lto_ name. */ bind = STB_WEAK; other = STV_HIDDEN; - if (gnu_lto) - ELF_SET_FIELD (type_functions, ei_class, Sym, - ent, st_name, Elf_Word, - gnu_lto - strings); + ELF_SET_FIELD (type_functions, ei_class, Sym, + ent, st_name, Elf_Word, + gnu_lto - strings); ELF_SET_FIELD (type_functions, ei_class, Sym, ent, st_shndx, Elf_Half, SHN_UNDEF); }