From owner-svn-src-all@FreeBSD.ORG Tue Feb 16 06:47:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5865B106566B; Tue, 16 Feb 2010 06:47:01 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E55F8FC08; Tue, 16 Feb 2010 06:47:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1G6l1vX043766; Tue, 16 Feb 2010 06:47:01 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1G6l1uL043765; Tue, 16 Feb 2010 06:47:01 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201002160647.o1G6l1uL043765@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 16 Feb 2010 06:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203950 - head/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2010 06:47:01 -0000 Author: marcel Date: Tue Feb 16 06:47:00 2010 New Revision: 203950 URL: http://svn.freebsd.org/changeset/base/203950 Log: Unbreak ia64: tls_model("initial-exec") is invalid, because it assumes the static TLS model, which is fundamentally different from the dynamic TLS model. The consequence was data corruption. Limit the attribute to i386 and amd64. Modified: head/lib/libc/stdlib/malloc.c Modified: head/lib/libc/stdlib/malloc.c ============================================================================== --- head/lib/libc/stdlib/malloc.c Tue Feb 16 06:34:44 2010 (r203949) +++ head/lib/libc/stdlib/malloc.c Tue Feb 16 06:47:00 2010 (r203950) @@ -215,10 +215,12 @@ __FBSDID("$FreeBSD$"); # define LG_QUANTUM 4 # define LG_SIZEOF_PTR 2 # define CPU_SPINWAIT __asm__ volatile("pause") +# define TLS_MODEL __attribute__((tls_model("initial-exec"))) #endif #ifdef __ia64__ # define LG_QUANTUM 4 # define LG_SIZEOF_PTR 3 +# define TLS_MODEL /* default */ #endif #ifdef __alpha__ # define LG_QUANTUM 4 @@ -234,6 +236,7 @@ __FBSDID("$FreeBSD$"); # define LG_QUANTUM 4 # define LG_SIZEOF_PTR 3 # define CPU_SPINWAIT __asm__ volatile("pause") +# define TLS_MODEL __attribute__((tls_model("initial-exec"))) #endif #ifdef __arm__ # define LG_QUANTUM 3 @@ -1090,14 +1093,12 @@ static pthread_mutex_t arenas_lock; /* P * Map of _pthread_self() --> arenas[???], used for selecting an arena to use * for allocations. */ -static __thread arena_t *arenas_map - __attribute__((tls_model("initial-exec"))); +static __thread arena_t *arenas_map TLS_MODEL; #endif #ifdef MALLOC_TCACHE /* Map of thread-specific caches. */ -static __thread tcache_t *tcache_tls - __attribute__((tls_model("initial-exec"))); +static __thread tcache_t *tcache_tls TLS_MODEL; /* * Number of cache slots for each bin in the thread cache, or 0 if tcache is @@ -1115,15 +1116,12 @@ unsigned tcache_gc_incr; * since the state of mmap_unaligned only affects performance, rather than * correct function. */ -static #ifndef NO_TLS - __thread -#endif - bool mmap_unaligned -#ifndef NO_TLS - __attribute__((tls_model("initial-exec"))) +static __thread bool mmap_unaligned TLS_MODEL; +#else +static bool mmap_unaligned; #endif - ; + #ifdef MALLOC_STATS static malloc_mutex_t chunks_mtx; /* Chunk statistics. */