From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 2DB193858C50 for ; Mon, 2 May 2022 20:37:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2DB193858C50 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-529-8elrjMeXPCW_qxEJBlY64w-1; Mon, 02 May 2022 16:37:44 -0400 X-MC-Unique: 8elrjMeXPCW_qxEJBlY64w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4129B811E76; Mon, 2 May 2022 20:37:44 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.59]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69B34151F5C1; Mon, 2 May 2022 20:37:43 +0000 (UTC) From: Florian Weimer To: "H.J. Lu" Cc: GNU C Library Subject: Re: [PATCH 1/5] Linux: Implement a useful version of _startup_fatal References: <7a6a51b346a81484046ba392a9854a88568a92aa.1651518694.git.fweimer@redhat.com> <87ilqn4spx.fsf@oldenburg.str.redhat.com> Date: Mon, 02 May 2022 22:37:41 +0200 In-Reply-To: (H. J. Lu's message of "Mon, 2 May 2022 13:06:57 -0700") Message-ID: <877d734qne.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 May 2022 20:37:47 -0000 * H. J. Lu: > On Mon, May 2, 2022 at 12:53 PM Florian Weimer wrote: >> >> * H. J. Lu: >> >> >> +#include_next >> >> diff --git a/sysdeps/unix/sysv/linux/startup.h b/sysdeps/unix/sysv/linux/startup.h >> >> new file mode 100644 >> >> index 0000000000..a5de941759 >> >> --- /dev/null >> >> +++ b/sysdeps/unix/sysv/linux/startup.h >> >> @@ -0,0 +1,38 @@ >> >> +/* Linux definitions of functions used by static libc main startup. >> >> + Copyright (C) 2017-2022 Free Software Foundation, Inc. >> > Shouldn't it just be 2022? >> >> + This file is part of the GNU C Library. >> >> + >> >> + The GNU C Library is free software; you can redistribute it and/or >> >> + modify it under the terms of the GNU Lesser General Public >> >> + License as published by the Free Software Foundation; either >> >> + version 2.1 of the License, or (at your option) any later version. >> >> + >> >> + The GNU C Library is distributed in the hope that it will be useful, >> >> + but WITHOUT ANY WARRANTY; without even the implied warranty of >> >> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> >> + Lesser General Public License for more details. >> >> + >> >> + You should have received a copy of the GNU Lesser General Public >> >> + License along with the GNU C Library; if not, see >> >> + . */ >> >> + >> >> +#ifdef SHARED >> >> +# include_next >> >> +#else >> >> +# include >> >> + >> >> +/* Avoid a run-time invocation of strlen. */ >> >> +#define _startup_fatal(message) \ >> > >> > Is this needed only for static PIE? >> >> I don't know. It's used from csu/libc-tls.c, some targets may need it >> for ET_EXEC static linking, too. I haven't checked. The additional >> code size is minimal. > > _startup_fatal was added for i386 static PIE. I don't think it is > needed for normal static executables. Based on the current initialization ordering, it seems to me that we need it for non-PIE static programs, too. Maybe I should check this tomorrow. Thanks, Florian