From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 30CE73858C52; Wed, 17 Apr 2024 20:11:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30CE73858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713384683; bh=wPuuDJ8WM0NU/MT/wKi5wSaA6lRtO0HhdfcvoprJZzY=; h=From:To:Subject:Date:From; b=YYZ/ihgH9dDZEDSpxCyYk5uQuXoGTzjM+JbxxAAlkLshcfN65hACCzxKi+dtKjxQx Y9tvJvuDFUliuY4x1xwxs9hJrZ7RyILcjdlPGBXPlCmB/1FBCze9QkIm1v+SOl7oHj 3n3shpOdjIW/3bUoIOS9/98ngcdr1xBBEhJMPpj4= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] elf: Do not cast TLS_DTV_UNALLOCATED to void X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: e3dd9164a1fdab2ba9130b1a2d32338f052a281c X-Git-Newrev: d5eaf6b1068e06df0d6f7ece3c32f7c0b8cedf78 Message-Id: <20240417201123.30CE73858C52@sourceware.org> Date: Wed, 17 Apr 2024 20:11:23 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d5eaf6b1068e06df0d6f7ece3c32f7c0b8cedf78 commit d5eaf6b1068e06df0d6f7ece3c32f7c0b8cedf78 Author: Adhemerval Zanella Date: Fri Mar 25 15:46:10 2022 -0300 elf: Do not cast TLS_DTV_UNALLOCATED to void The test-as-const-tlsdesc uses _Static_assert to verify the constants generated and clang warns the expression is not an integral constant expression because the cast performs a conversion (and it is no allowed). Diff: --- elf/dl-tls.c | 2 ++ sysdeps/aarch64/tlsdesc.sym | 2 +- sysdeps/arc/dl-tls.h | 2 +- sysdeps/generic/dl-dtv.h | 2 +- sysdeps/loongarch/dl-tls.h | 3 --- sysdeps/riscv/dl-tls.h | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/elf/dl-tls.c b/elf/dl-tls.c index 7b3dd9ab60..020ec60957 100644 --- a/elf/dl-tls.c +++ b/elf/dl-tls.c @@ -75,6 +75,8 @@ /* Default for dl_tls_static_optional. */ #define OPTIONAL_TLS 512 +#define TLS_DTV_UNALLOCATED ((void *) TLS_DTV_UNALLOCATED_VALUE) + /* Compute the static TLS surplus based on the namespace count and the TLS space that can be used for optimizations. */ static inline int diff --git a/sysdeps/aarch64/tlsdesc.sym b/sysdeps/aarch64/tlsdesc.sym index a06a719779..477585bdcb 100644 --- a/sysdeps/aarch64/tlsdesc.sym +++ b/sysdeps/aarch64/tlsdesc.sym @@ -15,4 +15,4 @@ TLSDESC_MODID offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module) TLSDESC_MODOFF offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset) TCBHEAD_DTV offsetof(tcbhead_t, dtv) DTV_COUNTER offsetof(dtv_t, counter) -TLS_DTV_UNALLOCATED TLS_DTV_UNALLOCATED +TLS_DTV_UNALLOCATED TLS_DTV_UNALLOCATED_VALUE diff --git a/sysdeps/arc/dl-tls.h b/sysdeps/arc/dl-tls.h index e498fab8fe..70c26a68b3 100644 --- a/sysdeps/arc/dl-tls.h +++ b/sysdeps/arc/dl-tls.h @@ -27,4 +27,4 @@ typedef struct extern void *__tls_get_addr (tls_index *ti); /* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) +#define TLS_DTV_UNALLOCATED_VALE -1l diff --git a/sysdeps/generic/dl-dtv.h b/sysdeps/generic/dl-dtv.h index a1d8c0915d..f13b4d5c2f 100644 --- a/sysdeps/generic/dl-dtv.h +++ b/sysdeps/generic/dl-dtv.h @@ -33,6 +33,6 @@ typedef union dtv } dtv_t; /* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) +#define TLS_DTV_UNALLOCATED_VALUE -1l #endif /* _DLT_DTV_H */ diff --git a/sysdeps/loongarch/dl-tls.h b/sysdeps/loongarch/dl-tls.h index 29924b866d..d87a05b95e 100644 --- a/sysdeps/loongarch/dl-tls.h +++ b/sysdeps/loongarch/dl-tls.h @@ -41,6 +41,3 @@ extern void *__tls_get_addr (tls_index *ti); #define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET) #define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET) - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/riscv/dl-tls.h b/sysdeps/riscv/dl-tls.h index 049161f02f..c138c5ce70 100644 --- a/sysdeps/riscv/dl-tls.h +++ b/sysdeps/riscv/dl-tls.h @@ -45,4 +45,4 @@ extern void *__tls_get_addr (tls_index *ti); #define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET) /* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) +#define TLS_DTV_UNALLOCATED_VALUE -1l