head 1.3; access; symbols netbsd-11-0-RC4:1.3 netbsd-11-0-RC3:1.3 netbsd-11-0-RC2:1.3 netbsd-11-0-RC1:1.3 perseant-exfatfs-base-20250801:1.3 netbsd-11:1.3.0.12 netbsd-11-base:1.3 netbsd-10-1-RELEASE:1.3 perseant-exfatfs-base-20240630:1.3 perseant-exfatfs:1.3.0.10 perseant-exfatfs-base:1.3 netbsd-8-3-RELEASE:1.2 netbsd-9-4-RELEASE:1.2.46.1 netbsd-10-0-RELEASE:1.3 netbsd-10-0-RC6:1.3 netbsd-10-0-RC5:1.3 netbsd-10-0-RC4:1.3 netbsd-10-0-RC3:1.3 netbsd-10-0-RC2:1.3 netbsd-10-0-RC1:1.3 netbsd-10:1.3.0.8 netbsd-10-base:1.3 netbsd-9-3-RELEASE:1.2.46.1 cjep_sun2x-base1:1.3 cjep_sun2x:1.3.0.6 cjep_sun2x-base:1.3 cjep_staticlib_x-base1:1.3 netbsd-9-2-RELEASE:1.2.46.1 cjep_staticlib_x:1.3.0.4 cjep_staticlib_x-base:1.3 netbsd-9-1-RELEASE:1.2.46.1 phil-wifi-20200421:1.3 phil-wifi-20200411:1.3 is-mlppp:1.3.0.2 is-mlppp-base:1.3 phil-wifi-20200406:1.3 netbsd-8-2-RELEASE:1.2 netbsd-9-0-RELEASE:1.2.46.1 netbsd-9-0-RC2:1.2.46.1 netbsd-9-0-RC1:1.2.46.1 phil-wifi-20191119:1.3 netbsd-9:1.2.0.46 netbsd-9-base:1.2 phil-wifi-20190609:1.2 netbsd-8-1-RELEASE:1.2 netbsd-8-1-RC1:1.2 pgoyette-compat-merge-20190127:1.2 pgoyette-compat-20190127:1.2 pgoyette-compat-20190118:1.2 pgoyette-compat-1226:1.2 pgoyette-compat-1126:1.2 pgoyette-compat-1020:1.2 pgoyette-compat-0930:1.2 pgoyette-compat-0906:1.2 netbsd-7-2-RELEASE:1.2 pgoyette-compat-0728:1.2 netbsd-8-0-RELEASE:1.2 phil-wifi:1.2.0.44 phil-wifi-base:1.2 pgoyette-compat-0625:1.2 netbsd-8-0-RC2:1.2 pgoyette-compat-0521:1.2 pgoyette-compat-0502:1.2 pgoyette-compat-0422:1.2 netbsd-8-0-RC1:1.2 pgoyette-compat-0415:1.2 pgoyette-compat-0407:1.2 pgoyette-compat-0330:1.2 pgoyette-compat-0322:1.2 pgoyette-compat-0315:1.2 netbsd-7-1-2-RELEASE:1.2 pgoyette-compat:1.2.0.42 pgoyette-compat-base:1.2 netbsd-7-1-1-RELEASE:1.2 matt-nb8-mediatek:1.2.0.40 matt-nb8-mediatek-base:1.2 perseant-stdc-iso10646:1.2.0.38 perseant-stdc-iso10646-base:1.2 netbsd-8:1.2.0.36 netbsd-8-base:1.2 prg-localcount2-base3:1.2 prg-localcount2-base2:1.2 prg-localcount2-base1:1.2 prg-localcount2:1.2.0.34 prg-localcount2-base:1.2 pgoyette-localcount-20170426:1.2 bouyer-socketcan-base1:1.2 pgoyette-localcount-20170320:1.2 netbsd-7-1:1.2.0.32 netbsd-7-1-RELEASE:1.2 netbsd-7-1-RC2:1.2 netbsd-7-nhusb-base-20170116:1.2 bouyer-socketcan:1.2.0.30 bouyer-socketcan-base:1.2 pgoyette-localcount-20170107:1.2 netbsd-7-1-RC1:1.2 pgoyette-localcount-20161104:1.2 netbsd-7-0-2-RELEASE:1.2 localcount-20160914:1.2 netbsd-7-nhusb:1.2.0.28 netbsd-7-nhusb-base:1.2 pgoyette-localcount-20160806:1.2 pgoyette-localcount-20160726:1.2 pgoyette-localcount:1.2.0.26 pgoyette-localcount-base:1.2 netbsd-7-0-1-RELEASE:1.2 netbsd-7-0:1.2.0.24 netbsd-7-0-RELEASE:1.2 netbsd-7-0-RC3:1.2 netbsd-7-0-RC2:1.2 netbsd-7-0-RC1:1.2 netbsd-6-0-6-RELEASE:1.2 netbsd-6-1-5-RELEASE:1.2 netbsd-7:1.2.0.22 netbsd-7-base:1.2 yamt-pagecache-base9:1.2 yamt-pagecache-tag8:1.2 netbsd-6-1-4-RELEASE:1.2 netbsd-6-0-5-RELEASE:1.2 tls-earlyentropy:1.2.0.20 tls-earlyentropy-base:1.2 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.2 riastradh-drm2-base3:1.2 netbsd-6-1-3-RELEASE:1.2 netbsd-6-0-4-RELEASE:1.2 netbsd-6-1-2-RELEASE:1.2 netbsd-6-0-3-RELEASE:1.2 netbsd-6-1-1-RELEASE:1.2 riastradh-drm2-base2:1.2 riastradh-drm2-base1:1.2 riastradh-drm2:1.2.0.14 riastradh-drm2-base:1.2 netbsd-6-1:1.2.0.18 netbsd-6-0-2-RELEASE:1.2 netbsd-6-1-RELEASE:1.2 netbsd-6-1-RC4:1.2 netbsd-6-1-RC3:1.2 agc-symver:1.2.0.16 agc-symver-base:1.2 netbsd-6-1-RC2:1.2 netbsd-6-1-RC1:1.2 yamt-pagecache-base8:1.2 netbsd-6-0-1-RELEASE:1.2 yamt-pagecache-base7:1.2 matt-nb6-plus-nbase:1.2 yamt-pagecache-base6:1.2 netbsd-6-0:1.2.0.12 netbsd-6-0-RELEASE:1.2 netbsd-6-0-RC2:1.2 tls-maxphys:1.2.0.10 tls-maxphys-base:1.2 matt-nb6-plus:1.2.0.8 matt-nb6-plus-base:1.2 netbsd-6-0-RC1:1.2 yamt-pagecache-base5:1.2 yamt-pagecache-base4:1.2 netbsd-6:1.2.0.6 netbsd-6-base:1.2 yamt-pagecache-base3:1.2 yamt-pagecache-base2:1.2 yamt-pagecache:1.2.0.4 yamt-pagecache-base:1.2 cherry-xenmp:1.2.0.2 cherry-xenmp-base:1.2; locks; strict; comment @# @; 1.3 date 2019.11.04.12.45.10; author joerg; state Exp; branches; next 1.2; commitid yqqU04fov4ei5xJB; 1.2 date 2011.03.12.07.55.09; author matt; state Exp; branches 1.2.44.1 1.2.46.1; next 1.1; 1.1 date 2011.03.09.23.10.06; author joerg; state Exp; branches; next ; 1.2.44.1 date 2020.04.13.08.03.11; author martin; state Exp; branches; next ; commitid X01YhRUPVUDaec4C; 1.2.46.1 date 2019.11.26.08.12.26; author martin; state Exp; branches; next ; commitid znLAIDlYvCqlSkMB; desc @@ 1.3 log @PR 54093: Align static TLS area to max_align_t. @ text @# $NetBSD: Makefile.inc,v 1.2 2011/03/12 07:55:09 matt Exp $ .include # Our sources .PATH: ${.PARSEDIR} ${ARCHDIR}/tls SRCS+= tls.c CPPFLAGS.tls.c+= -D_LIBC_SOURCE -std=gnu11 @ 1.2 log @Add PPC TLS support. Add -D_LIBC_SOURCE for tls.c and _lwp.c (powerpc) so that __lwp_gettcb_fast and __lwp_settcb inlines are define. @ text @d1 1 a1 1 # $NetBSD: Makefile.inc,v 1.1 2011/03/09 23:10:06 joerg Exp $ d9 1 a9 1 CPPFLAGS.tls.c+= -D_LIBC_SOURCE @ 1.2.44.1 log @Mostly merge changes from HEAD upto 20200411 @ text @d1 1 a1 1 # $NetBSD$ d9 1 a9 1 CPPFLAGS.tls.c+= -D_LIBC_SOURCE -std=gnu11 @ 1.2.46.1 log @Pull up following revision(s) (requested by nakayama in ticket #469): lib/libc/tls/tls.c: revision 1.10 lib/libc/tls/tls.c: revision 1.11 lib/libc/tls/tls.c: revision 1.12 lib/libc/tls/tls.c: revision 1.13 libexec/ld.elf_so/tls.c: revision 1.13 libexec/ld.elf_so/tls.c: revision 1.14 libexec/ld.elf_so/Makefile: revision 1.142 lib/libc/tls/Makefile.inc: revision 1.3 usr.bin/ldd/Makefile.elf: revision 1.6 PR 54093: Align static TLS area to max_align_t. Use alignof and not size_t for platforms with non-natural base alignments. Mirror the ld.elf_so logic for handling aligning the TLS size. Most noticable, recompute the start of the TLS area for variant I relative to the TCB. This makes a difference when the segment size and base alignment don't agree. Fix PR/54074 and PR/54093 completely. More similar to the ld.elf_so logic, it is necessary to align with p_align first. Also, invert the #ifdef condition for consistency. Should fix regression for static linking binaries: http://releng.netbsd.org/b5reports/sparc/commits-2019.11.html#2019.11.10.23.39.03 http://releng.netbsd.org/b5reports/sparc64/commits-2019.11.html#2019.11.16.04.10.33 @ text @d1 1 a1 1 # $NetBSD: Makefile.inc,v 1.2 2011/03/12 07:55:09 matt Exp $ d9 1 a9 1 CPPFLAGS.tls.c+= -D_LIBC_SOURCE -std=gnu11 @ 1.1 log @Add TLS support infrastructure. For dynamic binaries, ld.elf_so exports _rtld_tls_allocate and _rtld_tls_free. libpthread uses this functions to setup the thread private area of all new threads. ld.elf_so is responsible for setting up the private area for the initial thread. Similar functions are called from _libc_init for static binaries, using dl_iterate_phdr to access the ELF Program Header. Add test cases to exercise the different TLS storage models. Test cases are compiled and installed on all platforms, but are skipped on platforms not marked for TLS support. This material is based upon work partially supported by The NetBSD Foundation under a contract with Joerg Sonnenberger. It is inspired by the TLS support in FreeBSD by Doug Rabson and the clean ups of the DragonFly port of the original FreeBSD modifications. @ text @d1 1 a1 1 # $NetBSD$ d8 2 a9 1 SRCS+= tls.c @