From patchwork Mon May 15 14:48:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 1781484 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=fxKentw/; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QKj1w5s3Sz20dc for ; Tue, 16 May 2023 00:49:24 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B60A73853D01 for ; Mon, 15 May 2023 14:49:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B60A73853D01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684162162; bh=HI59jmJ8o1gH3qG8araZr5XxORc6aEFtMVmwPJNnYxU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=fxKentw/m+afAkVl97ofXxqyM4WCMuopLPdCqv7hOuwfzaZXiCAQ5PbnRUUl/Z8/3 e+9N6EU/ZXt7tg/Bf6QhPayeErN/aVW1Wl0blSW9BuHLjFuSE/dM8/OtXcEMLU/g1Y ms/aePS3jDlloX8/y6qLF5iivAgjW+cQZbD4XnOk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by sourceware.org (Postfix) with ESMTPS id 43F613858C36 for ; Mon, 15 May 2023 14:48:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 43F613858C36 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-4f27977aed6so4230443e87.2 for ; Mon, 15 May 2023 07:48:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684162098; x=1686754098; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HI59jmJ8o1gH3qG8araZr5XxORc6aEFtMVmwPJNnYxU=; b=GPbd0N/Dc8fQbmauS004I3uww/1M3wRWYV2aPaXzEp09r9rebJJF1EGKbcuvho6OZV fACO0iprbro///MsfPZ8frGuMAZSXgA8n3aGk4FgO7k/Qhc/ar6YWvwKv3dBqFt8OFEg PCI6bUIWp0Pm9Sd8GLYcihu3CxBS1Dtf/U4HFBTRY0PrhQ6vBceztenHjJrfNabxavUR pAwPCnrOhgkHGHdLvFjNpbz11UVqg1gRzRhZpWS5+4puNbieLp49JdFO7q7hii/Djo3C is1xFVxhGrvufe/nxU+BA8cQl32G4MJFsNOY80d3GrgCH7Cm2RHcPXk79h51IadhNiIX RIHQ== X-Gm-Message-State: AC+VfDwTIdjCW+1J/vBV/UnbJiPeUK/taeExZz0uRwhNMJ05yD/EhTWW tAZJ8pTFppM7QpLNl3m46jJS8F97MFo= X-Google-Smtp-Source: ACHHUZ4vo9gXWmEGfZ2rCWx4pP4SCFaK8n6VZ6/Rsl5BVi7nsPv5bYR5Y6qfMS1A+Qb1j1ShGNuW4g== X-Received: by 2002:a19:f80e:0:b0:4f3:79af:fcb7 with SMTP id a14-20020a19f80e000000b004f379affcb7mr2317494lff.26.1684162098062; Mon, 15 May 2023 07:48:18 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id w9-20020a056512098900b004f11e965308sm2643336lft.20.2023.05.15.07.48.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:48:17 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [RFC PATCH 1/6] Mark more functions as __COLD Date: Mon, 15 May 2023 17:48:10 +0300 Message-Id: <20230515144815.3939017-2-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515144815.3939017-1-bugaevc@gmail.com> References: <20230515144815.3939017-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Sergey Bugaev via Libc-alpha From: Sergey Bugaev Reply-To: Sergey Bugaev Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The various error reporting functions are unlikely to be called; let the compiler know about this. This will help GCC optimize both these functions and their callers better. In particular, GCC will place the code generated for these functions into a .text.unlikely section in the object files. The linker will then group the .text.unlikely sections together inside the .text section of the resulting binary. This improves code locality. In some cases the compiler may even decide that it's beneficial to separate out the code paths in other functions that lead to a call of a cold function, and also place them into .text.unlikely section. This works both within glibc, and in any external code as long as it's compiled against the new headers containing the __COLD annotations, with a compiler that can understand and make use of them. Signed-off-by: Sergey Bugaev --- assert/assert.h | 4 ++-- debug/chk_fail.c | 2 +- elf/dl-exception.c | 2 +- elf/dl-minimal.c | 8 ++++---- elf/dl-open.c | 2 +- elf/dl-tls.c | 2 +- include/assert.h | 6 +++--- include/stdio.h | 8 +++++--- include/sys/cdefs.h | 3 +++ malloc/dynarray.h | 2 +- malloc/malloc.c | 2 +- misc/bits/error.h | 12 ++++++------ stdlib/stdlib.h | 2 +- sysdeps/generic/dl-call_tls_init_tp.h | 2 +- sysdeps/generic/ldsodefs.h | 23 ++++++++++++----------- sysdeps/mach/hurd/dl-sysdep.c | 2 +- 16 files changed, 44 insertions(+), 38 deletions(-) diff --git a/assert/assert.h b/assert/assert.h index 62670e4b..1c472e16 100644 --- a/assert/assert.h +++ b/assert/assert.h @@ -66,12 +66,12 @@ __BEGIN_DECLS /* This prints an "Assertion failed" message and aborts. */ extern void __assert_fail (const char *__assertion, const char *__file, unsigned int __line, const char *__function) - __THROW __attribute__ ((__noreturn__)); + __THROW __attribute__ ((__noreturn__)) __COLD; /* Likewise, but prints the error text for ERRNUM. */ extern void __assert_perror_fail (int __errnum, const char *__file, unsigned int __line, const char *__function) - __THROW __attribute__ ((__noreturn__)); + __THROW __attribute__ ((__noreturn__)) __COLD; /* The following is not at all used here but needed for standard diff --git a/debug/chk_fail.c b/debug/chk_fail.c index 299e95b6..97037972 100644 --- a/debug/chk_fail.c +++ b/debug/chk_fail.c @@ -22,7 +22,7 @@ extern char **__libc_argv attribute_hidden; void -__attribute__ ((noreturn)) +__attribute__ ((noreturn)) __COLD __chk_fail (void) { __fortify_fail ("buffer overflow detected"); diff --git a/elf/dl-exception.c b/elf/dl-exception.c index 06a27cd7..1e1309fb 100644 --- a/elf/dl-exception.c +++ b/elf/dl-exception.c @@ -52,7 +52,7 @@ oom_exception (struct dl_exception *exception) } static void -__attribute__ ((noreturn)) +__attribute__ ((noreturn)) __COLD length_mismatch (void) { _dl_fatal_printf ("Fatal error: " diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c index abda453c..dc267519 100644 --- a/elf/dl-minimal.c +++ b/elf/dl-minimal.c @@ -156,14 +156,14 @@ __strerror_r (int errnum, char *buf, size_t buflen) return msg; } -void +void __COLD __libc_fatal (const char *message) { _dl_fatal_printf ("%s", message); } rtld_hidden_def (__libc_fatal) -void +void __COLD __attribute__ ((noreturn)) __chk_fail (void) { @@ -176,7 +176,7 @@ rtld_hidden_def (__chk_fail) If we are linked into the user program (-ldl), the normal __assert_fail defn can override this one. */ -void weak_function +void weak_function __COLD __assert_fail (const char *assertion, const char *file, unsigned int line, const char *function) { @@ -190,7 +190,7 @@ Inconsistency detected by ld.so: %s: %u: %s%sAssertion `%s' failed!\n", rtld_hidden_weak (__assert_fail) # endif -void weak_function +void weak_function __COLD __assert_perror_fail (int errnum, const char *file, unsigned int line, const char *function) diff --git a/elf/dl-open.c b/elf/dl-open.c index 2d985e21..47bc5cac 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -77,7 +77,7 @@ struct dl_open_args }; /* Called in case the global scope cannot be extended. */ -static void __attribute__ ((noreturn)) +static void __attribute__ ((noreturn)) __COLD add_to_global_resize_failure (struct link_map *new) { _dl_signal_error (ENOMEM, new->l_libname->name, NULL, diff --git a/elf/dl-tls.c b/elf/dl-tls.c index 4ef7bc3f..5e198499 100644 --- a/elf/dl-tls.c +++ b/elf/dl-tls.c @@ -113,7 +113,7 @@ _dl_tls_static_surplus_init (size_t naudit) /* Out-of-memory handler. */ static void -__attribute__ ((__noreturn__)) +__attribute__ ((__noreturn__)) __COLD oom (void) { _dl_fatal_printf ("cannot allocate memory for thread-local data: ABORT\n"); diff --git a/include/assert.h b/include/assert.h index c812808f..9f0a7f8a 100644 --- a/include/assert.h +++ b/include/assert.h @@ -6,19 +6,19 @@ so it has to be repeated here. */ extern void __assert_fail (const char *__assertion, const char *__file, unsigned int __line, const char *__function) - __THROW __attribute__ ((__noreturn__)); + __THROW __attribute__ ((__noreturn__)) __COLD; /* Likewise, but prints the error text for ERRNUM. */ extern void __assert_perror_fail (int __errnum, const char *__file, unsigned int __line, const char *__function) - __THROW __attribute__ ((__noreturn__)); + __THROW __attribute__ ((__noreturn__)) __COLD; /* The real implementation of the two functions above. */ extern void __assert_fail_base (const char *fmt, const char *assertion, const char *file, unsigned int line, const char *function) - __THROW __attribute__ ((__noreturn__)) attribute_hidden; + __THROW __attribute__ ((__noreturn__)) attribute_hidden __COLD; rtld_hidden_proto (__assert_fail) rtld_hidden_proto (__assert_perror_fail) diff --git a/include/stdio.h b/include/stdio.h index da47d1ce..b5257dd5 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -171,9 +171,11 @@ extern int __gen_tempname (char *__tmpl, int __suffixlen, int __flags, /* Print out MESSAGE (which should end with a newline) on the error output and abort. */ extern void __libc_fatal (const char *__message) - __attribute__ ((__noreturn__)); -_Noreturn void __libc_message (const char *__fnt, ...) attribute_hidden; -extern void __fortify_fail (const char *msg) __attribute__ ((__noreturn__)); + __attribute__ ((__noreturn__)) __COLD; +extern void __libc_message (const char *__fnt, ...) + attribute_hidden __attribute__ ((__noreturn__)) __COLD; +extern void __fortify_fail (const char *msg) + __attribute__ ((__noreturn__)) __COLD; libc_hidden_proto (__fortify_fail) /* Acquire ownership of STREAM. */ diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index 56adb231..ef78edda 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -16,6 +16,9 @@ # undef __nonnull # define __nonnull(params) +/* Intentionally not marked __COLD in the header, since this only causes GCC + to create a bunch of useless __foo_chk.cold symbols containing only a call + to this function; better just keep calling it directly. */ extern void __chk_fail (void) __attribute__ ((__noreturn__)); libc_hidden_proto (__chk_fail) rtld_hidden_proto (__chk_fail) diff --git a/malloc/dynarray.h b/malloc/dynarray.h index a2d1fd26..5093cc33 100644 --- a/malloc/dynarray.h +++ b/malloc/dynarray.h @@ -165,7 +165,7 @@ bool __libc_dynarray_finalize (struct dynarray_header *list, void *scratch, /* Internal function. Terminate the process after an index error. SIZE is the number of elements of the dynamic array. INDEX is the lookup index which triggered the failure. */ -_Noreturn void __libc_dynarray_at_failure (size_t size, size_t index); +_Noreturn void __libc_dynarray_at_failure (size_t size, size_t index) __COLD; #ifndef _ISOMAC libc_hidden_proto (__libc_dynarray_emplace_enlarge) diff --git a/malloc/malloc.c b/malloc/malloc.c index 5d8b61d6..75e4eb2f 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1093,7 +1093,7 @@ static void* _int_memalign(mstate, size_t, size_t); static void* _mid_memalign(size_t, size_t, void *); #endif -static void malloc_printerr(const char *str) __attribute__ ((noreturn)); +_Noreturn static void malloc_printerr(const char *str) __COLD; static void munmap_chunk(mchunkptr p); #if HAVE_MREMAP diff --git a/misc/bits/error.h b/misc/bits/error.h index b3fd5020..46ec0559 100644 --- a/misc/bits/error.h +++ b/misc/bits/error.h @@ -24,16 +24,16 @@ extern void __REDIRECT (__error_alias, (int __status, int __errnum, const char *__format, ...), error) - __attribute__ ((__format__ (__printf__, 3, 4))); + __attribute__ ((__format__ (__printf__, 3, 4))) __COLD; extern void __REDIRECT (__error_noreturn, (int __status, int __errnum, const char *__format, ...), error) - __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4))); + __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4))) __COLD; /* If we know the function will never return make sure the compiler realizes that, too. */ -__extern_always_inline void +__extern_always_inline __COLD void error (int __status, int __errnum, const char *__format, ...) { if (__builtin_constant_p (__status) && __status != 0) @@ -48,19 +48,19 @@ extern void __REDIRECT (__error_at_line_alias, (int __status, int __errnum, unsigned int __line, const char *__format, ...), error_at_line) - __attribute__ ((__format__ (__printf__, 5, 6))); + __attribute__ ((__format__ (__printf__, 5, 6))) __COLD; extern void __REDIRECT (__error_at_line_noreturn, (int __status, int __errnum, const char *__fname, unsigned int __line, const char *__format, ...), error_at_line) - __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6))); + __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6))) __COLD; /* If we know the function will never return make sure the compiler realizes that, too. */ -__extern_always_inline void +__extern_always_inline __COLD void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __line, const char *__format, ...) { diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 631b0cbb..84afc059 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -727,7 +727,7 @@ extern void *aligned_alloc (size_t __alignment, size_t __size) #endif /* Abort execution and generate a core-dump. */ -extern void abort (void) __THROW __attribute__ ((__noreturn__)); +extern void abort (void) __THROW __attribute__ ((__noreturn__)) __COLD; /* Register a function to be called when `exit' is called. */ diff --git a/sysdeps/generic/dl-call_tls_init_tp.h b/sysdeps/generic/dl-call_tls_init_tp.h index 208f91e2..34f0959f 100644 --- a/sysdeps/generic/dl-call_tls_init_tp.h +++ b/sysdeps/generic/dl-call_tls_init_tp.h @@ -19,7 +19,7 @@ #include #include -static inline void +static inline void __COLD _startup_fatal_tls_error (void) { _startup_fatal ("Fatal glibc error: Cannot allocate TLS block\n"); diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index ba531762..a4a0d307 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -785,12 +785,12 @@ void _dl_printf (const char *fmt, ...) /* Write a message on the specified descriptor standard error. The parameters are interpreted as for a `printf' call. */ void _dl_error_printf (const char *fmt, ...) - attribute_hidden __attribute__ ((__format__ (__printf__, 1, 2))); + attribute_hidden __attribute__ ((__format__ (__printf__, 1, 2))) __COLD; /* Write a message on the specified descriptor standard error and exit the program. The parameters are interpreted as for a `printf' call. */ void _dl_fatal_printf (const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 1, 2), __noreturn__)); + __attribute__ ((__format__ (__printf__, 1, 2), __noreturn__)) __COLD; rtld_hidden_proto (_dl_fatal_printf) /* An exception raised by the _dl_signal_error function family and @@ -813,25 +813,25 @@ struct dl_exception string describing the specific problem. */ void _dl_exception_create (struct dl_exception *, const char *object, const char *errstring) - __attribute__ ((nonnull (1, 3))); + __attribute__ ((nonnull (1, 3))) __COLD; rtld_hidden_proto (_dl_exception_create) /* Used internally to implement dlerror message freeing. See include/dlfcn.h and dlfcn/dlerror.c. */ -void _dl_error_free (void *ptr) attribute_hidden; +void _dl_error_free (void *ptr) attribute_hidden __COLD; /* Like _dl_exception_create, but create errstring from a format string FMT. Currently, only "%s" and "%%" are supported as format directives. */ void _dl_exception_create_format (struct dl_exception *, const char *objname, const char *fmt, ...) - __attribute__ ((nonnull (1, 3), format (printf, 3, 4))); + __attribute__ ((nonnull (1, 3), format (printf, 3, 4))) __COLD; rtld_hidden_proto (_dl_exception_create_format) /* Deallocate the exception, freeing allocated buffers (if possible). */ void _dl_exception_free (struct dl_exception *) - __attribute__ ((nonnull (1))); + __attribute__ ((nonnull (1))) __COLD; rtld_hidden_proto (_dl_exception_free) /* This function is called by all the internal dynamic linker @@ -841,13 +841,13 @@ rtld_hidden_proto (_dl_exception_free) process is terminated immediately. */ void _dl_signal_exception (int errcode, struct dl_exception *, const char *occasion) - __attribute__ ((__noreturn__)); + __attribute__ ((__noreturn__)) __COLD; rtld_hidden_proto (_dl_signal_exception) /* Like _dl_signal_exception, but creates the exception first. */ extern void _dl_signal_error (int errcode, const char *object, const char *occasion, const char *errstring) - __attribute__ ((__noreturn__)); + __attribute__ ((__noreturn__)) __COLD; rtld_hidden_proto (_dl_signal_error) /* Like _dl_signal_exception, but may return when called in the @@ -856,7 +856,8 @@ rtld_hidden_proto (_dl_signal_error) _dl_signal_exception. */ #if IS_IN (rtld) extern void _dl_signal_cexception (int errcode, struct dl_exception *, - const char *occasion) attribute_hidden; + const char *occasion) + attribute_hidden __COLD; #else __attribute__ ((always_inline)) static inline void @@ -871,7 +872,7 @@ _dl_signal_cexception (int errcode, struct dl_exception *exception, #if IS_IN (rtld) extern void _dl_signal_cerror (int errcode, const char *object, const char *occasion, const char *errstring) - attribute_hidden; + attribute_hidden __COLD; #else __attribute__ ((always_inline)) static inline void @@ -1020,7 +1021,7 @@ extern void _dl_protect_relro (struct link_map *map) attribute_hidden; PLT is nonzero if this was a PLT reloc; it just affects the message. */ extern void _dl_reloc_bad_type (struct link_map *map, unsigned int type, int plt) - attribute_hidden __attribute__ ((__noreturn__)); + attribute_hidden __attribute__ ((__noreturn__)) __COLD; /* Check the version dependencies of all objects available through MAP. If VERBOSE print some more diagnostics. */ diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 79ebb0ce..01a16570 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -753,7 +753,7 @@ strong_alias (_exit, __GI__exit) #endif check_no_hidden(abort); -void weak_function +void weak_function __COLD abort (void) { /* Try to abort using the system specific command. */ From patchwork Mon May 15 14:48:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 1781476 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=dNIXBqkz; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QKj124b6mz20dc for ; Tue, 16 May 2023 00:48:38 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A4FF53854166 for ; Mon, 15 May 2023 14:48:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4FF53854166 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684162116; bh=fN6lxnhh+WW9ta4f2BSq1/HYHyazM7yZgft1lg4MqJ4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=dNIXBqkz5ID0sqUNRPHS4UfLHirdyWzaBrWCxrUEXCV1oTu0lA1weg8OWBzpDuvqL GG16gr8r2YtW+EvujiQjTmxf6Kt2r+dyfAtGDDjdQ3tVyhzZDcTX/FzKjqx29SQDAd wSBH7EqXQ6iVSICQtInPuj/q6nY1uj+1IAttbU1M= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by sourceware.org (Postfix) with ESMTPS id D1C733858C3A for ; Mon, 15 May 2023 14:48:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D1C733858C3A Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2ac7462d9f1so138875981fa.2 for ; Mon, 15 May 2023 07:48:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684162099; x=1686754099; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fN6lxnhh+WW9ta4f2BSq1/HYHyazM7yZgft1lg4MqJ4=; b=GK3OYd2A7AJqMPM2xHO1z45GTzCdkqwbkWCIOBhEeS6SyreqQIQ83lKMdrjZDQ4HZI L424Xy9VT0ZSea322rO6w++N34eTF2S3L1A9NqT3rNV3FYUyF2s88dOV8oiv5oibGFQn S0h80MSQgNIXQJn9U2OXmFMiFZEkQx9vmhgFR6Exy/WUXkDzETSDKJlc81DfNLJaHxHw lmfRyY7JsbDJ5sSN1rwwU/NW69xLngDkAWBRJAYiArWb3CNu8mBJ5K7UIntuuSzUsJt8 wgerb5x877tl8JXxJd+TCrEroUQIEMHdvM64Z88cfBok8SLTuenLZKNzUOSVOlhNQVqc BTag== X-Gm-Message-State: AC+VfDw8RF/D1vRU7PtM0/bwOXqqo64s5SFiuTrgA/n1TVZq3AmI4i+j pPr12+zGT9/lsvkfFAA+h56OYPwJfsw= X-Google-Smtp-Source: ACHHUZ4ZGHMBcKeguqBn8xSPw85M3sTDUrC2Gq0kKH96rwYVah4zM8xFCVJn46QAnWJGgSD5bsv1dw== X-Received: by 2002:ac2:59dc:0:b0:4f3:8196:80cb with SMTP id x28-20020ac259dc000000b004f3819680cbmr1247243lfn.41.1684162098895; Mon, 15 May 2023 07:48:18 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id w9-20020a056512098900b004f11e965308sm2643336lft.20.2023.05.15.07.48.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:48:18 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [RFC PATCH 2/6] mcheck: Microoptimize Date: Mon, 15 May 2023 17:48:11 +0300 Message-Id: <20230515144815.3939017-3-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515144815.3939017-1-bugaevc@gmail.com> References: <20230515144815.3939017-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Sergey Bugaev via Libc-alpha From: Sergey Bugaev Reply-To: Sergey Bugaev Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" We can't mark the abortfunc pointer as __COLD, so instead just tell the compiler that this branch is unlikely to be taken. Signed-off-by: Sergey Bugaev --- malloc/mcheck-impl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/malloc/mcheck-impl.c b/malloc/mcheck-impl.c index 1625e63f..fe35873c 100644 --- a/malloc/mcheck-impl.c +++ b/malloc/mcheck-impl.c @@ -91,7 +91,7 @@ checkhdr (const struct hdr *hdr) status = MCHECK_OK; break; } - if (status != MCHECK_OK) + if (__glibc_unlikely (status != MCHECK_OK)) { mcheck_used = 0; (*abortfunc) (status); From patchwork Mon May 15 14:48:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 1781483 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=y0nwhi4q; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QKj1w5qcvz20db for ; Tue, 16 May 2023 00:49:24 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B290E3853563 for ; Mon, 15 May 2023 14:49:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B290E3853563 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684162162; bh=H8SKUlF5AeHkhSntvYV/CARs03lANPRLi+lKu03gqcg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=y0nwhi4qiYeg9ssBbzGEhx3MZPzlu2Koe9zFl/gc51GJsRCP4Zn8SHb6rAnx8eKCJ VPh6vs1gQCOVCu/B8eKq62kmrV85TIAixafX4ZQg1uwCOTPANH+o4dJtqzCLOBVaEw Yvy36jUJwyuVcWhf8AWWWktE6SH/vIyEK28o0z04= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id A7D4D3858404 for ; Mon, 15 May 2023 14:48:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7D4D3858404 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2ac89e6a5a1so127142641fa.0 for ; Mon, 15 May 2023 07:48:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684162100; x=1686754100; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H8SKUlF5AeHkhSntvYV/CARs03lANPRLi+lKu03gqcg=; b=ThEp79GKWpoSaFtxhbbEYVqUxgYj2O586QHWU2ergWCcB90I1ZXsCTU4ATOboEm/jM SYnl8EXEERv7hMRyTZgkeYLSSeRZIgoxXDOSsQqYvWmWojohE5w6dfs2hWCo9M8gsTKW y1i3Min35d19/jCxQ3+a4sKuarMKIoa9nPTYg7blp89BzJKqKClIMfEcYhfYvkOrx/m+ iKKafPF9jgHd9hOmNNkMGSL2KEeJ89mmjFPf35q8GisZHIh1U7wkvH4z2MIVTGi2+gIG FUZAr9wVWzr5e7vnRIxOyYWVcGMGQto4ST2YKOEjpspV/u/MmIZtvlm4iWc09LNSEDOj nQGA== X-Gm-Message-State: AC+VfDwvXFBLlzh6jiwiACeBCJ3fCcf+ogYY6I4ytRcTLBfHSKGhWKxk 01jrujVHQtTQBblkmbg5E0sWjqxxaT0= X-Google-Smtp-Source: ACHHUZ7NFZ/yypXPW5KczHeZrQYnWjCnmAv1mfkSCLDwbpaf/pZsKM9NJYbRB4gxV1CE/0T7Euzt9g== X-Received: by 2002:ac2:46ee:0:b0:4f1:5001:1d9c with SMTP id q14-20020ac246ee000000b004f150011d9cmr7087321lfo.55.1684162099799; Mon, 15 May 2023 07:48:19 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id w9-20020a056512098900b004f11e965308sm2643336lft.20.2023.05.15.07.48.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:48:19 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [RFC PATCH 3/6] sys/cdefs.h: Define __TEXT_STARTUP & __TEXT_EXIT Date: Mon, 15 May 2023 17:48:12 +0300 Message-Id: <20230515144815.3939017-4-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515144815.3939017-1-bugaevc@gmail.com> References: <20230515144815.3939017-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Sergey Bugaev via Libc-alpha From: Sergey Bugaev Reply-To: Sergey Bugaev Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" GCC already tries to place functions that it knows will only be called at startup (constructors and main ()) into .text.startup, and those that will only be called at exit (destructors) into .text.exit, to improve cache locality. These contents of these sections then get grouped together during linking. What GCC does not know is that glibc contains a lot of code that is not ELF constructors or destructors (nor main ()), but that is also only executed on startup or exit. To help GCC and the linker group such code together, we can mark it up explicitly. To that end, this patch introduces __TEXT_STARTUP and __TEXT_EXIT macros that can be applied to functions to mark them as startup-only or exit-only, respectively. Signed-off-by: Sergey Bugaev --- include/sys/cdefs.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index ef78edda..da866784 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -43,6 +43,9 @@ rtld_hidden_proto (__chk_fail) #endif +#define __TEXT_STARTUP __attribute__ ((section (".text.startup"))) +#define __TEXT_EXIT __attribute__ ((section (".text.exit"))) + #endif /* !defined _ISOMAC */ #endif From patchwork Mon May 15 14:48:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 1781491 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=LTuE7ymI; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QKj2t28dwz20dX for ; Tue, 16 May 2023 00:50:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 44F683851C3D for ; Mon, 15 May 2023 14:50:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44F683851C3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684162212; bh=F1qD3zeYj4Lbcy/6W1ytL/tQzXwJt/sEu5leYGTlQx4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=LTuE7ymIaEJQGg1Hp7TDnFFY7TLtY37Yt81gLA3mmIsQNVy0HwoVm91ZQhU43Wejg 0YtU7jPv4sYYLPLS793vhEZMK3IWNwMq3Bxh5sog96YmDGIBOBvl1DDOgllMpUR4oF zL07GenxslLt0hYHNCuTYJ/IVyMl3GtX3OwvxCjE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 3E2353856952 for ; Mon, 15 May 2023 14:48:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3E2353856952 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4f13bfe257aso14706208e87.3 for ; Mon, 15 May 2023 07:48:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684162102; x=1686754102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F1qD3zeYj4Lbcy/6W1ytL/tQzXwJt/sEu5leYGTlQx4=; b=Mxjm56/s8MTUVCtVrfiNpl/bFHoIno9B4vmU7Y35Tt8dGYoLZLA1KUADizu8+d6MeS vvfJltYWfNKumUUcygCDxnscuUsnnlHSUWhFePOmshXw9zH0pNGJgxmSZleI1bcZcRW7 5jP2e5HMvvsdFvnHEqdl3KarmDI/gu1i53+I3a6Ca0IUdX7xhv/exQBYmhfWIUZv+AAL F5EdrFuv2cHoHLTk8mkMcU4bkt5ZN6IQ7+rF9RzIgOK4+dKDR4IC6z0fHBt3iSZTqLUm JuUnTuW0Vnj3ifEIR2sD7zEob3fcB2WJQsMCTHyZOnWC0FUnSY2V3Vx/s2WPCsn9XYv1 RmuQ== X-Gm-Message-State: AC+VfDyGN7CW82tcvA7h4Sv3pdvqRLQPgbfwp+JlFGQU3PfqDQsCQpnI Y1j1zIRYXc+X/sUL4weSaLo58gtkXiE= X-Google-Smtp-Source: ACHHUZ5zlWD2k0w1bX8liNZrZ9j5VXDD3OTpGPhcWu5dTWDWYKJj0skGukj+m5M/zwlRtn4q6CYJrA== X-Received: by 2002:ac2:5543:0:b0:4d8:5238:ae97 with SMTP id l3-20020ac25543000000b004d85238ae97mr7042044lfk.36.1684162100900; Mon, 15 May 2023 07:48:20 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id w9-20020a056512098900b004f11e965308sm2643336lft.20.2023.05.15.07.48.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:48:20 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [RFC PATCH 4/6] Mark various functions as __TEXT_STARTUP and __TEXT_EXIT Date: Mon, 15 May 2023 17:48:13 +0300 Message-Id: <20230515144815.3939017-5-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515144815.3939017-1-bugaevc@gmail.com> References: <20230515144815.3939017-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Sergey Bugaev via Libc-alpha From: Sergey Bugaev Reply-To: Sergey Bugaev Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The few functions that are only used during exiting (exit, _exit, quick_exit, _hurd_exit, __run_exit_handlers, _dl_fini, various freemem functions, and some others) are marked __TEXT_EXIT. The many functions that are only used on startup are marked __TEXT_STARTUP. Signed-off-by: Sergey Bugaev --- csu/check_fds.c | 4 +- csu/init-first.c | 2 +- csu/libc-start.c | 8 ++-- csu/libc-tls.c | 4 +- elf/dl-call-libc-early-init.c | 2 +- elf/dl-find_object.c | 4 +- elf/dl-fini.c | 2 +- elf/dl-init.c | 2 +- elf/dl-libc.c | 2 +- elf/dl-libc_freeres.c | 2 +- elf/dl-load.c | 2 +- elf/dl-minimal-malloc.c | 8 ++-- elf/dl-minimal.c | 6 +-- elf/dl-origin.c | 2 +- elf/dl-reloc-static-pie.c | 2 +- elf/dl-sort-maps.c | 2 +- elf/dl-support.c | 4 +- elf/dl-tls.c | 2 +- elf/dl-tls_init_tp.c | 4 +- elf/dl-tunables.c | 18 +++---- elf/dl-usage.c | 6 +-- elf/libc_early_init.c | 2 +- elf/rtld.c | 42 ++++++++-------- hurd/hurdinit.c | 6 +-- hurd/hurdstartup.c | 2 +- hurd/lookup-retry.c | 3 ++ iconv/gconv_cache.c | 2 +- iconv/gconv_conf.c | 2 +- iconv/gconv_db.c | 4 +- iconv/gconv_dl.c | 2 +- intl/dcigettext.c | 2 +- intl/finddomain.c | 2 +- intl/localealias.c | 2 +- libio/genops.c | 4 +- mach/mach_init.c | 2 +- mach/mig-reply.c | 2 +- malloc/set-freeres.c | 2 +- misc/fstab.c | 2 +- misc/init-misc.c | 2 +- nptl/pthread_mutex_conf.c | 8 ++-- nscd/nscd_getgr_r.c | 2 +- nscd/nscd_gethst_r.c | 2 +- nscd/nscd_getpw_r.c | 2 +- nscd/nscd_getserv_r.c | 2 +- nscd/nscd_netgroup.c | 2 +- nss/nss_action.c | 2 +- nss/nss_database.c | 2 +- nss/nss_module.c | 2 +- posix/_exit.c | 2 +- posix/regcomp.c | 2 +- posix/register-atfork.c | 2 +- resolv/gai_misc.c | 2 +- resolv/resolv_conf.c | 2 +- rt/aio_misc.c | 2 +- stdio-common/reg-modifier.c | 2 +- stdlib/exit.c | 4 +- stdlib/fmtmsg.c | 2 +- stdlib/quick_exit.c | 2 +- stdlib/setenv.c | 2 +- sunrpc/clnt_perr.c | 2 +- sysdeps/aarch64/dl-machine.h | 2 +- sysdeps/alpha/dl-machine.h | 2 +- sysdeps/arm/dl-machine.h | 2 +- sysdeps/csky/dl-machine.h | 2 +- sysdeps/generic/dl-call_tls_init_tp.h | 2 +- sysdeps/hppa/dl-machine.h | 2 +- sysdeps/i386/dl-machine.h | 2 +- sysdeps/mach/hurd/_exit.c | 4 +- sysdeps/mach/hurd/dl-sysdep.c | 48 +++++++++---------- sysdeps/mach/hurd/i386/tls.h | 2 +- sysdeps/mach/hurd/mig-reply.c | 2 +- sysdeps/mach/hurd/x86/init-first.c | 12 ++--- sysdeps/mach/hurd/x86_64/tls.h | 2 +- sysdeps/mips/dl-machine.h | 2 +- sysdeps/nptl/dl-mutex.c | 2 +- sysdeps/nptl/dl-tls_init_tp.c | 4 +- sysdeps/nptl/pthread_early_init.h | 2 +- sysdeps/or1k/dl-machine.h | 2 +- sysdeps/posix/getaddrinfo.c | 2 +- sysdeps/powerpc/cpu-features.c | 2 +- sysdeps/powerpc/powerpc32/dl-machine.h | 2 +- sysdeps/powerpc/powerpc64/dl-machine.h | 2 +- sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h | 2 +- sysdeps/s390/cpu-features.c | 4 +- sysdeps/s390/s390-32/dl-machine.h | 2 +- sysdeps/s390/s390-64/dl-hwcap-check.h | 2 +- sysdeps/s390/s390-64/dl-machine.h | 2 +- sysdeps/sh/dl-machine.h | 2 +- sysdeps/unix/sysv/linux/_exit.c | 2 +- .../unix/sysv/linux/aarch64/cpu-features.c | 4 +- sysdeps/unix/sysv/linux/check_pf.c | 2 +- sysdeps/unix/sysv/linux/dl-sysdep.c | 8 ++-- sysdeps/unix/sysv/linux/x86/cpu-features.c | 2 +- sysdeps/x86/cpu-features.c | 10 ++-- sysdeps/x86/cpu-tunables.c | 6 +-- sysdeps/x86/dl-cacheinfo.h | 14 +++--- sysdeps/x86/dl-get-cpu-features.c | 2 +- sysdeps/x86_64/dl-machine.h | 2 +- time/tzset.c | 2 +- 99 files changed, 199 insertions(+), 196 deletions(-) diff --git a/csu/check_fds.c b/csu/check_fds.c index 59565f92..e4a80856 100644 --- a/csu/check_fds.c +++ b/csu/check_fds.c @@ -36,7 +36,7 @@ /* Should other OSes (e.g., Hurd) have different versions which can be written in a better way? */ -static void +static void __TEXT_STARTUP check_one_fd (int fd, int mode) { if (__builtin_expect (__fcntl64_nocancel (fd, F_GETFD), 0) == -1 @@ -83,7 +83,7 @@ check_one_fd (int fd, int mode) } -void +void __TEXT_STARTUP __libc_check_standard_fds (void) { /* Check all three standard file descriptors. The O_NOFOLLOW flag diff --git a/csu/init-first.c b/csu/init-first.c index 4544eb6d..de1fd749 100644 --- a/csu/init-first.c +++ b/csu/init-first.c @@ -34,7 +34,7 @@ int __libc_argc attribute_hidden; char **__libc_argv attribute_hidden; -void +void __TEXT_STARTUP __libc_init_first (int argc, char **argv, char **envp) { #ifdef SHARED diff --git a/csu/libc-start.c b/csu/libc-start.c index c3bb6d09..2be7b491 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -72,7 +72,7 @@ uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; # define IREL elf_irel # endif -static void +static void __TEXT_STARTUP apply_irel (void) { # ifdef IREL @@ -121,7 +121,7 @@ apply_irel (void) #ifdef SHARED /* Initialization for dynamic executables. Find the main executable link map and run its init functions. */ -static void +static void __TEXT_STARTUP call_init (int argc, char **argv, char **env) { /* Obtain the main map of the executable. */ @@ -169,7 +169,7 @@ extern void _fini (void); /* Initialization for static executables. There is no dynamic segment, so we access the symbols directly. */ -static void +static void __TEXT_STARTUP call_init (int argc, char **argv, char **envp) { /* For static executables, preinit happens right before init. */ @@ -230,7 +230,7 @@ STATIC int LIBC_START_MAIN (int (*main) (int, char **, char ** For dynamically linked executables, the dynamic segment is used to locate constructors and destructors. For statically linked executables, the relevant symbols are access directly. */ -STATIC int +STATIC int __TEXT_STARTUP LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), int argc, char **argv, #ifdef LIBC_START_MAIN_AUXVEC_ARG diff --git a/csu/libc-tls.c b/csu/libc-tls.c index cdf6442c..ec68de0e 100644 --- a/csu/libc-tls.c +++ b/csu/libc-tls.c @@ -86,7 +86,7 @@ init_slotinfo (void) GL(dl_tls_dtv_slotinfo_list) = &static_slotinfo; } -static void +static void __TEXT_STARTUP init_static_tls (size_t memsz, size_t align) { /* That is the size of the TLS memory for this object. */ @@ -102,7 +102,7 @@ init_static_tls (size_t memsz, size_t align) GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx); } -void +void __TEXT_STARTUP __libc_setup_tls (void) { void *tlsblock; diff --git a/elf/dl-call-libc-early-init.c b/elf/dl-call-libc-early-init.c index 144a7442..927c3099 100644 --- a/elf/dl-call-libc-early-init.c +++ b/elf/dl-call-libc-early-init.c @@ -22,7 +22,7 @@ #include #include -void +void __TEXT_STARTUP _dl_call_libc_early_init (struct link_map *libc_map, _Bool initial) { /* There is nothing to do if we did not actually load libc.so. */ diff --git a/elf/dl-find_object.c b/elf/dl-find_object.c index 2ced2f35..90ef5d3b 100644 --- a/elf/dl-find_object.c +++ b/elf/dl-find_object.c @@ -469,7 +469,7 @@ rtld_hidden_def (_dl_find_object) sizes from the initial loaded mappings. Second to fill in the bases and infos arrays with the (still unsorted) data. Returns the number of loaded (non-nodelete) mappings. */ -static size_t +static size_t __TEXT_STARTUP _dlfo_process_initial (void) { struct link_map *main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded; @@ -556,7 +556,7 @@ _dlfo_sort_mappings (struct dl_find_object_internal *objects, size_t size) } } -void +void __TEXT_STARTUP _dl_find_object_init (void) { /* Cover the main mapping. */ diff --git a/elf/dl-fini.c b/elf/dl-fini.c index 9acb64f4..d8c1bacd 100644 --- a/elf/dl-fini.c +++ b/elf/dl-fini.c @@ -21,7 +21,7 @@ #include #include -void +void __TEXT_EXIT _dl_fini (void) { /* Lots of fun ahead. We have to call the destructors for all still diff --git a/elf/dl-init.c b/elf/dl-init.c index 5b073259..1acad014 100644 --- a/elf/dl-init.c +++ b/elf/dl-init.c @@ -72,7 +72,7 @@ call_init (struct link_map *l, int argc, char **argv, char **env) } -void +void __TEXT_STARTUP _dl_init (struct link_map *main_map, int argc, char **argv, char **env) { ElfW(Dyn) *preinit_array = main_map->l_info[DT_PREINIT_ARRAY]; diff --git a/elf/dl-libc.c b/elf/dl-libc.c index c12e52f3..c7993e4a 100644 --- a/elf/dl-libc.c +++ b/elf/dl-libc.c @@ -256,7 +256,7 @@ free_slotinfo (struct dtv_slotinfo_list **elemp) } -void +void __TEXT_EXIT __dl_libc_freemem (void) { struct link_map *l; diff --git a/elf/dl-libc_freeres.c b/elf/dl-libc_freeres.c index d6d824ac..8f600cfa 100644 --- a/elf/dl-libc_freeres.c +++ b/elf/dl-libc_freeres.c @@ -19,7 +19,7 @@ #include #include -void +void __TEXT_EXIT __rtld_libc_freeres (void) { _dl_find_object_freeres (); diff --git a/elf/dl-load.c b/elf/dl-load.c index d15cad2d..b5eed23a 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -699,7 +699,7 @@ cache_rpath (struct link_map *l, } -void +void __TEXT_STARTUP _dl_init_paths (const char *llp, const char *source, const char *glibc_hwcaps_prepend, const char *glibc_hwcaps_mask) diff --git a/elf/dl-minimal-malloc.c b/elf/dl-minimal-malloc.c index 27549645..5ee80163 100644 --- a/elf/dl-minimal-malloc.c +++ b/elf/dl-minimal-malloc.c @@ -30,7 +30,7 @@ static void *alloc_ptr, *alloc_end, *alloc_last_block; /* Allocate an aligned memory block. */ -void * +void * __TEXT_STARTUP __minimal_malloc (size_t n) { if (alloc_end == 0) @@ -73,7 +73,7 @@ __minimal_malloc (size_t n) /* We use this function occasionally since the real implementation may be optimized when it can assume the memory it returns already is set to NUL. */ -void * +void * __TEXT_STARTUP __minimal_calloc (size_t nmemb, size_t size) { /* New memory from the trivial malloc above is always already cleared. @@ -90,7 +90,7 @@ __minimal_calloc (size_t nmemb, size_t size) } /* This will rarely be called. */ -void +void __TEXT_STARTUP __minimal_free (void *ptr) { /* We can free only the last block allocated. */ @@ -104,7 +104,7 @@ __minimal_free (void *ptr) } /* This is only called with the most recent block returned by malloc. */ -void * +void * __TEXT_STARTUP __minimal_realloc (void *ptr, size_t n) { if (ptr == NULL) diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c index dc267519..88f91aa4 100644 --- a/elf/dl-minimal.c +++ b/elf/dl-minimal.c @@ -37,7 +37,7 @@ __typeof (free) *__rtld_free attribute_relro; __typeof (malloc) *__rtld_malloc attribute_relro; __typeof (realloc) *__rtld_realloc attribute_relro; -void +void __TEXT_STARTUP __rtld_malloc_init_stubs (void) { __rtld_calloc = &__minimal_calloc; @@ -55,7 +55,7 @@ __rtld_malloc_is_complete (void) } /* Lookup NAME at VERSION in the scope of MATCH. */ -static void * +static void * __TEXT_STARTUP lookup_malloc_symbol (struct link_map *main_map, const char *name, struct r_found_version *version) { @@ -71,7 +71,7 @@ lookup_malloc_symbol (struct link_map *main_map, const char *name, return _dl_sym_post (result, ref, value, 0, main_map); } -void +void __TEXT_STARTUP __rtld_malloc_init_real (struct link_map *main_map) { /* We cannot use relocations and initializers for this because the diff --git a/elf/dl-origin.c b/elf/dl-origin.c index 114a207d..47fdc4ec 100644 --- a/elf/dl-origin.c +++ b/elf/dl-origin.c @@ -24,7 +24,7 @@ #include -const char * +const char * __TEXT_STARTUP _dl_get_origin (void) { char *result = (char *) -1; diff --git a/elf/dl-reloc-static-pie.c b/elf/dl-reloc-static-pie.c index a143ee5a..c31a9b05 100644 --- a/elf/dl-reloc-static-pie.c +++ b/elf/dl-reloc-static-pie.c @@ -32,7 +32,7 @@ /* Relocate static executable with PIE. */ -void +void __TEXT_STARTUP _dl_relocate_static_pie (void) { struct link_map *main_map = _dl_get_dl_main_map (); diff --git a/elf/dl-sort-maps.c b/elf/dl-sort-maps.c index 5616c8a6..d4b9a343 100644 --- a/elf/dl-sort-maps.c +++ b/elf/dl-sort-maps.c @@ -285,7 +285,7 @@ _dl_sort_maps_dfs (struct link_map **maps, unsigned int nmaps, } } -void +void __TEXT_STARTUP _dl_sort_maps_init (void) { int32_t algorithm = TUNABLE_GET (glibc, rtld, dynamic_sort, int32_t, NULL); diff --git a/elf/dl-support.c b/elf/dl-support.c index 32259991..8c5a4e54 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -231,7 +231,7 @@ __rtld_lock_define_initialized_recursive (, _dl_load_tls_lock) int _dl_clktck; -void +void __TEXT_STARTUP _dl_aux_init (ElfW(auxv_t) *av) { #ifdef NEED_DL_SYSINFO @@ -269,7 +269,7 @@ _dl_aux_init (ElfW(auxv_t) *av) #endif -void +void __TEXT_STARTUP _dl_non_dynamic_init (void) { _dl_main_map.l_origin = _dl_get_origin (); diff --git a/elf/dl-tls.c b/elf/dl-tls.c index 5e198499..c04fd3d9 100644 --- a/elf/dl-tls.c +++ b/elf/dl-tls.c @@ -92,7 +92,7 @@ tls_static_surplus (int nns, int opt_tls) /* Calculate the size of the static TLS surplus, when the given number of audit modules are loaded. Must be called after the number of audit modules is known and before static TLS allocation. */ -void +void __TEXT_STARTUP _dl_tls_static_surplus_init (size_t naudit) { size_t nns, opt_tls; diff --git a/elf/dl-tls_init_tp.c b/elf/dl-tls_init_tp.c index e2c50580..42f65d55 100644 --- a/elf/dl-tls_init_tp.c +++ b/elf/dl-tls_init_tp.c @@ -33,7 +33,7 @@ rtld_lock_default_unlock_recursive (void *lock) } #endif -void +void __TEXT_STARTUP __tls_pre_init_tp (void) { #if !PTHREAD_IN_LIBC @@ -47,7 +47,7 @@ __tls_pre_init_tp (void) #endif } -void +void __TEXT_STARTUP __tls_init_tp (void) { } diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c index 62b7332d..71416a0a 100644 --- a/elf/dl-tunables.c +++ b/elf/dl-tunables.c @@ -38,7 +38,7 @@ #include -static char * +static char * __TEXT_STARTUP tunables_strdup (const char *in) { size_t i = 0; @@ -58,7 +58,7 @@ tunables_strdup (const char *in) return out; } -static char ** +static char ** __TEXT_STARTUP get_next_env (char **envp, char **name, size_t *namelen, char **val, char ***prev_envp) { @@ -86,7 +86,7 @@ get_next_env (char **envp, char **name, size_t *namelen, char **val, return NULL; } -static void +static void __TEXT_STARTUP do_tunable_update_val (tunable_t *cur, const tunable_val_t *valp, const tunable_num_t *minp, const tunable_num_t *maxp) @@ -133,7 +133,7 @@ do_tunable_update_val (tunable_t *cur, const tunable_val_t *valp, /* Validate range of the input value and initialize the tunable CUR if it looks good. */ -static void +static void __TEXT_STARTUP tunable_initialize (tunable_t *cur, const char *strval) { tunable_val_t val; @@ -145,7 +145,7 @@ tunable_initialize (tunable_t *cur, const char *strval) do_tunable_update_val (cur, &val, NULL, NULL); } -void +void __TEXT_STARTUP __tunable_set_val (tunable_id_t id, tunable_val_t *valp, tunable_num_t *minp, tunable_num_t *maxp) { @@ -159,7 +159,7 @@ __tunable_set_val (tunable_id_t id, tunable_val_t *valp, tunable_num_t *minp, environment variable value for GLIBC_TUNABLES. VALSTRING is the original environment variable string which we use to make NULL terminated values so that we don't have to allocate memory again for it. */ -static void +static void __TEXT_STARTUP parse_tunables (char *tunestr, char *valstring) { if (tunestr == NULL || *tunestr == '\0') @@ -255,7 +255,7 @@ parse_tunables (char *tunestr, char *valstring) for setuid binaries. We use the special version of access() to avoid setting ERRNO, which is a TLS variable since TLS has not yet been set up. */ -static __always_inline void +static __always_inline void __TEXT_STARTUP maybe_enable_malloc_check (void) { tunable_id_t id = TUNABLE_ENUM_NAME (glibc, malloc, check); @@ -266,7 +266,7 @@ maybe_enable_malloc_check (void) /* Initialize the tunables list from the environment. For now we only use the ENV_ALIAS to find values. Later we will also use the tunable names to find values. */ -void +void __TEXT_STARTUP __tunables_init (char **envp) { char *envname = NULL; @@ -343,7 +343,7 @@ __tunables_init (char **envp) } } -void +void __TEXT_STARTUP __tunables_print (void) { for (int i = 0; i < array_length (tunable_list); i++) diff --git a/elf/dl-usage.c b/elf/dl-usage.c index 98f0b0d0..369f3b2c 100644 --- a/elf/dl-usage.c +++ b/elf/dl-usage.c @@ -25,7 +25,7 @@ #include #include -void +void __TEXT_STARTUP _dl_usage (const char *argv0, const char *wrong_option) { if (wrong_option != NULL) @@ -36,7 +36,7 @@ _dl_usage (const char *argv0, const char *wrong_option) _exit (EXIT_FAILURE); } -void +void __TEXT_STARTUP _dl_version (void) { _dl_printf ("\ @@ -164,7 +164,7 @@ print_hwcaps_subdirectories (const struct dl_main_state *state) No subdirectories of glibc-hwcaps directories are searched.\n"); } -void +void __TEXT_STARTUP _dl_help (const char *argv0, struct dl_main_state *state) { _dl_printf ("\ diff --git a/elf/libc_early_init.c b/elf/libc_early_init.c index e54d2bb9..7ce7cbdb 100644 --- a/elf/libc_early_init.c +++ b/elf/libc_early_init.c @@ -28,7 +28,7 @@ _Bool __libc_initial; #endif -void +void __TEXT_STARTUP __libc_early_init (_Bool initial) { /* Initialize ctype data. */ diff --git a/elf/rtld.c b/elf/rtld.c index c1e383b0..5f26ceba 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -199,7 +199,7 @@ audit_list_init (struct audit_list *list) list->current_tail = NULL; } -static void +static void __TEXT_STARTUP audit_list_add_string (struct audit_list *list, const char *string) { /* Empty strings do not load anything. */ @@ -217,7 +217,7 @@ audit_list_add_string (struct audit_list *list, const char *string) list->current_tail = string; } -static void +static void __TEXT_STARTUP audit_list_add_dynamic_tag (struct audit_list *list, struct link_map *main_map, unsigned int tag) { @@ -227,7 +227,7 @@ audit_list_add_dynamic_tag (struct audit_list *list, struct link_map *main_map, audit_list_add_string (list, strtab + info->d_un.d_val); } -static const char * +static const char * __TEXT_STARTUP audit_list_next (struct audit_list *list) { if (list->current_tail == NULL) @@ -274,7 +274,7 @@ audit_list_next (struct audit_list *list) /* Count audit modules before they are loaded so GLRO(dl_naudit) is not yet usable. */ -static size_t +static size_t __TEXT_STARTUP audit_list_count (struct audit_list *list) { /* Restore the audit_list iterator state at the end. */ @@ -289,7 +289,7 @@ audit_list_count (struct audit_list *list) return naudit; } -static void +static void __TEXT_STARTUP dl_main_state_init (struct dl_main_state *state) { audit_list_init (&state->audit_list); @@ -444,10 +444,10 @@ RTLD_START this function is not inlined (see below). */ #ifdef DONT_USE_BOOTSTRAP_MAP -static inline ElfW(Addr) __attribute__ ((always_inline)) +static inline ElfW(Addr) __attribute__ ((always_inline)) __TEXT_STARTUP _dl_start_final (void *arg) #else -static ElfW(Addr) __attribute__ ((noinline)) +static ElfW(Addr) __attribute__ ((noinline)) __TEXT_STARTUP _dl_start_final (void *arg, struct dl_start_final_info *info) #endif { @@ -513,7 +513,7 @@ _dl_start_final (void *arg, struct dl_start_final_info *info) # define bootstrap_map info.l #endif -static ElfW(Addr) __attribute_used__ +static ElfW(Addr) __attribute_used__ __TEXT_STARTUP _dl_start (void *arg) { #ifdef DONT_USE_BOOTSTRAP_MAP @@ -730,7 +730,7 @@ match_version (const char *string, struct link_map *map) bool __rtld_tls_init_tp_called; -static void * +static void * __TEXT_STARTUP init_tls (size_t naudit) { /* Number of elements in the static TLS block. */ @@ -800,7 +800,7 @@ cannot allocate TLS data structures for initial thread\n"); return tcbp; } -static unsigned int +static unsigned int __TEXT_STARTUP do_preload (const char *fname, struct link_map *main_map, const char *where) { const char *objname; @@ -831,7 +831,7 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded (%s): ignored.\n", return 0; } -static void +static void __TEXT_STARTUP security_init (void) { /* Set up the stack checker's canary. */ @@ -864,7 +864,7 @@ security_init (void) (If the binary is running setuid all elements containing a '/' are ignored since it is insecure.) Return the number of preloads performed. Ditto for --preload command argument. */ -unsigned int +unsigned int __TEXT_STARTUP handle_preload_list (const char *preloadlist, struct link_map *main_map, const char *where) { @@ -898,7 +898,7 @@ handle_preload_list (const char *preloadlist, struct link_map *main_map, /* Called if the audit DSO cannot be used: if it does not have the appropriate interfaces, or it expects a more recent version library version than what the dynamic linker provides. */ -static void +static void __TEXT_STARTUP unload_audit_module (struct link_map *map, int original_tls_idx) { #ifndef NDEBUG @@ -927,7 +927,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", } /* Load one audit module. */ -static void +static void __TEXT_STARTUP load_audit_module (const char *name, struct audit_ifaces **last_audit) { int original_tls_idx = GL(dl_tls_max_dtv_idx); @@ -1045,7 +1045,7 @@ ERROR: audit interface '%s' requires version %d (maximum supported version %d); } /* Load all audit modules. */ -static void +static void __TEXT_STARTUP load_audit_modules (struct link_map *main_map, struct audit_list *audit_list) { struct audit_ifaces *last_audit = NULL; @@ -1069,7 +1069,7 @@ load_audit_modules (struct link_map *main_map, struct audit_list *audit_list) /* Check if the executable is not actualy dynamically linked, and invoke it directly in that case. */ -static void +static void __TEXT_STARTUP rtld_chain_load (struct link_map *main_map, char *argv0) { /* The dynamic loader run against itself. */ @@ -1108,7 +1108,7 @@ rtld_chain_load (struct link_map *main_map, char *argv0) /* Called to complete the initialization of the link map for the main executable. Returns true if there is a PT_INTERP segment. */ -static bool +static bool __TEXT_STARTUP rtld_setup_main_map (struct link_map *main_map) { /* This have already been filled in right after _dl_new_object, or @@ -1292,7 +1292,7 @@ rtld_setup_main_map (struct link_map *main_map) entry point. The ld.so processed skip_args arguments and bumped _dl_argv and _dl_argc accordingly. Those arguments are removed from argv here. */ -static void +static void __TEXT_STARTUP _dl_start_args_adjust (int skip_args) { void **sp = (void **) (_dl_argv - skip_args - 1); @@ -1344,7 +1344,7 @@ _dl_start_args_adjust (int skip_args) #endif } -static void +static void __TEXT_STARTUP dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum, ElfW(Addr) *user_entry, @@ -2430,7 +2430,7 @@ print_missing_version (int errcode __attribute__ ((unused)), /* Process the string given as the parameter which explains which debugging options are enabled. */ -static void +static void __TEXT_STARTUP process_dl_debug (struct dl_main_state *state, const char *dl_debug) { /* When adding new entries make sure that the maximal length of a name @@ -2535,7 +2535,7 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n"); } } -static void +static void __TEXT_STARTUP process_envvars (struct dl_main_state *state) { char **runp = _environ; diff --git a/hurd/hurdinit.c b/hurd/hurdinit.c index d0c7a831..f8e2f16c 100644 --- a/hurd/hurdinit.c +++ b/hurd/hurdinit.c @@ -65,7 +65,7 @@ __typeof (_hurd_proc_init) _hurd_new_proc_init; /* below */ PORTARRAY and INTARRAY are vm_deallocate'd. */ -void +void __TEXT_STARTUP _hurd_init (int flags, char **argv, mach_port_t *portarray, size_t portarraysize, int *intarray, size_t intarraysize) @@ -121,7 +121,7 @@ _hurd_init (int flags, char **argv, } libc_hidden_def (_hurd_init) -void +void __TEXT_STARTUP _hurd_libc_proc_init (char **argv) { if (_hurd_portarray) @@ -160,7 +160,7 @@ int _hide_arguments, _hide_environment; /* Do startup handshaking with the proc server just installed in _hurd_ports. Call _hurdsig_init to set up signal processing. */ -void +void __TEXT_STARTUP _hurd_new_proc_init (char **argv, const int *intarray, size_t intarraysize) { diff --git a/hurd/hurdstartup.c b/hurd/hurdstartup.c index 6af0205a..346c38c0 100644 --- a/hurd/hurdstartup.c +++ b/hurd/hurdstartup.c @@ -44,7 +44,7 @@ extern void __mach_init (void); port, and the base address and size of the preallocated stack. */ -void +void __TEXT_STARTUP _hurd_startup (void **argptr, void (*main) (intptr_t *data)) { error_t err; diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c index 62f94bbc..763a6ffc 100644 --- a/hurd/lookup-retry.c +++ b/hurd/lookup-retry.c @@ -43,6 +43,9 @@ lookup_error (error_t error) } } +#if IS_IN (rtld) +__TEXT_STARTUP +#endif error_t __hurd_file_name_lookup_retry (error_t (*use_init_port) (int which, error_t (*operate) (file_t)), diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c index c8d972c8..c034cc66 100644 --- a/iconv/gconv_cache.c +++ b/iconv/gconv_cache.c @@ -450,7 +450,7 @@ __gconv_release_cache (struct __gconv_step *steps, size_t nsteps) /* Free all resources if necessary. */ -void +void __TEXT_EXIT __gconv_cache_freemem (void) { if (cache_malloced) diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c index c76011d6..69d883ae 100644 --- a/iconv/gconv_conf.c +++ b/iconv/gconv_conf.c @@ -530,7 +530,7 @@ __gconv_load_conf (void) /* Free all resources if necessary. */ -void +void __TEXT_EXIT __gconv_conf_freemem (void) { if (__gconv_path_elem != NULL && __gconv_path_elem != &empty_path_elem) diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c index 0ee80762..8044d14c 100644 --- a/iconv/gconv_db.c +++ b/iconv/gconv_db.c @@ -792,7 +792,7 @@ __gconv_close_transform (struct __gconv_step *steps, size_t nsteps) /* Free the modules mentioned. */ -static void +static void __TEXT_EXIT free_modules_db (struct gconv_module *node) { if (node->left != NULL) @@ -811,7 +811,7 @@ free_modules_db (struct gconv_module *node) /* Free all resources if necessary. */ -void +void __TEXT_EXIT __gconv_db_freemem (void) { /* First free locale memory. This needs to be done before freeing diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c index cb51568e..8c30f401 100644 --- a/iconv/gconv_dl.c +++ b/iconv/gconv_dl.c @@ -196,7 +196,7 @@ do_release_all (void *nodep) free (obj); } -void +void __TEXT_EXIT __gconv_dl_freemem (void) { __tdestroy (loaded, do_release_all); diff --git a/intl/dcigettext.c b/intl/dcigettext.c index 7886ac95..103c44f7 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -1667,7 +1667,7 @@ mempcpy (void *dest, const void *src, size_t n) #ifdef _LIBC /* If we want to free all resources we have to do some work at program's end. */ -void +void __TEXT_EXIT __intl_freemem (void) { void *old; diff --git a/intl/finddomain.c b/intl/finddomain.c index 6a8b239a..2f00c898 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -185,7 +185,7 @@ out: #ifdef _LIBC /* This is called from iconv/gconv_db.c's free_mem, as locales must be freed before freeing gconv steps arrays. */ -void +void __TEXT_EXIT _nl_finddomain_subfreeres (void) { struct loaded_l10nfile *runp = _nl_loaded_domains; diff --git a/intl/localealias.c b/intl/localealias.c index ea4f48b5..98b2e492 100644 --- a/intl/localealias.c +++ b/intl/localealias.c @@ -436,7 +436,7 @@ alias_compare (const struct alias_map *map1, const struct alias_map *map2) #endif } -void +void __TEXT_EXIT __libc_localealias_freemem (void) { free (string_space); diff --git a/libio/genops.c b/libio/genops.c index 71313127..806e1c0f 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -844,7 +844,7 @@ _IO_unbuffer_all (void) #endif } -void +void __TEXT_EXIT __libio_freemem (void) { dealloc_buffers = true; @@ -858,7 +858,7 @@ __libio_freemem (void) } -int +int __TEXT_EXIT _IO_cleanup (void) { /* We do *not* want locking. Some threads might use streams but diff --git a/mach/mach_init.c b/mach/mach_init.c index 42b9cacf..61e19917 100644 --- a/mach/mach_init.c +++ b/mach/mach_init.c @@ -30,7 +30,7 @@ weak_alias (__vm_page_size, vm_page_size) # include NDR_DEF_HEADER #endif -void +void __TEXT_STARTUP __mach_init (void) { kern_return_t err; diff --git a/mach/mig-reply.c b/mach/mig-reply.c index ce2059bf..a8bb63e5 100644 --- a/mach/mig-reply.c +++ b/mach/mig-reply.c @@ -44,7 +44,7 @@ __mig_dealloc_reply_port (void) /* Called at startup with CPROC == NULL. cthreads has a different version of this function that is sometimes called with a `cproc_t' pointer. */ -void +void __TEXT_STARTUP __mig_init (void *cproc) { if (cproc == 0) diff --git a/malloc/set-freeres.c b/malloc/set-freeres.c index 1aab34b5..68c499f2 100644 --- a/malloc/set-freeres.c +++ b/malloc/set-freeres.c @@ -74,7 +74,7 @@ free (__ptr); #endif -void +void __TEXT_EXIT __libc_freeres (void) { /* This function might be called from different places. So better diff --git a/misc/fstab.c b/misc/fstab.c index ea4afc7d..9493a634 100644 --- a/misc/fstab.c +++ b/misc/fstab.c @@ -177,7 +177,7 @@ fstab_convert (struct fstab_state *state) /* Make sure the memory is freed if the programs ends while in memory-debugging mode and something actually was allocated. */ -void +void __TEXT_EXIT __libc_fstab_freemem (void) { char *buffer; diff --git a/misc/init-misc.c b/misc/init-misc.c index 32eb92d5..adb0ee2b 100644 --- a/misc/init-misc.c +++ b/misc/init-misc.c @@ -25,7 +25,7 @@ weak_alias (__progname_full, program_invocation_name) weak_alias (__progname, program_invocation_short_name) -void +void __TEXT_STARTUP __init_misc (int argc, char **argv, char **envp) { if (argv && argv[0]) diff --git a/nptl/pthread_mutex_conf.c b/nptl/pthread_mutex_conf.c index 65178997..0a3a4f46 100644 --- a/nptl/pthread_mutex_conf.c +++ b/nptl/pthread_mutex_conf.c @@ -32,25 +32,25 @@ struct mutex_config __mutex_aconf = }; libc_hidden_data_def (__mutex_aconf) -static void +static void __TEXT_STARTUP TUNABLE_CALLBACK (set_mutex_spin_count) (tunable_val_t *valp) { __mutex_aconf.spin_count = (int32_t) (valp)->numval; } -static void +static void __TEXT_STARTUP TUNABLE_CALLBACK (set_stack_cache_size) (tunable_val_t *valp) { __nptl_stack_cache_maxsize = valp->numval; } -static void +static void __TEXT_STARTUP TUNABLE_CALLBACK (set_stack_hugetlb) (tunable_val_t *valp) { __nptl_stack_hugetlb = (int32_t) valp->numval; } -void +void __TEXT_STARTUP __pthread_tunables_init (void) { TUNABLE_GET (mutex_spin_count, int32_t, diff --git a/nscd/nscd_getgr_r.c b/nscd/nscd_getgr_r.c index 07e89401..7f359990 100644 --- a/nscd/nscd_getgr_r.c +++ b/nscd/nscd_getgr_r.c @@ -68,7 +68,7 @@ libc_locked_map_ptr (,__gr_map_handle) attribute_hidden; /* Note that we only free the structure if necessary. The memory mapping is not removed since it is not visible to the malloc handling. */ -void +void __TEXT_EXIT __nscd_gr_map_freemem (void) { if (__gr_map_handle.mapped != NO_MAPPING) diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c index c6a6247f..dc31c874 100644 --- a/nscd/nscd_gethst_r.c +++ b/nscd/nscd_gethst_r.c @@ -81,7 +81,7 @@ libc_locked_map_ptr (, __hst_map_handle) attribute_hidden; /* Note that we only free the structure if necessary. The memory mapping is not removed since it is not visible to the malloc handling. */ -void +void __TEXT_EXIT __nscd_hst_map_freemem (void) { if (__hst_map_handle.mapped != NO_MAPPING) diff --git a/nscd/nscd_getpw_r.c b/nscd/nscd_getpw_r.c index 17d9753f..feb60b78 100644 --- a/nscd/nscd_getpw_r.c +++ b/nscd/nscd_getpw_r.c @@ -67,7 +67,7 @@ libc_locked_map_ptr (static, map_handle); /* Note that we only free the structure if necessary. The memory mapping is not removed since it is not visible to the malloc handling. */ -void +void __TEXT_EXIT __nscd_pw_map_freemem (void) { if (map_handle.mapped != NO_MAPPING) diff --git a/nscd/nscd_getserv_r.c b/nscd/nscd_getserv_r.c index 1458c6ca..5ff826b0 100644 --- a/nscd/nscd_getserv_r.c +++ b/nscd/nscd_getserv_r.c @@ -62,7 +62,7 @@ libc_locked_map_ptr (, __serv_map_handle) attribute_hidden; /* Note that we only free the structure if necessary. The memory mapping is not removed since it is not visible to the malloc handling. */ -void +void __TEXT_EXIT __nscd_serv_map_freemem (void) { if (__serv_map_handle.mapped != NO_MAPPING) diff --git a/nscd/nscd_netgroup.c b/nscd/nscd_netgroup.c index 6f4c383a..b9adc009 100644 --- a/nscd/nscd_netgroup.c +++ b/nscd/nscd_netgroup.c @@ -31,7 +31,7 @@ libc_locked_map_ptr (static, map_handle); /* Note that we only free the structure if necessary. The memory mapping is not removed since it is not visible to the malloc handling. */ -void +void __TEXT_EXIT __nscd_group_map_freemem (void) { if (map_handle.mapped != NO_MAPPING) diff --git a/nss/nss_action.c b/nss/nss_action.c index 447c219c..67f03e18 100644 --- a/nss/nss_action.c +++ b/nss/nss_action.c @@ -102,7 +102,7 @@ __nss_action_allocate (struct nss_action *actions, size_t count) return result; } -void +void __TEXT_EXIT __nss_action_freeres (void) { struct nss_action_list_wrapper *current = nss_actions; diff --git a/nss/nss_database.c b/nss/nss_database.c index 2edcab4b..09c021c2 100644 --- a/nss/nss_database.c +++ b/nss/nss_database.c @@ -495,7 +495,7 @@ __nss_database_get_noreload (enum nss_database db) return result; } -void +void __TEXT_EXIT __nss_database_freeres (void) { free (global_database_state); diff --git a/nss/nss_module.c b/nss/nss_module.c index 487e513d..6d915c08 100644 --- a/nss/nss_module.c +++ b/nss/nss_module.c @@ -416,7 +416,7 @@ __nss_module_disable_loading (void) __libc_lock_unlock (nss_module_list_lock); } -void +void __TEXT_EXIT __nss_module_freeres (void) { struct nss_module *current = nss_module_list; diff --git a/posix/_exit.c b/posix/_exit.c index 6635c117..667558a6 100644 --- a/posix/_exit.c +++ b/posix/_exit.c @@ -21,7 +21,7 @@ /* The function `_exit' should take a status argument and simply terminate program execution, using the low-order 8 bits of the given integer as status. */ -void +void __TEXT_EXIT _exit (int status) { status &= 0xff; diff --git a/posix/regcomp.c b/posix/regcomp.c index 12650714..57c19df6 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -710,7 +710,7 @@ re_comp (const char *s) } #ifdef _LIBC -void +void __TEXT_EXIT __libc_regcomp_freemem (void) { __regfree (&re_comp_buf); diff --git a/posix/register-atfork.c b/posix/register-atfork.c index 14ebc258..2258ceee 100644 --- a/posix/register-atfork.c +++ b/posix/register-atfork.c @@ -217,7 +217,7 @@ __run_postfork_handlers (enum __run_fork_handler_type who, _Bool do_locking, } -void +void __TEXT_EXIT __libc_atfork_freemem (void) { lll_lock (atfork_lock, LLL_PRIVATE); diff --git a/resolv/gai_misc.c b/resolv/gai_misc.c index 9e3b1d29..00658172 100644 --- a/resolv/gai_misc.c +++ b/resolv/gai_misc.c @@ -437,7 +437,7 @@ handle_requests (void *arg) #if !PTHREAD_IN_LIBC __attribute__ ((__destructor__)) static #endif -void +void __TEXT_EXIT __gai_freemem (void) { size_t row; diff --git a/resolv/resolv_conf.c b/resolv/resolv_conf.c index 0ef66d49..562cb6aa 100644 --- a/resolv/resolv_conf.c +++ b/resolv/resolv_conf.c @@ -654,7 +654,7 @@ __resolv_conf_detach (struct __res_state *resp) } /* Deallocate the global data. */ -void +void __TEXT_EXIT __libc_resolv_conf_freemem (void) { /* No locking because this function is supposed to be called when diff --git a/rt/aio_misc.c b/rt/aio_misc.c index 4b850b1a..af86a9f5 100644 --- a/rt/aio_misc.c +++ b/rt/aio_misc.c @@ -697,7 +697,7 @@ handle_fildes_io (void *arg) #if !PTHREAD_IN_LIBC __attribute__ ((__destructor__)) static #endif -void +void __TEXT_EXIT __aio_freemem (void) { size_t row; diff --git a/stdio-common/reg-modifier.c b/stdio-common/reg-modifier.c index a52022d1..309ccb76 100644 --- a/stdio-common/reg-modifier.c +++ b/stdio-common/reg-modifier.c @@ -183,7 +183,7 @@ __handle_registered_modifier_wc (const unsigned int **format, } -void +void __TEXT_EXIT __libc_printf_freemem (void) { if (__printf_modifier_table != NULL) diff --git a/stdlib/exit.c b/stdlib/exit.c index d6c188b7..f628f397 100644 --- a/stdlib/exit.c +++ b/stdlib/exit.c @@ -32,7 +32,7 @@ bool __exit_funcs_done = false; in the reverse of the order in which they were registered perform stdio cleanup, and terminate program execution with STATUS. */ void -attribute_hidden +attribute_hidden __TEXT_EXIT __run_exit_handlers (int status, struct exit_function_list **listp, bool run_list_atexit, bool run_dtors) { @@ -135,7 +135,7 @@ __run_exit_handlers (int status, struct exit_function_list **listp, } -void +void __TEXT_EXIT exit (int status) { __run_exit_handlers (status, &__exit_funcs, true, true); diff --git a/stdlib/fmtmsg.c b/stdlib/fmtmsg.c index 3d9a0edf..ce821807 100644 --- a/stdlib/fmtmsg.c +++ b/stdlib/fmtmsg.c @@ -361,7 +361,7 @@ __addseverity (int severity, const char *string) weak_alias (__addseverity, addseverity) -void +void __TEXT_EXIT __libc_fmtmsg_freemem (void) { struct severity_info *runp = severity_list; diff --git a/stdlib/quick_exit.c b/stdlib/quick_exit.c index 838d4658..bda33f71 100644 --- a/stdlib/quick_exit.c +++ b/stdlib/quick_exit.c @@ -24,7 +24,7 @@ #include #include "exit.h" -void +void __TEXT_EXIT __new_quick_exit (int status) { /* The new quick_exit, following C++11 18.5.12, does not run object diff --git a/stdlib/setenv.c b/stdlib/setenv.c index ba5257d3..1fbbe701 100644 --- a/stdlib/setenv.c +++ b/stdlib/setenv.c @@ -323,7 +323,7 @@ clearenv (void) return 0; } #ifdef _LIBC -void +void __TEXT_EXIT __libc_setenv_freemem (void) { /* Remove all traces. */ diff --git a/sunrpc/clnt_perr.c b/sunrpc/clnt_perr.c index c3d13722..cfe91db3 100644 --- a/sunrpc/clnt_perr.c +++ b/sunrpc/clnt_perr.c @@ -389,7 +389,7 @@ auth_errmsg (enum auth_stat stat) } -void +void __TEXT_EXIT __rpc_freemem (void) { free (buf); diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index 4170b926..95ba835b 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -120,7 +120,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index ed5389e3..5e748d2c 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -205,7 +205,7 @@ _dl_start_user: \n\ * _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index d720c02c..3825ec56 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -194,7 +194,7 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') diff --git a/sysdeps/csky/dl-machine.h b/sysdeps/csky/dl-machine.h index 07a4b678..6bbe5427 100644 --- a/sysdeps/csky/dl-machine.h +++ b/sysdeps/csky/dl-machine.h @@ -161,7 +161,7 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') diff --git a/sysdeps/generic/dl-call_tls_init_tp.h b/sysdeps/generic/dl-call_tls_init_tp.h index 34f0959f..f053e07e 100644 --- a/sysdeps/generic/dl-call_tls_init_tp.h +++ b/sysdeps/generic/dl-call_tls_init_tp.h @@ -25,7 +25,7 @@ _startup_fatal_tls_error (void) _startup_fatal ("Fatal glibc error: Cannot allocate TLS block\n"); } -static inline void +static inline void __TEXT_STARTUP call_tls_init_tp (void *addr) { if (!TLS_INIT_TP (addr)) diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index 4e6e70b3..7af13bba 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -525,7 +525,7 @@ asm ( \ * _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 18749f2e..d64494e7 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -200,7 +200,7 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { #if IS_IN (rtld) diff --git a/sysdeps/mach/hurd/_exit.c b/sysdeps/mach/hurd/_exit.c index 80cfe532..e7ad58a7 100644 --- a/sysdeps/mach/hurd/_exit.c +++ b/sysdeps/mach/hurd/_exit.c @@ -21,7 +21,7 @@ #include #include -void +void __TEXT_EXIT _hurd_exit (int status) { if (_hurd_ports != NULL) @@ -46,7 +46,7 @@ _hurd_exit (int status) } } -void +void __TEXT_EXIT _exit (int status) { _hurd_exit (W_EXITCODE (status, 0)); diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 01a16570..af1ae142 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -68,7 +68,7 @@ void *_dl_random attribute_relro = NULL; struct hurd_startup_data *_dl_hurd_data; -ElfW(Addr) +ElfW(Addr) __TEXT_STARTUP _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phent, ElfW(Addr) *user_entry, @@ -232,7 +232,7 @@ _dl_sysdep_start (void **start_argptr, abort (); } -void +void __TEXT_STARTUP _dl_sysdep_start_cleanup (void) { /* Deallocate the reply port and task port rights acquired by @@ -261,7 +261,7 @@ _dl_sysdep_start_cleanup (void) /* Open FILE_NAME and return a Hurd I/O for it in *PORT, or return an error. If STAT is non-zero, stat the file into that stat buffer. */ -static error_t +static error_t __TEXT_STARTUP open_file (const char *file_name, int flags, mach_port_t *port, struct stat64 *stat) { @@ -318,7 +318,7 @@ open_file (const char *file_name, int flags, check_no_hidden(__open); check_no_hidden (__open64); check_no_hidden (__open_nocancel); -int weak_function +int weak_function __TEXT_STARTUP __open (const char *file_name, int mode, ...) { mach_port_t port; @@ -333,7 +333,7 @@ weak_alias (__open, __open_nocancel) check_no_hidden(__close); check_no_hidden(__close_nocancel); -int weak_function +int weak_function __TEXT_STARTUP __close (int fd) { if (fd != (int) MACH_PORT_NULL) @@ -344,7 +344,7 @@ weak_alias (__close, __close_nocancel) check_no_hidden(__pread64); check_no_hidden(__pread64_nocancel); -__ssize_t weak_function +__ssize_t weak_function __TEXT_STARTUP __pread64 (int fd, void *buf, size_t nbytes, off64_t offset) { error_t err; @@ -370,7 +370,7 @@ weak_alias (__pread64, __pread64_nocancel) check_no_hidden(__read); check_no_hidden(__read_nocancel); -__ssize_t weak_function +__ssize_t weak_function __TEXT_STARTUP __read (int fd, void *buf, size_t nbytes) { return __pread64 (fd, buf, nbytes, -1); @@ -380,7 +380,7 @@ weak_alias (__read, __read_nocancel) check_no_hidden(__write); check_no_hidden(__write_nocancel); -__ssize_t weak_function +__ssize_t weak_function __TEXT_STARTUP __write (int fd, const void *buf, size_t nbytes) { error_t err; @@ -399,7 +399,7 @@ libc_hidden_weak (__write) /* This is only used for printing messages (see dl-misc.c). */ check_no_hidden(__writev); -__ssize_t weak_function +__ssize_t weak_function __TEXT_STARTUP __writev (int fd, const struct iovec *iov, int niov) { if (fd >= _hurd_init_dtablesize) @@ -433,7 +433,7 @@ __writev (int fd, const struct iovec *iov, int niov) } check_no_hidden(__libc_lseek64); -off64_t weak_function +off64_t weak_function __TEXT_STARTUP __libc_lseek64 (int fd, off64_t offset, int whence) { error_t err; @@ -446,7 +446,7 @@ __libc_lseek64 (int fd, off64_t offset, int whence) } check_no_hidden(__mmap); -void *weak_function +void *weak_function __TEXT_STARTUP __mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset) { error_t err; @@ -516,7 +516,7 @@ __mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset) } check_no_hidden(__fstat64); -int weak_function +int weak_function __TEXT_STARTUP __fstat64 (int fd, struct stat64 *buf) { error_t err; @@ -530,7 +530,7 @@ __fstat64 (int fd, struct stat64 *buf) libc_hidden_def (__fstat64) check_no_hidden(__stat64); -int weak_function +int weak_function __TEXT_STARTUP __stat64 (const char *file, struct stat64 *buf) { error_t err; @@ -551,20 +551,20 @@ libc_hidden_def (__stat64) stub will always fail, which means that malloc-debugging is always disabled for SUID binaries. */ check_no_hidden(__access); -int weak_function +int weak_function __TEXT_STARTUP __access (const char *file, int type) { errno = ENOSYS; return -1; } check_no_hidden(__access_noerrno); -int weak_function +int weak_function __TEXT_STARTUP __access_noerrno (const char *file, int type) { return -1; } -int +int __TEXT_STARTUP __rtld_execve (const char *file_name, char *const argv[], char *const envp[]) { @@ -670,7 +670,7 @@ out: } check_no_hidden(__getpid); -pid_t weak_function +pid_t weak_function __TEXT_STARTUP __getpid (void) { pid_t pid, ppid; @@ -694,7 +694,7 @@ strong_alias (__getpid, __GI___getpid) reusing getcwd.c's code but using our special lookup function as in `open', above.) */ check_no_hidden(__getcwd); -char *weak_function +char *weak_function __TEXT_STARTUP __getcwd (char *buf, size_t size) { errno = ENOSYS; @@ -704,7 +704,7 @@ __getcwd (char *buf, size_t size) /* This is used by dl-tunables.c to strdup strings. We can just make this a mere allocation. */ check_no_hidden(__sbrk); -void *weak_function +void *weak_function __TEXT_STARTUP __sbrk (intptr_t increment) { vm_address_t addr; @@ -715,7 +715,7 @@ __sbrk (intptr_t increment) /* This is only used by hurdlookup for the /dev/fd/nnn magic. * We avoid pulling the whole libc implementation, and we can keep this hidden. */ -unsigned long int weak_function +unsigned long int weak_function __TEXT_STARTUP __strtoul_internal (const char *nptr, char **endptr, int base, int group) { assert (base == 0 || base == 10); @@ -729,7 +729,7 @@ strong_alias (__strtoul_internal, __GI___strtoul_internal) strong_alias (__strtoul_internal, __GI_____strtoul_internal) check_no_hidden(_exit); -void weak_function attribute_hidden +void weak_function attribute_hidden __TEXT_EXIT _exit (int status) { __proc_mark_exit (_dl_hurd_data->portarray[INIT_PORT_PROC], @@ -780,7 +780,7 @@ strong_alias (abort, __GI___assert_perror_fail) weak, the real defn in libc.so will override it if we are linked into the user program (-ldl). */ -error_t weak_function +error_t weak_function __TEXT_STARTUP _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, mach_msg_option_t option, mach_msg_size_t send_size, @@ -794,14 +794,14 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, } -void +void __TEXT_STARTUP _dl_show_auxv (void) { /* There is nothing to print. Hurd has no auxiliary vector. */ } -void weak_function +void weak_function __TEXT_STARTUP _dl_init_first (void *p) { /* This no-op definition only gets used if libc is not linked in. */ diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h index e124fb10..8029b2db 100644 --- a/sysdeps/mach/hurd/i386/tls.h +++ b/sysdeps/mach/hurd/i386/tls.h @@ -135,7 +135,7 @@ __LIBC_NO_TLS (void) /* Code to initially initialize the thread pointer. This might need special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ -static inline bool __attribute__ ((unused)) +static inline bool __attribute__ ((unused)) __TEXT_STARTUP _hurd_tls_init (tcbhead_t *tcb, bool full) { HURD_TLS_DESC_DECL (desc, tcb); diff --git a/sysdeps/mach/hurd/mig-reply.c b/sysdeps/mach/hurd/mig-reply.c index 7ea001df..c582b9d3 100644 --- a/sysdeps/mach/hurd/mig-reply.c +++ b/sysdeps/mach/hurd/mig-reply.c @@ -98,7 +98,7 @@ weak_alias (__mig_put_reply_port, mig_put_reply_port) /* Called at startup with STACK == NULL. When per-thread variables are set up, this is called again with STACK set to the new stack being switched to, where per-thread variables should be set up. */ -void +void __TEXT_STARTUP __mig_init (void *stack) { /* Do nothing. */ diff --git a/sysdeps/mach/hurd/x86/init-first.c b/sysdeps/mach/hurd/x86/init-first.c index d74a3c86..772fcfab 100644 --- a/sysdeps/mach/hurd/x86/init-first.c +++ b/sysdeps/mach/hurd/x86/init-first.c @@ -49,7 +49,7 @@ DEFINE_HOOK (_hurd_preinit_hook, (void)); /* We call this once the Hurd magic is all set up and we are ready to be a Posixoid program. This does the same things the generic version does. */ -static void +static void __TEXT_STARTUP posixland_init (int argc, char **argv, char **envp) { /* Now we have relocations etc. we can start signals etc. */ @@ -82,7 +82,7 @@ posixland_init (int argc, char **argv, char **envp) __init_misc (argc, argv, envp); } -static void +static void __TEXT_STARTUP init (void **data) { int argc = (int) (uintptr_t) *data; @@ -147,7 +147,7 @@ init (void **data) } /* Do the first essential initializations that must precede all else. */ -static inline void +static inline void __TEXT_STARTUP first_init (void) { /* Initialize data structures so we can do RPCs. */ @@ -167,7 +167,7 @@ first_init (void) initialization of the shared C library before normal initializers expecting a Posixoid environment can run. */ -void +void __TEXT_STARTUP _dl_init_first (void *data) { first_init (); @@ -182,7 +182,7 @@ _dl_init_first (void *data) the only thing that really matters!! */ strong_alias (posixland_init, _init); -void +void __TEXT_STARTUP __libc_init_first (int argc, char **argv, char **envp) { /* Everything was done in the shared library initializer, _init. */ @@ -195,7 +195,7 @@ strong_alias (posixland_init, __libc_init_first); /* XXX This is all a crock and I am not happy with it. This poorly-named function is called by static-start.S, which should not exist at all. */ -void +void __TEXT_STARTUP inhibit_stack_protector _hurd_stack_setup (void) { diff --git a/sysdeps/mach/hurd/x86_64/tls.h b/sysdeps/mach/hurd/x86_64/tls.h index 1274723a..d724767a 100644 --- a/sysdeps/mach/hurd/x86_64/tls.h +++ b/sysdeps/mach/hurd/x86_64/tls.h @@ -172,7 +172,7 @@ _hurd_tls_new (thread_t child, tcbhead_t *tcb) extern unsigned char __libc_tls_initialized; # define __LIBC_NO_TLS() __builtin_expect (!__libc_tls_initialized, 0) -static inline bool __attribute__ ((unused)) +static inline bool __attribute__ ((unused)) __TEXT_STARTUP _hurd_tls_init (tcbhead_t *tcb, bool full) { error_t err; diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index f1b3effe..a08e526a 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -391,7 +391,7 @@ do { \ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') diff --git a/sysdeps/nptl/dl-mutex.c b/sysdeps/nptl/dl-mutex.c index 415df854..ad99d819 100644 --- a/sysdeps/nptl/dl-mutex.c +++ b/sysdeps/nptl/dl-mutex.c @@ -25,7 +25,7 @@ __typeof (pthread_mutex_lock) *___rtld_mutex_lock attribute_relro; __typeof (pthread_mutex_unlock) *___rtld_mutex_unlock attribute_relro; -void +void __TEXT_STARTUP __rtld_mutex_init (void) { /* There is an implicit assumption here that the lock counters are diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c index 50dc7788..3198ef48 100644 --- a/sysdeps/nptl/dl-tls_init_tp.c +++ b/sysdeps/nptl/dl-tls_init_tp.c @@ -48,7 +48,7 @@ const unsigned int __rseq_flags; const unsigned int __rseq_size attribute_relro; const ptrdiff_t __rseq_offset attribute_relro; -void +void __TEXT_STARTUP __tls_pre_init_tp (void) { /* The list data structures are not consistent until @@ -63,7 +63,7 @@ __tls_pre_init_tp (void) #endif } -void +void __TEXT_STARTUP __tls_init_tp (void) { struct pthread *pd = THREAD_SELF; diff --git a/sysdeps/nptl/pthread_early_init.h b/sysdeps/nptl/pthread_early_init.h index f1a3b65d..ef722292 100644 --- a/sysdeps/nptl/pthread_early_init.h +++ b/sysdeps/nptl/pthread_early_init.h @@ -24,7 +24,7 @@ #include #include -static inline void +static inline void __TEXT_STARTUP __pthread_early_init (void) { /* Determine the default allowed stack size. This is the size used diff --git a/sysdeps/or1k/dl-machine.h b/sysdeps/or1k/dl-machine.h index b6707b96..d0d0f152 100644 --- a/sysdeps/or1k/dl-machine.h +++ b/sysdeps/or1k/dl-machine.h @@ -142,7 +142,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 0356b622..633b14f7 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -1761,7 +1761,7 @@ check_gaiconf_mtime (const struct __stat64_t64 *st) #endif -void +void __TEXT_EXIT __libc_getaddrinfo_freemem (void) { if (labels != default_labels) diff --git a/sysdeps/powerpc/cpu-features.c b/sysdeps/powerpc/cpu-features.c index 0ef3cf89..81601adf 100644 --- a/sysdeps/powerpc/cpu-features.c +++ b/sysdeps/powerpc/cpu-features.c @@ -20,7 +20,7 @@ #include #include -static inline void +static inline void __TEXT_STARTUP init_cpu_features (struct cpu_features *cpu_features) { /* Default is to use aligned memory access on optimized function unless diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h index a4cad758..076d9f8d 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.h +++ b/sysdeps/powerpc/powerpc32/dl-machine.h @@ -153,7 +153,7 @@ __elf_preferred_address(struct link_map *loader, size_t maplength, #ifdef SHARED # define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { __tcb_parse_hwcap_and_convert_at_platform (); diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index 9b8943bc..a69ad0ed 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -293,7 +293,7 @@ BODY_PREFIX "_dl_start_user:\n" \ #if defined(SHARED) && IS_IN (rtld) # define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { __tcb_parse_hwcap_and_convert_at_platform (); diff --git a/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h b/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h index e0ec3ba4..e5c9e742 100644 --- a/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h +++ b/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h @@ -22,7 +22,7 @@ #include #include -static inline void +static inline void __TEXT_STARTUP dl_hwcap_check (void) { #ifdef GCCMACRO_ARCH_PWR9 diff --git a/sysdeps/s390/cpu-features.c b/sysdeps/s390/cpu-features.c index 39f8c23a..b7b56f8d 100644 --- a/sysdeps/s390/cpu-features.c +++ b/sysdeps/s390/cpu-features.c @@ -27,7 +27,7 @@ extern __typeof (memcmp) MEMCMP_DEFAULT; (DEST_PTR)->hwcap = (SRC_PTR)->hwcap; \ (DEST_PTR)->stfle_bits[0] = (SRC_PTR)->stfle_bits[0]; -static void +static void __TEXT_STARTUP TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) { /* The current IFUNC selection is always using the most recent @@ -203,7 +203,7 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) & cpu_features_orig.stfle_bits[0]; } -static inline void +static inline void __TEXT_STARTUP init_cpu_features (struct cpu_features *cpu_features) { /* Fill cpu_features as passed by kernel and machine. */ diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 100a3e05..cf784ed8 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -239,7 +239,7 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') diff --git a/sysdeps/s390/s390-64/dl-hwcap-check.h b/sysdeps/s390/s390-64/dl-hwcap-check.h index 0994779a..b05c24f0 100644 --- a/sysdeps/s390/s390-64/dl-hwcap-check.h +++ b/sysdeps/s390/s390-64/dl-hwcap-check.h @@ -22,7 +22,7 @@ #include #include -static inline void +static inline void __TEXT_STARTUP dl_hwcap_check (void) { #if defined __ARCH__ diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index 9fabb097..6ab736c3 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -215,7 +215,7 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index 0e4eac42..f9492678 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -209,7 +209,7 @@ __fpscr_values:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') diff --git a/sysdeps/unix/sysv/linux/_exit.c b/sysdeps/unix/sysv/linux/_exit.c index 74d478a4..3392a2f0 100644 --- a/sysdeps/unix/sysv/linux/_exit.c +++ b/sysdeps/unix/sysv/linux/_exit.c @@ -22,7 +22,7 @@ #include -void +void __TEXT_EXIT _exit (int status) { while (1) diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c index dc09c1c8..612691cb 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c @@ -49,7 +49,7 @@ static struct cpu_list cpu_list[] = { {"generic", 0x0} }; -static uint64_t +static uint64_t __TEXT_STARTUP get_midr_from_mcpu (const char *mcpu) { for (int i = 0; i < sizeof (cpu_list) / sizeof (struct cpu_list); i++) @@ -59,7 +59,7 @@ get_midr_from_mcpu (const char *mcpu) return UINT64_MAX; } -static inline void +static inline void __TEXT_STARTUP init_cpu_features (struct cpu_features *cpu_features) { register uint64_t midr = UINT64_MAX; diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c index 2b0b8b63..7fc85816 100644 --- a/sysdeps/unix/sysv/linux/check_pf.c +++ b/sysdeps/unix/sysv/linux/check_pf.c @@ -377,7 +377,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6, } /* Free the cache if it has been allocated. */ -void +void __TEXT_EXIT __check_pf_freemem (void) { if (cache) diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c index 1b3dd869..fe9d46e0 100644 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c @@ -72,7 +72,7 @@ struct dl_main_arguments /* Separate function, so that dl_main can be called without the large array on the stack. */ -static void +static void __TEXT_STARTUP _dl_sysdep_parse_arguments (void **start_argptr, struct dl_main_arguments *args) { @@ -95,7 +95,7 @@ _dl_sysdep_parse_arguments (void **start_argptr, args->user_entry = auxv_values[AT_ENTRY]; } -ElfW(Addr) +ElfW(Addr) __TEXT_STARTUP _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum, ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv)) @@ -142,12 +142,12 @@ _dl_sysdep_start (void **start_argptr, return dl_main_args.user_entry; } -void +void __TEXT_STARTUP _dl_sysdep_start_cleanup (void) { } -void +void __TEXT_STARTUP _dl_show_auxv (void) { char buf[64]; diff --git a/sysdeps/unix/sysv/linux/x86/cpu-features.c b/sysdeps/unix/sysv/linux/x86/cpu-features.c index 41e76006..d86bc833 100644 --- a/sysdeps/unix/sysv/linux/x86/cpu-features.c +++ b/sysdeps/unix/sysv/linux/x86/cpu-features.c @@ -30,7 +30,7 @@ get_cet_status (void) } # ifndef SHARED -static inline void +static inline void __TEXT_STARTUP x86_setup_tls (void) { __libc_setup_tls (); diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index 5bff8ec0..27cce9cc 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -28,7 +28,7 @@ extern void TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *) attribute_hidden; #ifdef __LP64__ -static void +static void __TEXT_STARTUP TUNABLE_CALLBACK (set_prefer_map_32bit_exec) (tunable_val_t *valp) { if (valp->numval) @@ -46,7 +46,7 @@ extern void TUNABLE_CALLBACK (set_x86_shstk) (tunable_val_t *) # include #endif -static void +static void __TEXT_STARTUP update_active (struct cpu_features *cpu_features) { /* Copy the cpuid bits to active bits for CPU featuress whose usability @@ -318,7 +318,7 @@ update_active (struct cpu_features *cpu_features) cpu_features->isa_1 = get_isa_level (cpu_features); } -static void +static void __TEXT_STARTUP get_extended_indices (struct cpu_features *cpu_features) { unsigned int eax, ebx, ecx, edx; @@ -343,7 +343,7 @@ get_extended_indices (struct cpu_features *cpu_features) cpu_features->features[CPUID_INDEX_80000008].cpuid.edx); } -static void +static void __TEXT_STARTUP get_common_indices (struct cpu_features *cpu_features, unsigned int *family, unsigned int *model, unsigned int *extended_model, unsigned int *stepping) @@ -417,7 +417,7 @@ _Static_assert (((index_arch_Fast_Unaligned_Load == index_arch_Fast_Copy_Backward)), "Incorrect index_arch_Fast_Unaligned_Load"); -static inline void +static inline void __TEXT_STARTUP init_cpu_features (struct cpu_features *cpu_features) { unsigned int ebx, ecx, edx; diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-tunables.c index 0d4f3285..8d9bcd40 100644 --- a/sysdeps/x86/cpu-tunables.c +++ b/sysdeps/x86/cpu-tunables.c @@ -86,7 +86,7 @@ extern __typeof (memcmp) DEFAULT_MEMCMP; } attribute_hidden -void +void __TEXT_STARTUP TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) { /* The current IFUNC selection is based on microbenchmarks in glibc. @@ -287,7 +287,7 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) #if CET_ENABLED attribute_hidden -void +void __TEXT_STARTUP TUNABLE_CALLBACK (set_x86_ibt) (tunable_val_t *valp) { if (DEFAULT_MEMCMP (valp->strval, "on", sizeof ("on")) == 0) @@ -300,7 +300,7 @@ TUNABLE_CALLBACK (set_x86_ibt) (tunable_val_t *valp) } attribute_hidden -void +void __TEXT_STARTUP TUNABLE_CALLBACK (set_x86_shstk) (tunable_val_t *valp) { if (DEFAULT_MEMCMP (valp->strval, "on", sizeof ("on")) == 0) diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h index ec88945b..a58ccd73 100644 --- a/sysdeps/x86/dl-cacheinfo.h +++ b/sysdeps/x86/dl-cacheinfo.h @@ -98,7 +98,7 @@ static const struct intel_02_cache_info #define nintel_02_known (sizeof (intel_02_known) / sizeof (intel_02_known [0])) -static int +static int __TEXT_STARTUP intel_02_known_compare (const void *p1, const void *p2) { const struct intel_02_cache_info *i1; @@ -115,7 +115,7 @@ intel_02_known_compare (const void *p1, const void *p2) static long int -__attribute__ ((noinline)) +__attribute__ ((noinline)) __TEXT_STARTUP intel_check_word (int name, unsigned int value, bool *has_level_2, bool *no_level_2_or_3, const struct cpu_features *cpu_features) @@ -246,7 +246,7 @@ intel_check_word (int name, unsigned int value, bool *has_level_2, } -static long int __attribute__ ((noinline)) +static long int __attribute__ ((noinline)) __TEXT_STARTUP handle_intel (int name, const struct cpu_features *cpu_features) { unsigned int maxidx = cpu_features->basic.max_cpuid; @@ -310,7 +310,7 @@ handle_intel (int name, const struct cpu_features *cpu_features) } -static long int __attribute__ ((noinline)) +static long int __attribute__ ((noinline)) __TEXT_STARTUP handle_amd (int name) { unsigned int eax; @@ -356,7 +356,7 @@ handle_amd (int name) } -static long int __attribute__ ((noinline)) +static long int __attribute__ ((noinline)) __TEXT_STARTUP handle_zhaoxin (int name) { unsigned int eax; @@ -406,7 +406,7 @@ handle_zhaoxin (int name) return 0; } -static void +static void __TEXT_STARTUP get_common_cache_info (long int *shared_ptr, unsigned int *threads_ptr, long int core) { @@ -623,7 +623,7 @@ intel_bug_no_cache_info: *threads_ptr = threads; } -static void +static void __TEXT_STARTUP dl_init_cacheinfo (struct cpu_features *cpu_features) { /* Find out what brand of processor. */ diff --git a/sysdeps/x86/dl-get-cpu-features.c b/sysdeps/x86/dl-get-cpu-features.c index 5e3bb04d..598d30bb 100644 --- a/sysdeps/x86/dl-get-cpu-features.c +++ b/sysdeps/x86/dl-get-cpu-features.c @@ -32,7 +32,7 @@ extern void __x86_cpu_features (void) attribute_hidden; void (*const __x86_cpu_features_p) (void) attribute_hidden = __x86_cpu_features; -void +void __TEXT_STARTUP _dl_x86_init_cpu_features (void) { struct cpu_features *cpu_features = __get_cpu_features (); diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 9ea2a708..34eb865e 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -197,7 +197,7 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -static inline void __attribute__ ((unused)) +static inline void __attribute__ ((unused)) __TEXT_STARTUP dl_platform_init (void) { #if IS_IN (rtld) diff --git a/time/tzset.c b/time/tzset.c index 8c740a4e..e666f974 100644 --- a/time/tzset.c +++ b/time/tzset.c @@ -610,7 +610,7 @@ __tz_convert (__time64_t timer, int use_localtime, struct tm *tp) } -void +void __TEXT_EXIT __libc_tzset_freemem (void) { while (tzstring_list != NULL) From patchwork Mon May 15 14:48:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 1781489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=B9uGnVZ7; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QKj2G2Q5pz20db for ; Tue, 16 May 2023 00:49:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 54CC13857011 for ; Mon, 15 May 2023 14:49:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 54CC13857011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684162180; bh=B7TDpstBjoaF3+Smm5Mr+uqkVqs8HN456U8tOUYK88g=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=B9uGnVZ7XZl+IWK2nkCS8ply3EKYNrU1NXJwdZqJRpb2RrqzYNG3TS2Od8DrITg+U zQKxn27b9PiRMRZmClDSJNgF2Bcrjx1kGvW0Rl/ZMPetwsxK4FfnI1v6SztZQhth2J sCiOQzVc6m9QITabNshOA/SWPDNusoVVnvC6ZaQM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 04ADC385700B for ; Mon, 15 May 2023 14:48:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 04ADC385700B Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2ac8c0fbb16so125138791fa.2 for ; Mon, 15 May 2023 07:48:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684162102; x=1686754102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B7TDpstBjoaF3+Smm5Mr+uqkVqs8HN456U8tOUYK88g=; b=MPZ/rzm0ET7oVE78ZfOpj8P1pjIsyls38bvPYIoLR1G7QKPRW4sMiXjVTpKTK6NUhq ls3tW/YwpwJGjKhrDrVoN05pL55NWj58XGAnIfC0NQckjvKLhF3vhURiEWCHyx6zhTzB o1PUkTdh63+u8Rxu3nJiNHOAEkh2WIERQVq4PBIOW9SbPDR5Z4rxjWG8uJX0V045b5xQ KQMEBC4KuxgFQKRYxSIbNu8n1K8WW6hN6Uu5syyKSn6I/TtgjdYyVTxDPIi+IFgXMyJp qXnoT9h3e1ierue4CCY8zo/3b0dgWSSskfuRh2XtZ3oZtOpSP2STZTXtOLpEfovOxFyc At8Q== X-Gm-Message-State: AC+VfDzmJa9hlZ7DoIaNgL9gmNIXcUGmx2KprMSx9TBGRXp1cZstkdsS tbrA7X1d6mFsFGxCzpZsxm1BUIDtLm4= X-Google-Smtp-Source: ACHHUZ7ndegTzd1R/jE1RMF4AFlDJb2dnlYbFubCYOAT8L+X1abv9UF+9doQ00TPvA4tEmCuG0+nfg== X-Received: by 2002:ac2:5ec5:0:b0:4ec:89d3:a8a2 with SMTP id d5-20020ac25ec5000000b004ec89d3a8a2mr7513159lfq.43.1684162101798; Mon, 15 May 2023 07:48:21 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id w9-20020a056512098900b004f11e965308sm2643336lft.20.2023.05.15.07.48.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:48:21 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [RFC PATCH 5/6] Also place entry points into .text.startup Date: Mon, 15 May 2023 17:48:14 +0300 Message-Id: <20230515144815.3939017-6-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515144815.3939017-1-bugaevc@gmail.com> References: <20230515144815.3939017-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Sergey Bugaev via Libc-alpha From: Sergey Bugaev Reply-To: Sergey Bugaev Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Signed-off-by: Sergey Bugaev --- sysdeps/aarch64/dl-start.S | 1 + sysdeps/aarch64/start.S | 2 +- sysdeps/alpha/dl-machine.h | 2 +- sysdeps/alpha/start.S | 2 +- sysdeps/arc/dl-machine.h | 2 +- sysdeps/arc/start.S | 1 + sysdeps/arm/dl-machine.h | 2 +- sysdeps/arm/start.S | 2 +- sysdeps/csky/abiv2/start.S | 2 +- sysdeps/csky/dl-machine.h | 3 ++- sysdeps/hppa/dl-machine.h | 3 ++- sysdeps/hppa/start.S | 2 +- sysdeps/i386/dl-machine.h | 2 +- sysdeps/ia64/dl-machine.h | 2 +- sysdeps/ia64/start.S | 1 + sysdeps/loongarch/dl-machine.h | 2 +- sysdeps/loongarch/start.S | 1 + sysdeps/m68k/dl-machine.h | 2 +- sysdeps/mach/hurd/i386/static-start.S | 2 +- sysdeps/mach/hurd/x86_64/static-start.S | 2 +- sysdeps/microblaze/dl-machine.h | 2 +- sysdeps/microblaze/start.S | 2 +- sysdeps/mips/dl-machine.h | 4 ++-- sysdeps/mips/start.S | 2 +- sysdeps/nios2/dl-machine.h | 3 ++- sysdeps/nios2/start.S | 2 +- sysdeps/or1k/dl-start.S | 1 + sysdeps/or1k/start.S | 1 + sysdeps/powerpc/powerpc32/dl-start.S | 1 + sysdeps/powerpc/powerpc32/start.S | 2 +- sysdeps/powerpc/powerpc64/dl-machine.h | 2 +- sysdeps/powerpc/powerpc64/start.S | 2 +- sysdeps/riscv/dl-machine.h | 2 +- sysdeps/riscv/start.S | 1 + sysdeps/s390/s390-32/dl-machine.h | 3 ++- sysdeps/s390/s390-32/start.S | 2 +- sysdeps/s390/s390-64/dl-machine.h | 3 ++- sysdeps/s390/s390-64/start.S | 2 +- sysdeps/sh/dl-machine.h | 2 +- sysdeps/sh/start.S | 2 +- sysdeps/sparc/sparc32/dl-machine.h | 2 +- sysdeps/sparc/sparc32/start.S | 2 +- sysdeps/sparc/sparc64/dl-machine.h | 2 +- sysdeps/sparc/sparc64/start.S | 2 +- sysdeps/x86_64/dl-machine.h | 4 ++-- sysdeps/x86_64/start.S | 1 + sysdeps/x86_64/x32/dl-machine.h | 2 +- 47 files changed, 54 insertions(+), 40 deletions(-) diff --git a/sysdeps/aarch64/dl-start.S b/sysdeps/aarch64/dl-start.S index dd9c0725..1b7e7ca2 100644 --- a/sysdeps/aarch64/dl-start.S +++ b/sysdeps/aarch64/dl-start.S @@ -19,6 +19,7 @@ #include + .section .text.startup ENTRY (_start) /* Create an initial frame with 0 LR and FP */ cfi_undefined (x30) diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S index 9ec8e388..0f6f72ee 100644 --- a/sysdeps/aarch64/start.S +++ b/sysdeps/aarch64/start.S @@ -59,7 +59,7 @@ NULL */ - .text + .section .text.startup ENTRY(_start) /* Create an initial frame with 0 LR and FP */ cfi_undefined (x30) diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 5e748d2c..e003796c 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -135,7 +135,7 @@ elf_machine_runtime_setup (struct link_map *map, struct r_scope_elem *scope[], its return value is the user program's entry point. */ #define RTLD_START asm ("\ - .section .text \n\ + .section .text.startup \n\ .set at \n\ .globl _start \n\ .ent _start \n\ diff --git a/sysdeps/alpha/start.S b/sysdeps/alpha/start.S index 80d0ac36..8fef02db 100644 --- a/sysdeps/alpha/start.S +++ b/sysdeps/alpha/start.S @@ -35,7 +35,7 @@ #include - .text + .section .text.startup .align 3 .globl _start .ent _start, 0 diff --git a/sysdeps/arc/dl-machine.h b/sysdeps/arc/dl-machine.h index 4dc652a4..c640f81f 100644 --- a/sysdeps/arc/dl-machine.h +++ b/sysdeps/arc/dl-machine.h @@ -153,7 +153,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], -calls into app main with address of finaliser. */ #define RTLD_START asm ("\ -.text \n\ +.section .text.startup \n\ .globl __start \n\ .type __start, @function \n\ __start: \n\ diff --git a/sysdeps/arc/start.S b/sysdeps/arc/start.S index db3bab63..1af949be 100644 --- a/sysdeps/arc/start.S +++ b/sysdeps/arc/start.S @@ -50,6 +50,7 @@ env[0...N] environment variables (pointers) NULL. */ + .section .text.startup ENTRY (ENTRY_POINT) /* Needed to make gdb backtraces stop here. */ diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 3825ec56..9484c033 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -122,7 +122,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], its return value is the user program's entry point. */ #define RTLD_START asm ("\ -.text\n\ +.section .text.startup\n\ .globl _start\n\ .type _start, %function\n\ .globl _dl_start_user\n\ diff --git a/sysdeps/arm/start.S b/sysdeps/arm/start.S index f53f4581..c607712e 100644 --- a/sysdeps/arm/start.S +++ b/sysdeps/arm/start.S @@ -69,7 +69,7 @@ .syntax unified #endif - .text + .section .text.startup .globl _start .type _start,#function _start: diff --git a/sysdeps/csky/abiv2/start.S b/sysdeps/csky/abiv2/start.S index 1edbd0bb..b39cd09b 100644 --- a/sysdeps/csky/abiv2/start.S +++ b/sysdeps/csky/abiv2/start.S @@ -41,7 +41,7 @@ #include - .text + .section .text.startup .globl _start; .type _start,@function; .align 4; diff --git a/sysdeps/csky/dl-machine.h b/sysdeps/csky/dl-machine.h index 6bbe5427..10b8ff89 100644 --- a/sysdeps/csky/dl-machine.h +++ b/sysdeps/csky/dl-machine.h @@ -98,7 +98,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], The C function `_dl_start' is the real entry point; its return value is the user program's entry point. */ #define RTLD_START asm ("\ -.text\n\ +.section .text.startup\n\ .globl _start\n\ .type _start, @function\n\ .globl _dl_start_user\n\ @@ -135,6 +135,7 @@ _dl_start_user:\n\ lrw a0, _dl_fini@GOTOFF\n\ addu a0, gb\n\ jmp r10\n\ +.previous\n\ "); /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index 7af13bba..144f7b01 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -358,7 +358,7 @@ set_dp (struct link_map *map) \ } \ \ asm ( \ -" .text\n" \ +" .section .text.startup\n" \ " .globl _start\n" \ " .type _start,@function\n" \ "_start:\n" \ @@ -486,6 +486,7 @@ asm ( \ " ldw 4(%r3),%r19\n" /* load the object's gp */ \ " bv %r0(%r2)\n" \ " depi 2,31,2,%r23\n" /* delay slot */ \ +" .text\n" \ ); /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or diff --git a/sysdeps/hppa/start.S b/sysdeps/hppa/start.S index cfc22ab7..0d69f9c2 100644 --- a/sysdeps/hppa/start.S +++ b/sysdeps/hppa/start.S @@ -51,7 +51,7 @@ .Lp__libc_start_main: .word P%__libc_start_main - .text + .section .text.startup .align 4 .globl _start .export _start, ENTRY diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index d64494e7..c78c44f2 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -124,7 +124,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], its return value is the user program's entry point. */ #define RTLD_START asm ("\n\ - .text\n\ + .section .text.startup\n\ .align 16\n\ 0: movl (%esp), %ebx\n\ ret\n\ diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index e1da3dad..941a7e74 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -156,7 +156,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], its return value is the user program's entry point. */ #define RTLD_START asm ( \ -".text\n" \ +".section .text.startup\n" \ " .global _start#\n" \ " .proc _start#\n" \ "_start:\n" \ diff --git a/sysdeps/ia64/start.S b/sysdeps/ia64/start.S index e07304d3..50d0c1bd 100644 --- a/sysdeps/ia64/start.S +++ b/sysdeps/ia64/start.S @@ -47,6 +47,7 @@ * out6: stack_end */ + .section .text.startup .align 32 .global _start diff --git a/sysdeps/loongarch/dl-machine.h b/sysdeps/loongarch/dl-machine.h index 1e07d124..41423bf9 100644 --- a/sysdeps/loongarch/dl-machine.h +++ b/sysdeps/loongarch/dl-machine.h @@ -83,7 +83,7 @@ static inline ElfW (Addr) elf_machine_dynamic (void) its return value is the user program's entry point. */ #define RTLD_START asm (\ - ".text\n\ + ".section .text.startup\n\ " _RTLD_PROLOGUE (ENTRY_POINT) "\ .cfi_label .Ldummy \n\ " CFI_UNDEFINED (1) " \n\ diff --git a/sysdeps/loongarch/start.S b/sysdeps/loongarch/start.S index e9d82033..5b2baaaf 100644 --- a/sysdeps/loongarch/start.S +++ b/sysdeps/loongarch/start.S @@ -52,6 +52,7 @@ __libc_start_main (int (*main) (int, char **, char **), void *stack_end); */ + .section .text.startup ENTRY (ENTRY_POINT) /* Terminate call stack by noting ra is undefined. Use a dummy diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index 5ee586b2..2376895e 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -127,7 +127,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], its return value is the user program's entry point. */ #define RTLD_START asm ("\ - .text\n\ + .section .text.startup\n\ .globl _start\n\ .type _start,@function\n\ _start:\n\ diff --git a/sysdeps/mach/hurd/i386/static-start.S b/sysdeps/mach/hurd/i386/static-start.S index c5d12645..3b8f9418 100644 --- a/sysdeps/mach/hurd/i386/static-start.S +++ b/sysdeps/mach/hurd/i386/static-start.S @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see . */ - .text + .section .text.startup .globl _start _start: call _hurd_stack_setup diff --git a/sysdeps/mach/hurd/x86_64/static-start.S b/sysdeps/mach/hurd/x86_64/static-start.S index cc8e2410..1b461a83 100644 --- a/sysdeps/mach/hurd/x86_64/static-start.S +++ b/sysdeps/mach/hurd/x86_64/static-start.S @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see . */ - .text + .section .text.startup .globl _start _start: diff --git a/sysdeps/microblaze/dl-machine.h b/sysdeps/microblaze/dl-machine.h index da875b68..d6dec0c0 100644 --- a/sysdeps/microblaze/dl-machine.h +++ b/sysdeps/microblaze/dl-machine.h @@ -92,7 +92,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], its return value is the user program's entry point. */ #define RTLD_START asm ("\ - .text\n\ + .section .text.startup\n\ .globl _start\n\ .type _start,@function\n\ _start:\n\ diff --git a/sysdeps/microblaze/start.S b/sysdeps/microblaze/start.S index c35c4737..5f77e911 100644 --- a/sysdeps/microblaze/start.S +++ b/sysdeps/microblaze/start.S @@ -33,7 +33,7 @@ License along with the GNU C Library. If not, see . */ - .text + .section .text.startup .globl _start .type _start,@function _start: diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index a08e526a..73cccc1d 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -245,7 +245,7 @@ do { \ # define LOAD_31 "addiupc $31, 0" # endif # define RTLD_START asm (\ - ".text\n\ + ".section .text.startup\n\ " _RTLD_PROLOGUE(ENTRY_POINT) "\ " STRINGXV(SETUP_GPX($25)) "\n\ " STRINGXV(SETUP_GPX64($18,$25)) "\n\ @@ -310,7 +310,7 @@ do { \ are to be supported. */ # define RTLD_START asm (\ - ".text\n\ + ".section .text.startup\n\ .set mips16\n\ " _RTLD_PROLOGUE (ENTRY_POINT) "\ # Construct GP value in $3.\n\ diff --git a/sysdeps/mips/start.S b/sysdeps/mips/start.S index c08991c2..01ed88fa 100644 --- a/sysdeps/mips/start.S +++ b/sysdeps/mips/start.S @@ -71,7 +71,7 @@ void (*rtld_fini) (void), void *stack_end) */ - .text + .section .text.startup .globl ENTRY_POINT .type ENTRY_POINT,@function #ifndef __mips16 diff --git a/sysdeps/nios2/dl-machine.h b/sysdeps/nios2/dl-machine.h index 50c83df1..cc92de67 100644 --- a/sysdeps/nios2/dl-machine.h +++ b/sysdeps/nios2/dl-machine.h @@ -97,7 +97,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], its return value is the user program's entry point. */ #define RTLD_START asm ("\ -.text\n\ +.section .text.startup\n\ .globl _start\n\ .type _start, %function\n\ _start:\n\ @@ -155,6 +155,7 @@ _start:\n\ \n\ /* Jump to the user's entry point. */\n\ jmp r16\n\ +.previous\n\ "); /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so diff --git a/sysdeps/nios2/start.S b/sysdeps/nios2/start.S index 9179c330..33b2a128 100644 --- a/sysdeps/nios2/start.S +++ b/sysdeps/nios2/start.S @@ -65,7 +65,7 @@ value, terminated by an AT_NULL tag. */ - .text + .section .text.startup .globl _start .type _start,%function _start: diff --git a/sysdeps/or1k/dl-start.S b/sysdeps/or1k/dl-start.S index 6024568c..77409b57 100644 --- a/sysdeps/or1k/dl-start.S +++ b/sysdeps/or1k/dl-start.S @@ -21,6 +21,7 @@ /* Initial entry point code for the dynamic linker. The function _dl_start is the real entry point; it's return value is the user program's entry point. */ + .section .text.startup ENTRY (_start) /* Count arguments in r11 */ l.ori r3, r1, 0 diff --git a/sysdeps/or1k/start.S b/sysdeps/or1k/start.S index 92d39323..0573e712 100644 --- a/sysdeps/or1k/start.S +++ b/sysdeps/or1k/start.S @@ -50,6 +50,7 @@ #include #include + .section .text.startup ENTRY (ENTRY_POINT) /* Setup Arguments to the __libc_start_main function. */ diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S index d42e8ded..dd358fab 100644 --- a/sysdeps/powerpc/powerpc32/dl-start.S +++ b/sysdeps/powerpc/powerpc32/dl-start.S @@ -21,6 +21,7 @@ /* Initial entry point code for the dynamic linker. The C function `_dl_start' is the real entry point; its return value is the user program's entry point. */ + .section ".text.startup" ENTRY(_start) /* We start with the following on the stack, from top: argc (4 bytes); diff --git a/sysdeps/powerpc/powerpc32/start.S b/sysdeps/powerpc/powerpc32/start.S index 644f6f53..e944cfbe 100644 --- a/sysdeps/powerpc/powerpc32/start.S +++ b/sysdeps/powerpc/powerpc32/start.S @@ -56,7 +56,7 @@ L(start_addresses): .long 0 /* Used to be fini. */ ASM_SIZE_DIRECTIVE(L(start_addresses)) - .section ".text" + .section ".text.startup" ENTRY(_start) /* Save the stack pointer, in case we're statically linked under Linux. */ mr r9,r1 diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index a69ad0ed..36d53663 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -125,7 +125,7 @@ elf_machine_dynamic (void) `_dl_start' is the real entry point; its return value is the user program's entry point. */ #define RTLD_START \ - asm (".pushsection \".text\"\n" \ + asm (".pushsection \".text.startup\"\n" \ " .align 2\n" \ " " ENTRY_2(_start) "\n" \ BODY_PREFIX "_start:\n" \ diff --git a/sysdeps/powerpc/powerpc64/start.S b/sysdeps/powerpc/powerpc64/start.S index f86d400f..3dbbc8ac 100644 --- a/sysdeps/powerpc/powerpc64/start.S +++ b/sysdeps/powerpc/powerpc64/start.S @@ -61,7 +61,7 @@ L(start_addresses): .section ".toc","aw" .L01: .tc L(start_addresses)[TC],L(start_addresses) - .section ".text" + .section ".text.startup" ENTRY (_start) /* Save the stack pointer, in case we're statically linked under Linux. */ mr r9,r1 diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h index c0c9bd93..a5577e36 100644 --- a/sysdeps/riscv/dl-machine.h +++ b/sysdeps/riscv/dl-machine.h @@ -100,7 +100,7 @@ elf_machine_dynamic (void) its return value is the user program's entry point. */ #define RTLD_START asm (\ - ".text\n\ + ".section .text.startup\n\ " _RTLD_PROLOGUE (ENTRY_POINT) "\ mv a0, sp\n\ jal _dl_start\n\ diff --git a/sysdeps/riscv/start.S b/sysdeps/riscv/start.S index 6dfe6527..f90928e8 100644 --- a/sysdeps/riscv/start.S +++ b/sysdeps/riscv/start.S @@ -42,6 +42,7 @@ a0 contains the address of a function to be passed to atexit. __libc_start_main wants this in a5. */ + .section .text.startup ENTRY (ENTRY_POINT) /* Terminate call stack by noting ra is undefined. Use a dummy .cfi_label to force starting the FDE. */ diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index cf784ed8..288b2159 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -168,7 +168,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], its return value is the user program's entry point. */ #define RTLD_START __asm__ ("\n\ -.text\n\ +.section text.startup\n\ .align 4\n\ .globl _start\n\ .globl _dl_start_user\n\ @@ -215,6 +215,7 @@ _dl_start_user:\n\ .Ladr0: .long _GLOBAL_OFFSET_TABLE_-.Llit\n\ .Ladr1: .long _dl_start-.Llit\n\ .Ladr4: .long _dl_init@PLT-.Llit\n\ +.previous\n\ "); #ifndef RTLD_START_SPECIAL_INIT diff --git a/sysdeps/s390/s390-32/start.S b/sysdeps/s390/s390-32/start.S index eb84e7ff..fb3a4b3b 100644 --- a/sysdeps/s390/s390-32/start.S +++ b/sysdeps/s390/s390-32/start.S @@ -54,7 +54,7 @@ NULL */ - .text + .section .text.startup .globl _start .type _start,@function _start: diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index 6ab736c3..ea23c3bd 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -151,7 +151,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], its return value is the user program's entry point. */ #define RTLD_START __asm__ ("\n\ -.text\n\ +.section .text.startup\n\ .align 4\n\ .globl _start\n\ .globl _dl_start_user\n\ @@ -191,6 +191,7 @@ _dl_start_user:\n\ aghi %r15,160\n\ # Jump to the user's entry point (saved in %r8).\n\ br %r8\n\ +.previous\n\ "); #ifndef RTLD_START_SPECIAL_INIT diff --git a/sysdeps/s390/s390-64/start.S b/sysdeps/s390/s390-64/start.S index 61720c34..52b6b25f 100644 --- a/sysdeps/s390/s390-64/start.S +++ b/sysdeps/s390/s390-64/start.S @@ -54,7 +54,7 @@ NULL */ - .text + .section .text.startup .globl _start .type _start,@function _start: diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index f9492678..452dcd08 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -129,7 +129,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], its return value is the user program's entry point. */ #define RTLD_START asm ("\ -.text\n\ +.section .text.startup\n\ .globl _start\n\ .globl _dl_start_user\n\ _start:\n\ diff --git a/sysdeps/sh/start.S b/sysdeps/sh/start.S index 6578eb40..e9d3e269 100644 --- a/sysdeps/sh/start.S +++ b/sysdeps/sh/start.S @@ -57,7 +57,7 @@ NULL */ - .text + .section .text.startup .globl _start .type _start,@function _start: diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 9b57ae1a..7eb5a78d 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -176,7 +176,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], "ld [" #pic_reg " + " #reg "], " #reg ", %gdop(" #symbol ")" #define RTLD_START __asm__ ("\ - .text\n\ + .section .text.startup\n\ .globl _start\n\ .type _start, @function\n\ .align 32\n\ diff --git a/sysdeps/sparc/sparc32/start.S b/sysdeps/sparc/sparc32/start.S index a82cbf33..f3ac4c8a 100644 --- a/sysdeps/sparc/sparc32/start.S +++ b/sysdeps/sparc/sparc32/start.S @@ -36,7 +36,7 @@ #include - .section ".text" + .section ".text.startup" .align 4 .global _start .type _start,#function diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 2f04ac55..a08cc1f3 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -222,7 +222,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], #define __S(x) __S1(x) #define RTLD_START __asm__ ( "\n" \ -" .text\n" \ +" .section .text.startup\n" \ " .global _start\n" \ " .type _start, @function\n" \ " .align 32\n" \ diff --git a/sysdeps/sparc/sparc64/start.S b/sysdeps/sparc/sparc64/start.S index 158c4aa0..a69d1e06 100644 --- a/sysdeps/sparc/sparc64/start.S +++ b/sysdeps/sparc/sparc64/start.S @@ -36,7 +36,7 @@ #include - .section ".text" + .section ".text.startup" .align 4 .global _start .type _start,#function diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 34eb865e..4f85cae1 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -134,8 +134,8 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], The C function `_dl_start' is the real entry point; its return value is the user program's entry point. */ #define RTLD_START asm ("\n\ -.text\n\ - .align 16\n\ +.section .text.startup\n\ +.align 16\n\ .globl _start\n\ .globl _dl_start_user\n\ _start:\n\ diff --git a/sysdeps/x86_64/start.S b/sysdeps/x86_64/start.S index 4cedc721..4a6676e5 100644 --- a/sysdeps/x86_64/start.S +++ b/sysdeps/x86_64/start.S @@ -54,6 +54,7 @@ #include + .section .text.startup ENTRY (_start) /* Clearing frame pointer is insufficient, use CFI. */ cfi_undefined (rip) diff --git a/sysdeps/x86_64/x32/dl-machine.h b/sysdeps/x86_64/x32/dl-machine.h index 648a11f9..6f3164b1 100644 --- a/sysdeps/x86_64/x32/dl-machine.h +++ b/sysdeps/x86_64/x32/dl-machine.h @@ -35,7 +35,7 @@ The C function `_dl_start' is the real entry point; its return value is the user program's entry point. */ #define RTLD_START asm ("\n\ -.text\n\ +.section .text.startup\n\ .p2align 4\n\ .globl _start\n\ .globl _dl_start_user\n\ From patchwork Mon May 15 14:48:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 1781479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=slGIER7i; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QKj1N3KTFz20dc for ; Tue, 16 May 2023 00:48:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 777503853557 for ; Mon, 15 May 2023 14:48:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 777503853557 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684162134; bh=GgBFBZelbMxNp47Pbct8jWjDXqqNlXAfe1YaJ/9uRww=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=slGIER7iVKrgolEUEyPtzSFR7gkWyTj/CnRj0bFXvboXHBc5JiUHGxW+EzHsw22Ae 6RTd10y7C32DxZzkfGVkSxmJ66dgH/4boEbvAoF05GBjBlGdbdlFvtCif/bJapc8HR ePPV7kFxbOVjiWA+eVEKbCOFMHAQh0E1N+RgDKHs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id 8CF7A3856241 for ; Mon, 15 May 2023 14:48:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8CF7A3856241 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2ac79d4858dso134988561fa.2 for ; Mon, 15 May 2023 07:48:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684162103; x=1686754103; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GgBFBZelbMxNp47Pbct8jWjDXqqNlXAfe1YaJ/9uRww=; b=giwcgkQr2fmdc1xAyEUriZWGb9ks/e4+P4a2cXYmDgz2w2L5E+9SdzrEiQBvKzDb8W lLkN7gOZPuId6N5VP9GFyfLVt9wmBnSzsHKDJ6x27q8dWzJCbseyEh7Yzl3tDFtU0P6z S9Q6Ljhy26hWRfKAepHMr2SFKq/XnRclyDZywMCFShwMS7XDEjiltCK0sdtNmL9XMGqQ m1ajVYb/VOJC4Z9ye4Q2E6EMf0ReC3QQyZHYmblhWSJKK3o8xAKTbLQlsnM2XPq/L0mR YdwxE+sbAfjOKignnJy0dK2GFRKeduv2o0Mq/VGMALDwEaJmYapsVMI1X7d1L33dZ/UW 7hVA== X-Gm-Message-State: AC+VfDxXVccfEYrDsSX2Dgsp34xfOQH3z66RMRts2Qva7EKLqKVjfQ/9 VAMNTUoAyQ7BYSZJfrMiEsEYM1YNcLo= X-Google-Smtp-Source: ACHHUZ6ad9ZZb9OwTelWTjYhpyvKBrvJk5en5oDcF3qJ2M7VUnEtLDMvs5ja4SpqH9jxDjzoOuG0+g== X-Received: by 2002:a2e:8745:0:b0:2ad:90b2:62ff with SMTP id q5-20020a2e8745000000b002ad90b262ffmr7400587ljj.49.1684162102690; Mon, 15 May 2023 07:48:22 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id w9-20020a056512098900b004f11e965308sm2643336lft.20.2023.05.15.07.48.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:48:22 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [RFC PATCH 6/6] mach: In rtld, mark MIG routines as __TEXT_STARTUP Date: Mon, 15 May 2023 17:48:15 +0300 Message-Id: <20230515144815.3939017-7-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515144815.3939017-1-bugaevc@gmail.com> References: <20230515144815.3939017-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Sergey Bugaev via Libc-alpha From: Sergey Bugaev Reply-To: Sergey Bugaev Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Signed-off-by: Sergey Bugaev --- mach/Machrules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mach/Machrules b/mach/Machrules index d52f672d..22e6c94d 100644 --- a/mach/Machrules +++ b/mach/Machrules @@ -217,6 +217,10 @@ $(foreach o,$(object-suffixes),$(interfaces-routines:%=%$o)): $(some-if-rtn).d generated += $(some-if-rtn).d endif +# When building for rtld, we're only supposed to use the ld.so versions of +# the RPCs during startup, so put them all into .text.startup. +$(objpfx)rtld-RPC_%.os: rtld-CPPFLAGS += -Dmig_external=__TEXT_STARTUP + # If defined, $(interface-library) is `libNAME'. It is to be a library # containing all the MiG-generated functions for the specified interfaces.