From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id AE5DF3858C53 for ; Wed, 4 May 2022 17:01:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE5DF3858C53 Received: by mail-oi1-x22e.google.com with SMTP id r8so1783899oib.5 for ; Wed, 04 May 2022 10:01:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=maX3s1UFnLBqwmv9Ntib+9Z9mGwS80VWTHn+EMsGqiI=; b=byEJf6AuQANxUCiPAyash7BJUoEA81fl9EfZLYQEeieTnrJF1F0xofKo7Kx7+jrsRq NSB7OynaWtGmEtXPTMHvR7nnD1rEQ2QL9HhRd4eT0MZU+gcvFBdgXd88swnFesK4kd6y b3VPDmsTRd5cCIURKQzF9ILYxMjjE5oKcHy7BhIBd/Ah0g9alx9gM8A0PghnXFTChKLv 0ows2RwBidI+B39B++h+8hWLNlg72ywD46vLc1t553lha9IWC1BaomtOtBRcCqhiVcI+ FQ2+x3xeUQXJWrtsKbTlhESsBd75iVLF2VVifCUMD1aq6BBH3ug3dpW3P23LDa5uuRjd +i5A== X-Gm-Message-State: AOAM531Oi5tG/ISgJgMeDB2Hk1XQkS3iJ0snqgg/d9uFcr82xdm802df Ob6lAAztUPKxKe6b0pUXKiqC1A== X-Google-Smtp-Source: ABdhPJwyp5e4KM+Ib0pvmow8TIO9qksm1S09FZagJwL0aL/nLpEU86QJmSCMsTG+pvkWm7VntjjBJA== X-Received: by 2002:a05:6808:1598:b0:326:6e46:7c0e with SMTP id t24-20020a056808159800b003266e467c0emr4314oiw.294.1651683664941; Wed, 04 May 2022 10:01:04 -0700 (PDT) Received: from ?IPV6:2804:431:c7cb:726:3ae8:3076:1dad:37? ([2804:431:c7cb:726:3ae8:3076:1dad:37]) by smtp.gmail.com with ESMTPSA id 25-20020aca0919000000b00325cda1ffb6sm4490876oij.53.2022.05.04.10.01.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 May 2022 10:01:04 -0700 (PDT) Message-ID: <2dbba551-94f2-cbeb-9b94-2e8e1bd8ef5a@linaro.org> Date: Wed, 4 May 2022 14:01:01 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v2 2/3] Linux: Implement a useful version of _startup_fatal Content-Language: en-US To: Florian Weimer , libc-alpha@sourceware.org References: <63235b8cfce808ff0c6fd07d5710faaf2e692f88.1651682800.git.fweimer@redhat.com> From: Adhemerval Zanella In-Reply-To: <63235b8cfce808ff0c6fd07d5710faaf2e692f88.1651682800.git.fweimer@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Wed, 04 May 2022 17:01:07 -0000 On 04/05/2022 13:48, Florian Weimer wrote: > 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. > + 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) \ > + do \ > + { \ > + size_t message_length = __builtin_strlen (message); \ Shoudn't we use double underscore name to avoid clash with local variables? > + if (! __builtin_constant_p (message_length)) \ > + { \ > + extern void _startup_fatal_not_constant (void); \ > + _startup_fatal_not_constant (); \ > + } \ > + INTERNAL_SYSCALL_CALL (write, STDERR_FILENO, message, message_length); \ > + INTERNAL_SYSCALL_CALL (exit_group, 127); \ > + } \ > + while (0) > +#endif /* !SHARED */