Deleted Added
full compact
rtld.c (126236) rtld.c (126643)
1/*-
2 * Copyright 1996, 1997, 1998, 1999, 2000 John D. Polstra.
3 * Copyright 2003 Alexander Kabaev <kan@FreeBSD.ORG>.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
1/*-
2 * Copyright 1996, 1997, 1998, 1999, 2000 John D. Polstra.
3 * Copyright 2003 Alexander Kabaev <kan@FreeBSD.ORG>.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/libexec/rtld-elf/rtld.c 126236 2004-02-25 17:06:16Z kan $
26 * $FreeBSD: head/libexec/rtld-elf/rtld.c 126643 2004-03-05 08:10:19Z markm $
27 */
28
29/*
30 * Dynamic linker for ELF.
31 *
32 * John Polstra <jdp@polstra.com>.
33 */
34

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

326 linkmap_add(obj_main);
327 linkmap_add(&obj_rtld);
328
329 /* Link the main program into the list of objects. */
330 *obj_tail = obj_main;
331 obj_tail = &obj_main->next;
332 obj_count++;
333 /* Make sure we don't call the main program's init and fini functions. */
27 */
28
29/*
30 * Dynamic linker for ELF.
31 *
32 * John Polstra <jdp@polstra.com>.
33 */
34

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

326 linkmap_add(obj_main);
327 linkmap_add(&obj_rtld);
328
329 /* Link the main program into the list of objects. */
330 *obj_tail = obj_main;
331 obj_tail = &obj_main->next;
332 obj_count++;
333 /* Make sure we don't call the main program's init and fini functions. */
334 obj_main->init = obj_main->fini = NULL;
334 obj_main->init = obj_main->fini = (Elf_Addr)NULL;
335
336 /* Initialize a fake symbol for resolving undefined weak references. */
337 sym_zero.st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE);
338 sym_zero.st_shndx = SHN_UNDEF;
339
340 if (!libmap_disable)
341 libmap_disable = (bool)lm_init();
342

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

1063 if (&obj->next != tail)
1064 initlist_add_objects(obj->next, tail, list);
1065
1066 /* Recursively process the needed objects. */
1067 if (obj->needed != NULL)
1068 initlist_add_neededs(obj->needed, list);
1069
1070 /* Add the object to the init list. */
335
336 /* Initialize a fake symbol for resolving undefined weak references. */
337 sym_zero.st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE);
338 sym_zero.st_shndx = SHN_UNDEF;
339
340 if (!libmap_disable)
341 libmap_disable = (bool)lm_init();
342

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

1063 if (&obj->next != tail)
1064 initlist_add_objects(obj->next, tail, list);
1065
1066 /* Recursively process the needed objects. */
1067 if (obj->needed != NULL)
1068 initlist_add_neededs(obj->needed, list);
1069
1070 /* Add the object to the init list. */
1071 if (obj->init != NULL)
1071 if (obj->init != (Elf_Addr)NULL)
1072 objlist_push_tail(list, obj);
1073
1074 /* Add the object to the global fini list in the reverse order. */
1072 objlist_push_tail(list, obj);
1073
1074 /* Add the object to the global fini list in the reverse order. */
1075 if (obj->fini != NULL)
1075 if (obj->fini != (Elf_Addr)NULL)
1076 objlist_push_head(&list_fini, obj);
1077}
1078
1079#ifndef FPTR_TARGET
1080#define FPTR_TARGET(f) ((Elf_Addr) (f))
1081#endif
1082
1083static bool

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

1127
1128static int
1129load_preload_objects(void)
1130{
1131 char *p = ld_preload;
1132 static const char delim[] = " \t:;";
1133
1134 if (p == NULL)
1076 objlist_push_head(&list_fini, obj);
1077}
1078
1079#ifndef FPTR_TARGET
1080#define FPTR_TARGET(f) ((Elf_Addr) (f))
1081#endif
1082
1083static bool

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

1127
1128static int
1129load_preload_objects(void)
1130{
1131 char *p = ld_preload;
1132 static const char delim[] = " \t:;";
1133
1134 if (p == NULL)
1135 return NULL;
1135 return 0;
1136
1137 p += strspn(p, delim);
1138 while (*p != '\0') {
1139 size_t len = strcspn(p, delim);
1140 char *path;
1141 char savech;
1142
1143 savech = p[len];

--- 1279 unchanged lines hidden ---
1136
1137 p += strspn(p, delim);
1138 while (*p != '\0') {
1139 size_t len = strcspn(p, delim);
1140 char *path;
1141 char savech;
1142
1143 savech = p[len];

--- 1279 unchanged lines hidden ---