Tue Jan 22 22:57:37 2013 UTC ()
Fix static weak (to extern weak)


(matt)
diff -r1.9 -r1.10 src/lib/csu/common/crt0-common.c

cvs diff -r1.9 -r1.10 src/lib/csu/common/crt0-common.c (expand / switch to unified diff)

--- src/lib/csu/common/crt0-common.c 2012/08/13 02:15:35 1.9
+++ src/lib/csu/common/crt0-common.c 2013/01/22 22:57:37 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: crt0-common.c,v 1.9 2012/08/13 02:15:35 matt Exp $ */ 1/* $NetBSD: crt0-common.c,v 1.10 2013/01/22 22:57:37 matt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998 Christos Zoulas 4 * Copyright (c) 1998 Christos Zoulas
5 * Copyright (c) 1995 Christopher G. Demetriou 5 * Copyright (c) 1995 Christopher G. Demetriou
6 * All rights reserved. 6 * All rights reserved.
7 *  7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *  34 *
35 * <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>> 35 * <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__RCSID("$NetBSD: crt0-common.c,v 1.9 2012/08/13 02:15:35 matt Exp $"); 39__RCSID("$NetBSD: crt0-common.c,v 1.10 2013/01/22 22:57:37 matt Exp $");
40 40
41#include <sys/types.h> 41#include <sys/types.h>
42#include <sys/exec.h> 42#include <sys/exec.h>
43#include <sys/syscall.h> 43#include <sys/syscall.h>
44#include <machine/profile.h> 44#include <machine/profile.h>
45#include <stdlib.h> 45#include <stdlib.h>
46#include <unistd.h> 46#include <unistd.h>
47 47
48#include "rtld.h" 48#include "rtld.h"
49 49
50extern int main(int, char **, char **); 50extern int main(int, char **, char **);
51 51
52#ifndef HAVE_INITFINI_ARRAY 52#ifndef HAVE_INITFINI_ARRAY
@@ -85,30 +85,30 @@ __dead __dso_hidden void ___start(void ( @@ -85,30 +85,30 @@ __dead __dso_hidden void ___start(void (
85do { \ 85do { \
86 write(2, str, sizeof(str)-1); \ 86 write(2, str, sizeof(str)-1); \
87 _exit(1); \ 87 _exit(1); \
88} while (0) 88} while (0)
89 89
90#ifdef HAVE_INITFINI_ARRAY 90#ifdef HAVE_INITFINI_ARRAY
91/* 91/*
92 * If we are using INIT_ARRAY/FINI_ARRAY and we are linked statically, 92 * If we are using INIT_ARRAY/FINI_ARRAY and we are linked statically,
93 * we have to process these instead of relying on RTLD to do it for us. 93 * we have to process these instead of relying on RTLD to do it for us.
94 * 94 *
95 * Since we don't need .init or .fini sections, just code them in C 95 * Since we don't need .init or .fini sections, just code them in C
96 * to make life easier. 96 * to make life easier.
97 */ 97 */
98static const fptr_t init_array_start[] __weak_reference(__init_array_start); 98extern const fptr_t init_array_start[] __weak_reference(__init_array_start);
99static const fptr_t init_array_end[] __weak_reference(__init_array_end); 99extern const fptr_t init_array_end[] __weak_reference(__init_array_end);
100static const fptr_t fini_array_start[] __weak_reference(__fini_array_start); 100extern const fptr_t fini_array_start[] __weak_reference(__fini_array_start);
101static const fptr_t fini_array_end[] __weak_reference(__fini_array_end); 101extern const fptr_t fini_array_end[] __weak_reference(__fini_array_end);
102 102
103static inline void 103static inline void
104_init(void) 104_init(void)
105{ 105{
106 for (const fptr_t *f = init_array_start; f < init_array_end; f++) { 106 for (const fptr_t *f = init_array_start; f < init_array_end; f++) {
107 (*f)(); 107 (*f)();
108 } 108 }
109} 109}
110 110
111static void 111static void
112_fini(void) 112_fini(void)
113{ 113{
114 for (const fptr_t *f = fini_array_start; f < fini_array_end; f++) { 114 for (const fptr_t *f = fini_array_start; f < fini_array_end; f++) {