From patchwork Sat Jan 27 03:57:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 25593 Received: (qmail 103130 invoked by alias); 27 Jan 2018 03:57:58 -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 103062 invoked by uid 89); 27 Jan 2018 03:57:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, 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=Hx-spam-relays-external:sk:mail-pl, HX-HELO:sk:mail-pl, H*r:sk:mail-pl, H*RU:sk:mail-pl X-HELO: mail-pl0-f44.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=I3kk1kwiBRxbSRVbXkKbGaS2UKw773N1+iMm3IYhUok=; b=jfBp24R82Yq8ddm8bohhAJEqNFaR+xg5XoNo60j6GtxIWuV7PS4Ewb63Y+Rzl5i1B7 2CDVudU06bDM+SikdRnz3Uu/04pszWasRh4JwLEzxg/A+kgiziOPdKF6kzAzjI/MQ48/ w44tTLmjPiIso49k9GR4kEDyEj9fs9IB+CXFCtGsmeriBr7rAnDWZYJJmfavfm5groHC KfoxvU1RJdXzCVelXxJCGQ90jQoBzg54+7whZdpfkHN9ydWYRy6IIGvr0/tUPovm6kpT kSyotBJvwVCZOM4pQ8DGgUUm/bOnyOx13M7jTUyxnu0ULu6cfTMKCc3oWN4mbpWBt0mx rDBA== X-Gm-Message-State: AKwxytcgxkD0nQ6dOaZFT4N63s39DGTMnpGXJJiN80PAnSsoMZK7jiwx qVjeunzMSXHIOl4YlZNZqZpnSA== X-Google-Smtp-Source: AH8x22661DzbEfsqYytxJ2MM5KAjXJpS10ehmn3HuDc2SJy0gIL0lMtI23uwF4HkBCvm8C1IaApAUA== X-Received: by 2002:a17:902:8f90:: with SMTP id z16-v6mr16283016plo.370.1517025475458; Fri, 26 Jan 2018 19:57:55 -0800 (PST) Subject: [PATCH v7 01/17] sysdeps/init_array: Add PREINIT_FUNCTION to crti.S Date: Fri, 26 Jan 2018 19:57:28 -0800 Message-Id: <20180127035744.10058-2-palmer@dabbelt.com> In-Reply-To: <20180127035744.10058-1-palmer@dabbelt.com> References: <20180127035744.10058-1-palmer@dabbelt.com> Cc: Palmer Dabbelt From: Palmer Dabbelt To: libc-alpha@sourceware.org, joseph@codesourcery.com The RISC-V port contains a crti.S that simply contains a link to PREINIT_FUNCTION (when defined). As this should be entirely generic, Joseph Myers suggested that we update the generic init_array version to contain this. Since RISC-V is the only user of init_array this won't break any existing ports. 2018-01-26 Palmer Dabbelt * sysdeps/init_array/crti.S (.section .init_array): Add PREINIT_FUNCTION when defined. --- sysdeps/init_array/crti.S | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sysdeps/init_array/crti.S b/sysdeps/init_array/crti.S index 0a6e9fd95338..145c918f939b 100644 --- a/sysdeps/init_array/crti.S +++ b/sysdeps/init_array/crti.S @@ -11,3 +11,17 @@ But new configurations without compatibility concerns for toolchains without .init_array support can use this to avoid the superfluous .init and .fini boilerplate code. */ + +#ifdef PREINIT_FUNCTION + +#if PREINIT_FUNCTION_WEAK +# error PREINIT_FUNCTION_WEAK is unsupported +#endif + +/* This arranges for PREINIT_FUNCTION to be called upon loading a library that + contains crti.o. */ + + .section .init_array,"a",%init_array + .dc.a PREINIT_FUNCTION + +#endif