From patchwork Fri Oct 28 17:35:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 59598 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A7820381E5E5 for ; Fri, 28 Oct 2022 17:38:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7820381E5E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666978701; bh=fOgwmZRKuABNCgz2MbGPpTsskDZKnN6uPiVpbfetxLY=; 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=W+DLXwoFeGyv41ClrSX6uZCLFr4qqKVjE6PLjdwfOPfBM/msA7VhMtzhBrhg8jdys OH6Fm/XtmIgJ6sgSb5IOx8lW4TS8ecgrQLKN8Y99gG+iadbFxRbCBERqyraZngXVmY /C8kcxP1PGZ9qTq4kRsSm8vgrVHtMMCgMti+m1mw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) by sourceware.org (Postfix) with ESMTPS id 4DD7E3857C40 for ; Fri, 28 Oct 2022 17:35:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4DD7E3857C40 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-13be3ef361dso7009216fac.12 for ; Fri, 28 Oct 2022 10:35:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=fOgwmZRKuABNCgz2MbGPpTsskDZKnN6uPiVpbfetxLY=; b=UfMZ1pqOSBcjMhcAozoEQYraQh9hWq9j5VZIY3JWnI/dvWN00WGlzxW1dJarfy0UHf hx8eGTKA5AezXxazE/58hdn9coSO7Is7vWXkuhiFWDZC2H14BhHpmOsgIc0OUqvjBItl SqRvZSDEFcv9+ZAMpF423UkYnJeRIeJBIIB7pef1BNo4wDDsr9yohS0S0Yy0GGe+bXtX 62t8xGDpyoe/TcjV6sp/cvDQ46TfWGEtrXRL0uP2tkdl/COEqMlc6AZAeZnmYERcEh7g UgpqqqRcGVQPZufcnFwv6E1BE+c/cW5aC1gjVSwOjlzDiCIXmyhWFrXew4Hjtcfws95r 8ryg== X-Gm-Message-State: ACrzQf3ovUhzuld4BxV3rqmk29P5IpSY5EJn808A6wvGQ6HOgRSw975L O/6tBhxbEZGKHeKzfrqJNB2pm9DmSt3UB4Yr X-Google-Smtp-Source: AMsMyM6PvJQwD+wjbtXsciWRBRp87yYbptfKsSkSIFRAqAgYBJHyVBybUmdqGy4LUTCXP6M95ThbEA== X-Received: by 2002:a05:6871:79f:b0:13c:265b:75d2 with SMTP id o31-20020a056871079f00b0013c265b75d2mr8353932oap.175.1666978551837; Fri, 28 Oct 2022 10:35:51 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:17c8:6484:1100:1451:7f3f]) by smtp.gmail.com with ESMTPSA id v10-20020a056870b50a00b0012779ba00fesm2434998oap.2.2022.10.28.10.35.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 10:35:51 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 09/11] alloc_buffer: Apply asm redirection before first use Date: Fri, 28 Oct 2022 14:35:30 -0300 Message-Id: <20221028173532.876027-10-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221028173532.876027-1-adhemerval.zanella@linaro.org> References: <20221028173532.876027-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Compilers may not be able to apply asm redirections to functions after these functions are used for the first time, e.g. clang 13. Reviewed-by: Fangrui Song --- include/alloc_buffer.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h index 1c1dbe0a46..553de607e8 100644 --- a/include/alloc_buffer.h +++ b/include/alloc_buffer.h @@ -114,6 +114,9 @@ enum /* Internal function. Terminate the process using __libc_fatal. */ void __libc_alloc_buffer_create_failure (void *start, size_t size); +#ifndef _ISOMAC +libc_hidden_proto (__libc_alloc_buffer_create_failure) +#endif /* Create a new allocation buffer. The byte range from START to START + SIZE - 1 must be valid, and the allocation buffer allocates @@ -132,6 +135,9 @@ alloc_buffer_create (void *start, size_t size) /* Internal function. See alloc_buffer_allocate below. */ struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr) __attribute__ ((nonnull (2))); +#ifndef _ISOMAC +libc_hidden_proto (__libc_alloc_buffer_allocate) +#endif /* Allocate a buffer of SIZE bytes using malloc. The returned buffer is in a failed state if malloc fails. *PPTR points to the start of @@ -333,6 +339,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf, size_t size, size_t align, size_t count) __attribute__ ((nonnull (1))); +#ifndef _ISOMAC +libc_hidden_proto (__libc_alloc_buffer_alloc_array) +#endif /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of TYPE. Consume these bytes from the buffer. Return NULL and mark @@ -349,6 +358,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf, struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer, const void *, size_t) __attribute__ ((nonnull (2))); +#ifndef _ISOMAC +libc_hidden_proto (__libc_alloc_buffer_copy_bytes) +#endif /* Copy SIZE bytes starting at SRC into the buffer. If there is not enough room in the buffer, the buffer is marked as failed. No @@ -363,6 +375,9 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size) struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer, const char *) __attribute__ ((nonnull (2))); +#ifndef _ISOMAC +libc_hidden_proto (__libc_alloc_buffer_copy_string) +#endif /* Copy the string at SRC into the buffer, including its null terminator. If there is not enough room in the buffer, the buffer @@ -377,12 +392,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src) return result; } -#ifndef _ISOMAC -libc_hidden_proto (__libc_alloc_buffer_alloc_array) -libc_hidden_proto (__libc_alloc_buffer_allocate) -libc_hidden_proto (__libc_alloc_buffer_copy_bytes) -libc_hidden_proto (__libc_alloc_buffer_copy_string) -libc_hidden_proto (__libc_alloc_buffer_create_failure) -#endif - #endif /* _ALLOC_BUFFER_H */