git: 5d8176337e69 - main - libthr: Remove the DTV_OFFSET macro.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 09 Dec 2021 21:23:37 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=5d8176337e691d3ca3fa7d519bc3eaacf6d9faee
commit 5d8176337e691d3ca3fa7d519bc3eaacf6d9faee
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-12-09 21:15:38 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-12-09 21:15:38 +0000
libthr: Remove the DTV_OFFSET macro.
This macro is confusing as it is not related to the similarly named
TLS_DTV_OFFSET. Instead, replace its one use with the desired
expression which is the same on all platforms.
Reviewed by: kib, emaste, jrtc27
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33345
---
lib/libthr/arch/aarch64/include/pthread_md.h | 2 --
lib/libthr/arch/amd64/include/pthread_md.h | 2 --
lib/libthr/arch/arm/include/pthread_md.h | 2 --
lib/libthr/arch/i386/include/pthread_md.h | 2 --
lib/libthr/arch/mips/include/pthread_md.h | 2 --
lib/libthr/arch/powerpc/include/pthread_md.h | 2 --
lib/libthr/arch/riscv/include/pthread_md.h | 2 --
lib/libthr/thread/thr_symbols.c | 2 +-
8 files changed, 1 insertion(+), 15 deletions(-)
diff --git a/lib/libthr/arch/aarch64/include/pthread_md.h b/lib/libthr/arch/aarch64/include/pthread_md.h
index d14bce244f8f..3209a2cbe7e2 100644
--- a/lib/libthr/arch/aarch64/include/pthread_md.h
+++ b/lib/libthr/arch/aarch64/include/pthread_md.h
@@ -38,10 +38,8 @@
#include <sys/types.h>
#include <machine/sysarch.h>
-#include <stddef.h>
#define CPU_SPINWAIT
-#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
/*
* Variant I tcb. The structure layout is fixed, don't blindly
diff --git a/lib/libthr/arch/amd64/include/pthread_md.h b/lib/libthr/arch/amd64/include/pthread_md.h
index 1d393d9cbbed..b3367e85ee65 100644
--- a/lib/libthr/arch/amd64/include/pthread_md.h
+++ b/lib/libthr/arch/amd64/include/pthread_md.h
@@ -41,8 +41,6 @@
#define CPU_SPINWAIT __asm __volatile("pause")
-#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
-
/*
* Variant II tcb, first two members are required by rtld,
* %fs points to the structure.
diff --git a/lib/libthr/arch/arm/include/pthread_md.h b/lib/libthr/arch/arm/include/pthread_md.h
index 6f99eb7a139b..837b38e70ac5 100644
--- a/lib/libthr/arch/arm/include/pthread_md.h
+++ b/lib/libthr/arch/arm/include/pthread_md.h
@@ -36,10 +36,8 @@
#include <sys/types.h>
#include <machine/sysarch.h>
-#include <stddef.h>
#define CPU_SPINWAIT
-#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
/*
* Variant I tcb. The structure layout is fixed, don't blindly
diff --git a/lib/libthr/arch/i386/include/pthread_md.h b/lib/libthr/arch/i386/include/pthread_md.h
index 7de8aa56203e..48374480d207 100644
--- a/lib/libthr/arch/i386/include/pthread_md.h
+++ b/lib/libthr/arch/i386/include/pthread_md.h
@@ -41,8 +41,6 @@
#define CPU_SPINWAIT __asm __volatile("pause")
-#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
-
/*
* Variant II tcb, first two members are required by rtld,
* %gs points to the structure.
diff --git a/lib/libthr/arch/mips/include/pthread_md.h b/lib/libthr/arch/mips/include/pthread_md.h
index 20b0e7065595..2a29e6717abe 100644
--- a/lib/libthr/arch/mips/include/pthread_md.h
+++ b/lib/libthr/arch/mips/include/pthread_md.h
@@ -38,10 +38,8 @@
#include <sys/types.h>
#include <machine/sysarch.h>
#include <machine/tls.h>
-#include <stddef.h>
#define CPU_SPINWAIT
-#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
/*
* Variant I tcb. The structure layout is fixed, don't blindly
diff --git a/lib/libthr/arch/powerpc/include/pthread_md.h b/lib/libthr/arch/powerpc/include/pthread_md.h
index 0ed44058a7a7..3fcf8c3245da 100644
--- a/lib/libthr/arch/powerpc/include/pthread_md.h
+++ b/lib/libthr/arch/powerpc/include/pthread_md.h
@@ -35,12 +35,10 @@
#ifndef _PTHREAD_MD_H_
#define _PTHREAD_MD_H_
-#include <stddef.h>
#include <sys/types.h>
#define CPU_SPINWAIT
-#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
#ifdef __powerpc64__
#define TP_OFFSET 0x7010
#else
diff --git a/lib/libthr/arch/riscv/include/pthread_md.h b/lib/libthr/arch/riscv/include/pthread_md.h
index 55d9b7260fd2..1cdc8a12be95 100644
--- a/lib/libthr/arch/riscv/include/pthread_md.h
+++ b/lib/libthr/arch/riscv/include/pthread_md.h
@@ -42,10 +42,8 @@
#define _PTHREAD_MD_H_
#include <sys/types.h>
-#include <stddef.h>
#define CPU_SPINWAIT
-#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
#define TP_OFFSET sizeof(struct tcb)
/*
diff --git a/lib/libthr/thread/thr_symbols.c b/lib/libthr/thread/thr_symbols.c
index cee263c56826..71737392c62f 100644
--- a/lib/libthr/thread/thr_symbols.c
+++ b/lib/libthr/thread/thr_symbols.c
@@ -55,7 +55,7 @@ int _thread_size_key = sizeof(struct pthread_key);
int _thread_off_key_allocated = offsetof(struct pthread_key, allocated);
int _thread_off_key_destructor = offsetof(struct pthread_key, destructor);
int _thread_max_keys = PTHREAD_KEYS_MAX;
-int _thread_off_dtv = DTV_OFFSET;
+int _thread_off_dtv = offsetof(struct tcb, tcb_dtv);
int _thread_off_state = offsetof(struct pthread, state);
int _thread_state_running = PS_RUNNING;
int _thread_state_zoombie = PS_DEAD;