diff mbox series

[1/3] linux-user: Remove unnecessary 'aligned' attribute from TaskState

Message ID 20220114153732.3767229-2-peter.maydell@linaro.org
State Accepted
Headers show
Series linux-user: Fix some minor nits | expand

Commit Message

Peter Maydell Jan. 14, 2022, 3:37 p.m. UTC
The linux-user struct TaskState has an 'aligned(16)' attribute.  When
the struct was first added in commit 851e67a1b46f in 2003, there was
a justification in a comment (still present in the source today):

/* NOTE: we force a big alignment so that the stack stored after is
   aligned too */

because the final field in the struct was "uint8_t stack[0];"
But that field was removed in commit 48e15fc2d in 2010 which
switched us to allocating the stack and the TaskState separately.
Because we allocate the structure with g_new0() rather than as
a local variable, the attribute made no difference to the alignment
of the structure anyway.

Remove the unnecessary attribute, and the corresponding comment.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/qemu.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Laurent Vivier Jan. 27, 2022, 1:20 p.m. UTC | #1
Le 14/01/2022 à 16:37, Peter Maydell a écrit :
> The linux-user struct TaskState has an 'aligned(16)' attribute.  When
> the struct was first added in commit 851e67a1b46f in 2003, there was
> a justification in a comment (still present in the source today):
> 
> /* NOTE: we force a big alignment so that the stack stored after is
>     aligned too */
> 
> because the final field in the struct was "uint8_t stack[0];"
> But that field was removed in commit 48e15fc2d in 2010 which
> switched us to allocating the stack and the TaskState separately.
> Because we allocate the structure with g_new0() rather than as
> a local variable, the attribute made no difference to the alignment
> of the structure anyway.
> 
> Remove the unnecessary attribute, and the corresponding comment.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   linux-user/qemu.h | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/linux-user/qemu.h b/linux-user/qemu.h
> index 5c713fa8ab2..bd0559759ae 100644
> --- a/linux-user/qemu.h
> +++ b/linux-user/qemu.h
> @@ -96,10 +96,6 @@ struct emulated_sigtable {
>       target_siginfo_t info;
>   };
>   
> -/*
> - * NOTE: we force a big alignment so that the stack stored after is
> - * aligned too
> - */
>   typedef struct TaskState {
>       pid_t ts_tid;     /* tid (or pid) of this task */
>   #ifdef TARGET_ARM
> @@ -160,7 +156,7 @@ typedef struct TaskState {
>   
>       /* This thread's sigaltstack, if it has one */
>       struct target_sigaltstack sigaltstack_used;
> -} __attribute__((aligned(16))) TaskState;
> +} TaskState;
>   
>   abi_long do_brk(abi_ulong new_brk);
>   

Applied to my linux-user-for-7.0 branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 5c713fa8ab2..bd0559759ae 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -96,10 +96,6 @@  struct emulated_sigtable {
     target_siginfo_t info;
 };
 
-/*
- * NOTE: we force a big alignment so that the stack stored after is
- * aligned too
- */
 typedef struct TaskState {
     pid_t ts_tid;     /* tid (or pid) of this task */
 #ifdef TARGET_ARM
@@ -160,7 +156,7 @@  typedef struct TaskState {
 
     /* This thread's sigaltstack, if it has one */
     struct target_sigaltstack sigaltstack_used;
-} __attribute__((aligned(16))) TaskState;
+} TaskState;
 
 abi_long do_brk(abi_ulong new_brk);