From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dandelion.mymedia.su (dandelion.mymedia.su [107.191.98.137]) by sourceware.org (Postfix) with ESMTPS id 17EF7385734A for ; Mon, 2 May 2022 14:20:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 17EF7385734A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=guriev.su Authentication-Results: sourceware.org; spf=none smtp.mailfrom=dandelion.mymedia.su Received: by dandelion.mymedia.su (Postfix, from userid 1000) id C7447C00B3; Mon, 2 May 2022 17:20:38 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=guriev.su; s=bvj00itehu6icf4; t=1651501238; bh=Gxqtm4jHY8jKHGYaVIKd1yRHfLUi/r7F6JgtsJOvSVM=; h=Message-Id:In-Reply-To:References:From:Date:Subject:To:From; b=uZhW+fcW4wB6kJeYmLSlm4p8zxZUkMEJszjYaYopiTS/ORjZd9HccVKTaZi2WFby2 +p4ulAVV18jAz73LHdHIFsOBrqi//NLLUfxeKO0/+uWNb6J/Iavce4e6QRuO88Ywwf 7enpZiHL1ATM24aDS4dSZo/2OPsMqjGEIOANv5nvze/Aku0hxbO0wjTgOJYIVoTLQr xCVSC1Br19eT0cnYJfrnYidze1CO94g8oYI3z8fZDoS8EwrwfMaA/PIF1DENNVJDkX L6lysJ4cD6fdySpScF9+LJ8u+dAczNT8rgouEiUDLjPJZfyEO915KpWMQEvyGejJPf GsVQMFDOoS2vA== Message-Id: In-Reply-To: References: From: Nicholas Guriev Date: Mon, 2 May 2022 15:08:20 +0300 Subject: [RFC PATCH v1 1/1] draft: Make non-optimized build possible To: libc-help@sourceware.org X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 May 2022 14:20:40 -0000 Fix compilation errors found with the -O0 flag. Autotests do not work yet. Checked in GNU/Linux Ubuntu 21.10 with GCC 11.2.0. --- include/alloc_buffer.h | 76 ++++++++++++++++-------------- include/libc-symbols.h | 6 +-- include/rtld-malloc.h | 8 ++-- locale/programs/locfile.h | 2 +- nscd/nscd-client.h | 2 +- resolv/gai_misc.c | 2 +- rt/aio_misc.c | 2 +- sysdeps/nptl/gai_misc.h | 4 +- sysdeps/unix/sysv/linux/aio_misc.h | 4 +- 9 files changed, 56 insertions(+), 50 deletions(-) diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h index be33e8b68c..1d431d3ad4 100644 --- a/include/alloc_buffer.h +++ b/include/alloc_buffer.h @@ -202,44 +202,50 @@ alloc_buffer_alloc_bytes (struct alloc_buffer *buf, size_t length) /* Internal function. Statically assert that the type size is constant and valid. */ -static __always_inline size_t -__alloc_buffer_assert_size (size_t size) -{ - if (!__builtin_constant_p (size)) - { - __errordecl (error, "type size is not constant"); - error (); - } - else if (size == 0) - { - __errordecl (error, "type size is zero"); - error (); - } - return size; -} +//static __always_inline size_t +//__alloc_buffer_assert_size (size_t size) +//{ +// if (!__builtin_constant_p (size)) +// { +// __errordecl (error, "type size is not constant"); +// error (); +// } +// else if (size == 0) +// { +// __errordecl (error, "type size is zero"); +// error (); +// } +// return size; +//} + +#define __alloc_buffer_assert_size(val) \ + ({ _Static_assert (val > 0, "positive size"); val; }) /* Internal function. Statically assert that the type alignment is constant and valid. */ -static __always_inline size_t -__alloc_buffer_assert_align (size_t align) -{ - if (!__builtin_constant_p (align)) - { - __errordecl (error, "type alignment is not constant"); - error (); - } - else if (align == 0) - { - __errordecl (error, "type alignment is zero"); - error (); - } - else if (!powerof2 (align)) - { - __errordecl (error, "type alignment is not a power of two"); - error (); - } - return align; -} +//static __always_inline size_t +//__alloc_buffer_assert_align (size_t align) +//{ +// if (!__builtin_constant_p (align)) +// { +// __errordecl (error, "type alignment is not constant"); +// error (); +// } +// else if (align == 0) +// { +// __errordecl (error, "type alignment is zero"); +// error (); +// } +// else if (!powerof2 (align)) +// { +// __errordecl (error, "type alignment is not a power of two"); +// error (); +// } +// return align; +//} + +#define __alloc_buffer_assert_align(val) \ + ({ _Static_assert (val > 0 && powerof2 (val), "type alignment"); val; }) /* Internal function. Obtain a pointer to an object. */ static inline __attribute__ ((nonnull (1))) void * diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 662bd118b1..e5651802a6 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -71,9 +71,9 @@ #define _LIBC 1 /* Some files must be compiled with optimization on. */ -#if !defined __ASSEMBLER__ && !defined __OPTIMIZE__ -# error "glibc cannot be compiled without optimization" -#endif +//#if !defined __ASSEMBLER__ && !defined __OPTIMIZE__ +//# error "glibc cannot be compiled without optimization" +//#endif /* -ffast-math cannot be applied to the C library, as it alters the ABI. Some test components that use -ffast-math are currently not part of diff --git a/include/rtld-malloc.h b/include/rtld-malloc.h index ed70c87f40..0d7d7e7a07 100644 --- a/include/rtld-malloc.h +++ b/include/rtld-malloc.h @@ -38,25 +38,25 @@ extern __typeof (realloc) *__rtld_realloc attribute_hidden; functions. Instead the function pointers must be used directly. */ -__extern_inline void * +__extern_always_inline void * calloc (size_t a, size_t b) { return __rtld_calloc (a, b); } -__extern_inline void +__extern_always_inline void free (void *ptr) { __rtld_free (ptr); } -__extern_inline void * +__extern_always_inline void * malloc (size_t size) { return __rtld_malloc (size); } -__extern_inline void * +__extern_always_inline void * realloc (void *ptr, size_t size) { return __rtld_realloc (ptr, size); diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h index 57b2211e2f..894df6bbde 100644 --- a/locale/programs/locfile.h +++ b/locale/programs/locfile.h @@ -80,7 +80,7 @@ set_big_endian (bool big_endian) /* Munge VALUE so that, when stored, it has the correct byte order for the output files. */ -static uint32_t +static inline uint32_t __attribute__ ((unused)) maybe_swap_uint32 (uint32_t value) { diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h index fee2a15dcc..eaa8d7abc5 100644 --- a/nscd/nscd-client.h +++ b/nscd/nscd-client.h @@ -407,7 +407,7 @@ extern void __nscd_unmap (struct mapped_database *mapped) attribute_hidden; /* Drop reference of mapping. */ -static int +static inline int __attribute__ ((unused)) __nscd_drop_map_ref (struct mapped_database *map, int *gc_cycle) { diff --git a/resolv/gai_misc.c b/resolv/gai_misc.c index 8ce3c778eb..2102e1797d 100644 --- a/resolv/gai_misc.c +++ b/resolv/gai_misc.c @@ -37,7 +37,7 @@ #ifndef gai_create_helper_thread # define gai_create_helper_thread __gai_create_helper_thread -extern inline int +extern __always_inline int __gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg) { diff --git a/rt/aio_misc.c b/rt/aio_misc.c index b4304d0a6f..dc18618473 100644 --- a/rt/aio_misc.c +++ b/rt/aio_misc.c @@ -45,7 +45,7 @@ #ifndef aio_create_helper_thread # define aio_create_helper_thread __aio_create_helper_thread -extern inline int +extern __always__inline int __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg) { pthread_attr_t attr; diff --git a/sysdeps/nptl/gai_misc.h b/sysdeps/nptl/gai_misc.h index c09350c2ed..49beefed1c 100644 --- a/sysdeps/nptl/gai_misc.h +++ b/sysdeps/nptl/gai_misc.h @@ -76,7 +76,7 @@ #define gai_start_notify_thread __gai_start_notify_thread #define gai_create_helper_thread __gai_create_helper_thread -extern inline void +extern __always_inline void __gai_start_notify_thread (void) { sigset_t ss; @@ -86,7 +86,7 @@ __gai_start_notify_thread (void) assert_perror (sigerr); } -extern inline int +extern __always_inline int __gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg) { diff --git a/sysdeps/unix/sysv/linux/aio_misc.h b/sysdeps/unix/sysv/linux/aio_misc.h index 100334ad45..aa753fbd23 100644 --- a/sysdeps/unix/sysv/linux/aio_misc.h +++ b/sysdeps/unix/sysv/linux/aio_misc.h @@ -25,7 +25,7 @@ # define aio_start_notify_thread __aio_start_notify_thread # define aio_create_helper_thread __aio_create_helper_thread -extern inline void +extern __always_inline void __aio_start_notify_thread (void) { sigset_t ss; @@ -34,7 +34,7 @@ __aio_start_notify_thread (void) __NSIG_BYTES); } -extern inline int +extern __always_inline int __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg) { -- 2.32.0