Deleted Added
full compact
tls.c (294227) tls.c (297790)
1/*-
2 * Copyright (c) 2004 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2004 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/lib/libc/gen/tls.c 294227 2016-01-17 15:21:23Z br $
26 * $FreeBSD: head/lib/libc/gen/tls.c 297790 2016-04-10 19:33:58Z pfg $
27 */
28
29/*
30 * Define stubs for TLS internals so that programs and libraries can
31 * link. These functions will be replaced by functional versions at
32 * runtime from ld-elf.so.1.
33 */
34

--- 245 unchanged lines hidden (view full) ---

280 size_t phent, phnum;
281 int i;
282 void *tls;
283
284 sp = (Elf_Addr *) environ;
285 while (*sp++ != 0)
286 ;
287 aux = (Elf_Auxinfo *) sp;
27 */
28
29/*
30 * Define stubs for TLS internals so that programs and libraries can
31 * link. These functions will be replaced by functional versions at
32 * runtime from ld-elf.so.1.
33 */
34

--- 245 unchanged lines hidden (view full) ---

280 size_t phent, phnum;
281 int i;
282 void *tls;
283
284 sp = (Elf_Addr *) environ;
285 while (*sp++ != 0)
286 ;
287 aux = (Elf_Auxinfo *) sp;
288 phdr = 0;
288 phdr = NULL;
289 phent = phnum = 0;
290 for (auxp = aux; auxp->a_type != AT_NULL; auxp++) {
291 switch (auxp->a_type) {
292 case AT_PHDR:
293 phdr = auxp->a_un.a_ptr;
294 break;
295
296 case AT_PHENT:
297 phent = auxp->a_un.a_val;
298 break;
299
300 case AT_PHNUM:
301 phnum = auxp->a_un.a_val;
302 break;
303 }
304 }
289 phent = phnum = 0;
290 for (auxp = aux; auxp->a_type != AT_NULL; auxp++) {
291 switch (auxp->a_type) {
292 case AT_PHDR:
293 phdr = auxp->a_un.a_ptr;
294 break;
295
296 case AT_PHENT:
297 phent = auxp->a_un.a_val;
298 break;
299
300 case AT_PHNUM:
301 phnum = auxp->a_un.a_val;
302 break;
303 }
304 }
305 if (phdr == 0 || phent != sizeof(Elf_Phdr) || phnum == 0)
305 if (phdr == NULL || phent != sizeof(Elf_Phdr) || phnum == 0)
306 return;
307
308 for (i = 0; (unsigned) i < phnum; i++) {
309 if (phdr[i].p_type == PT_TLS) {
310 tls_static_space = round(phdr[i].p_memsz,
311 phdr[i].p_align);
312 tls_init_size = phdr[i].p_filesz;
313 tls_init = (void*) phdr[i].p_vaddr;

--- 15 unchanged lines hidden ---
306 return;
307
308 for (i = 0; (unsigned) i < phnum; i++) {
309 if (phdr[i].p_type == PT_TLS) {
310 tls_static_space = round(phdr[i].p_memsz,
311 phdr[i].p_align);
312 tls_init_size = phdr[i].p_filesz;
313 tls_init = (void*) phdr[i].p_vaddr;

--- 15 unchanged lines hidden ---