| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: rtld.c,v 1.174 2014/08/25 20:40:52 joerg Exp $ */ | | 1 | /* $NetBSD: rtld.c,v 1.175 2015/03/05 09:49:53 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 1996 John D. Polstra. | | 4 | * Copyright 1996 John D. Polstra. |
5 | * Copyright 1996 Matt Thomas <matt@3am-software.com> | | 5 | * Copyright 1996 Matt Thomas <matt@3am-software.com> |
6 | * Copyright 2002 Charles M. Hannum <root@ihack.net> | | 6 | * Copyright 2002 Charles M. Hannum <root@ihack.net> |
7 | * All rights reserved. | | 7 | * All rights reserved. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -30,27 +30,27 @@ | | | @@ -30,27 +30,27 @@ |
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | /* | | 35 | /* |
36 | * Dynamic linker for ELF. | | 36 | * Dynamic linker for ELF. |
37 | * | | 37 | * |
38 | * John Polstra <jdp@polstra.com>. | | 38 | * John Polstra <jdp@polstra.com>. |
39 | */ | | 39 | */ |
40 | | | 40 | |
41 | #include <sys/cdefs.h> | | 41 | #include <sys/cdefs.h> |
42 | #ifndef lint | | 42 | #ifndef lint |
43 | __RCSID("$NetBSD: rtld.c,v 1.174 2014/08/25 20:40:52 joerg Exp $"); | | 43 | __RCSID("$NetBSD: rtld.c,v 1.175 2015/03/05 09:49:53 skrll Exp $"); |
44 | #endif /* not lint */ | | 44 | #endif /* not lint */ |
45 | | | 45 | |
46 | #include <sys/param.h> | | 46 | #include <sys/param.h> |
47 | #include <sys/atomic.h> | | 47 | #include <sys/atomic.h> |
48 | #include <sys/mman.h> | | 48 | #include <sys/mman.h> |
49 | #include <err.h> | | 49 | #include <err.h> |
50 | #include <errno.h> | | 50 | #include <errno.h> |
51 | #include <fcntl.h> | | 51 | #include <fcntl.h> |
52 | #include <lwp.h> | | 52 | #include <lwp.h> |
53 | #include <stdarg.h> | | 53 | #include <stdarg.h> |
54 | #include <stdio.h> | | 54 | #include <stdio.h> |
55 | #include <stdlib.h> | | 55 | #include <stdlib.h> |
56 | #include <string.h> | | 56 | #include <string.h> |
| @@ -1421,26 +1421,29 @@ _rtld_error(const char *fmt,...) | | | @@ -1421,26 +1421,29 @@ _rtld_error(const char *fmt,...) |
1421 | { | | 1421 | { |
1422 | static char buf[512]; | | 1422 | static char buf[512]; |
1423 | va_list ap; | | 1423 | va_list ap; |
1424 | | | 1424 | |
1425 | va_start(ap, fmt); | | 1425 | va_start(ap, fmt); |
1426 | xvsnprintf(buf, sizeof buf, fmt, ap); | | 1426 | xvsnprintf(buf, sizeof buf, fmt, ap); |
1427 | error_message = buf; | | 1427 | error_message = buf; |
1428 | va_end(ap); | | 1428 | va_end(ap); |
1429 | } | | 1429 | } |
1430 | | | 1430 | |
1431 | void | | 1431 | void |
1432 | _rtld_debug_state(void) | | 1432 | _rtld_debug_state(void) |
1433 | { | | 1433 | { |
| | | 1434 | #if defined(__hppa__) |
| | | 1435 | __asm volatile("nop" ::: "memory"); |
| | | 1436 | #endif |
1434 | | | 1437 | |
1435 | /* Prevent optimizer from removing calls to this function */ | | 1438 | /* Prevent optimizer from removing calls to this function */ |
1436 | __insn_barrier(); | | 1439 | __insn_barrier(); |
1437 | } | | 1440 | } |
1438 | | | 1441 | |
1439 | void | | 1442 | void |
1440 | _rtld_linkmap_add(Obj_Entry *obj) | | 1443 | _rtld_linkmap_add(Obj_Entry *obj) |
1441 | { | | 1444 | { |
1442 | struct link_map *l = &obj->linkmap; | | 1445 | struct link_map *l = &obj->linkmap; |
1443 | struct link_map *prev; | | 1446 | struct link_map *prev; |
1444 | | | 1447 | |
1445 | obj->linkmap.l_name = obj->path; | | 1448 | obj->linkmap.l_name = obj->path; |
1446 | obj->linkmap.l_addr = obj->relocbase; | | 1449 | obj->linkmap.l_addr = obj->relocbase; |