From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70995 invoked by alias); 12 Jan 2018 10:29:50 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 70958 invoked by uid 89); 12 Jan 2018 10:29:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Jan 2018 10:29:48 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 184CAC049D53; Fri, 12 Jan 2018 10:29:47 +0000 (UTC) Received: from [10.36.116.236] (ovpn-116-236.ams2.redhat.com [10.36.116.236]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CF9717185; Fri, 12 Jan 2018 10:29:46 +0000 (UTC) Subject: Re: [PATCH] ld: Keep PREINIT_ARRAY/INIT_ARRAY/FINI_ARRAY sections for -r --gc-section To: Alan Modra , "H.J. Lu" Cc: binutils@sourceware.org References: <20180111165714.GA7379@gmail.com> <20180112080959.GI20622@bubble.grove.modra.org> From: Nick Clifton Message-ID: <746c0fc4-fd1c-c5e9-2dbe-f77017ff751b@redhat.com> Date: Fri, 12 Jan 2018 10:29:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180112080959.GI20622@bubble.grove.modra.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-01/txt/msg00198.txt.bz2 Hi Alan, > I'm wondering why we need this part > >> + ${RELOCATING+${PREINIT_ARRAY}} >> ${RELOCATING+${INIT_ARRAY}} >> ${RELOCATING+${FINI_ARRAY}} > > given that if these were not wrapped in ${RELOCATING+} it seems like > KEEP in the script ought to be good enough? Ah ha - well I can answer that. If we are performing a relocatable link then we need to preserve the section names because they may contain a priority suffix. So for example we can input names like: .init_array.100 .fini_array.444 .preinit_array.33 If the relocatable linker script contains something like: .init_array { KEEP (*(.init_array.*)) } then these priority suffixes will be lost. Cheers Nick