ignore_init.c (232832) | ignore_init.c (245133) |
---|---|
1/*- 2 * Copyright 2012 Konstantin Belousov <kib@FreeBSD.org> 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 --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 1/*- 2 * Copyright 2012 Konstantin Belousov <kib@FreeBSD.org> 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 --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/lib/csu/common/ignore_init.c 232832 2012-03-11 20:04:09Z kib $"); | 27__FBSDID("$FreeBSD: head/lib/csu/common/ignore_init.c 245133 2013-01-07 17:58:27Z kib $"); |
28 29#include "notes.h" 30 31extern int main(int, char **, char **); 32 33extern void (*__preinit_array_start[])(int, char **, char **) __hidden; 34extern void (*__preinit_array_end[])(int, char **, char **) __hidden; 35extern void (*__init_array_start[])(int, char **, char **) __hidden; --- 46 unchanged lines hidden (view full) --- 82 for (n = 0; n < array_size; n++) { 83 fn = __init_array_start[n]; 84 if ((uintptr_t)fn != 0 && (uintptr_t)fn != 1) 85 fn(argc, argv, env); 86 } 87} 88 89static inline void | 28 29#include "notes.h" 30 31extern int main(int, char **, char **); 32 33extern void (*__preinit_array_start[])(int, char **, char **) __hidden; 34extern void (*__preinit_array_end[])(int, char **, char **) __hidden; 35extern void (*__init_array_start[])(int, char **, char **) __hidden; --- 46 unchanged lines hidden (view full) --- 82 for (n = 0; n < array_size; n++) { 83 fn = __init_array_start[n]; 84 if ((uintptr_t)fn != 0 && (uintptr_t)fn != 1) 85 fn(argc, argv, env); 86 } 87} 88 89static inline void |
90handle_progname(const char *v) | 90handle_argv(int argc, char *argv[], char **env) |
91{ 92 const char *s; 93 | 91{ 92 const char *s; 93 |
94 __progname = v; 95 for (s = __progname; *s != '\0'; s++) { 96 if (*s == '/') 97 __progname = s + 1; | 94 if (environ == NULL) 95 environ = env; 96 if (argc > 0 && argv[0] != NULL) { 97 __progname = argv[0]; 98 for (s = __progname; *s != '\0'; s++) { 99 if (*s == '/') 100 __progname = s + 1; 101 } |
98 } 99} 100 101static const struct { 102 int32_t namesz; 103 int32_t descsz; 104 int32_t type; 105 char name[sizeof(NOTE_FREEBSD_VENDOR)]; 106 uint32_t desc; 107} crt_noinit_tag __attribute__ ((section (NOTE_SECTION), 108 aligned(4))) __used = { 109 .namesz = sizeof(NOTE_FREEBSD_VENDOR), 110 .descsz = sizeof(uint32_t), 111 .type = CRT_NOINIT_NOTETYPE, 112 .name = NOTE_FREEBSD_VENDOR, 113 .desc = 0 114}; | 102 } 103} 104 105static const struct { 106 int32_t namesz; 107 int32_t descsz; 108 int32_t type; 109 char name[sizeof(NOTE_FREEBSD_VENDOR)]; 110 uint32_t desc; 111} crt_noinit_tag __attribute__ ((section (NOTE_SECTION), 112 aligned(4))) __used = { 113 .namesz = sizeof(NOTE_FREEBSD_VENDOR), 114 .descsz = sizeof(uint32_t), 115 .type = CRT_NOINIT_NOTETYPE, 116 .name = NOTE_FREEBSD_VENDOR, 117 .desc = 0 118}; |