NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PR/54093 CVS commit: src



>>> "Joerg Sonnenberger" <joerg%netbsd.org@localhost> wrote

> The following reply was made to PR port-sparc/54093; it has been noted by GNATS.
> 
> From: "Joerg Sonnenberger" <joerg%netbsd.org@localhost>
> To: gnats-bugs%gnats.NetBSD.org@localhost
> Cc: 
> Subject: PR/54093 CVS commit: src
> Date: Mon, 4 Nov 2019 12:45:10 +0000
> 
>  Module Name:	src
>  Committed By:	joerg
>  Date:		Mon Nov  4 12:45:10 UTC 2019
>  
>  Modified Files:
>  	src/lib/libc/tls: Makefile.inc tls.c
>  	src/libexec/ld.elf_so: Makefile tls.c
>  	src/usr.bin/ldd: Makefile.elf
>  
>  Log Message:
>  PR 54093: Align static TLS area to max_align_t.

I think static TLS area should align with p_align in elf program
header, not with sizeof(max_align_t).

sizeof(max_align_t) is 12 on i386, it is not valid on roundup2.
This seems to cause some atf tests to fail.

http://releng.netbsd.org/b5reports/i386/commits-2019.11.html#2019.11.04.15.12.10
	usr.bin/c++/t_static_destructor/static_destructor_static
	lib/csu/t_crt0/initfini2
	usr.bin/c++/t_cxxruntime/cxxruntime_static

In addition, when the alignment of 16 bytes or more is required as
in the attached test program, strange results occur.  Especially
when statically linking, variable initialization fails.

So please revert this change and apply the patch I proposed in this PR?

-- Takeshi Nakayama


#include <stdio.h>
#include <lwp.h>
#include <inttypes.h>

__thread uint32_t a __aligned(32) = 32;
__thread uint64_t b __aligned(16) = 16;

int main(int argc, char *argv[])
{
	printf("_lwp_getprivate() = %p\n", _lwp_getprivate());
	printf("&a = %p, a = %"PRIu32", misalign = %"PRIuPTR"\n",
	    &a, a, (uintptr_t)&a & (a-1));
	printf("&b = %p, b = %"PRIu64", misalign = %"PRIu64"\n",
	    &b, b, (uintptr_t)&b & (b-1));
}


Home | Main Index | Thread Index | Old Index