summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xextra/scripts/initfini.pl10
-rw-r--r--libc/sysdeps/linux/common/Makefile2
-rw-r--r--libc/sysdeps/linux/common/initfini.c6
-rw-r--r--libc/sysdeps/linux/sh/Makefile16
-rw-r--r--libc/sysdeps/linux/sh/crti.S22
-rw-r--r--libc/sysdeps/linux/sh/crtn.S17
6 files changed, 16 insertions, 57 deletions
diff --git a/extra/scripts/initfini.pl b/extra/scripts/initfini.pl
index 7c592daac..431b39396 100755
--- a/extra/scripts/initfini.pl
+++ b/extra/scripts/initfini.pl
@@ -11,6 +11,7 @@ my($endp) = 0;
my($end) = 0;
my($omitcrti) = 0;
my($omitcrtn) = 0;
+my($discard) = 0;
my($line);
# Get commandline parameters
@@ -83,6 +84,10 @@ while(<INITFINI>) {
$omitcrtn = 0;
next;
}
+ if (/^i_am_not_a_leaf/) {
+ $discard = 1;
+ next;
+ }
if (/^_init:/ || /^_fini:/) {
$omitcrtn = 1;
}
@@ -140,12 +145,13 @@ while(<INITFINI>) {
s/ALIGN//;
}
}
- if (!$omitcrti) {
+ if (!$omitcrti && !$discard) {
print CRTI;
}
- if (!$omitcrtn) {
+ if (!$omitcrtn && !$discard) {
print CRTN;
}
+ $discard = 0;
}
close(INITFINI);
close(CRTI);
diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile
index b9a8319cb..84de78aca 100644
--- a/libc/sysdeps/linux/common/Makefile
+++ b/libc/sysdeps/linux/common/Makefile
@@ -1,7 +1,7 @@
# Makefile for uClibc
#
# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2002 Erik Andersen <andersen@uclibc.org>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Library General Public License as published by the Free
diff --git a/libc/sysdeps/linux/common/initfini.c b/libc/sysdeps/linux/common/initfini.c
index eb9f4c73b..f93a9baed 100644
--- a/libc/sysdeps/linux/common/initfini.c
+++ b/libc/sysdeps/linux/common/initfini.c
@@ -42,6 +42,10 @@
easier to insert the necessary directives into crtn.S. */
#define SECTION(x) asm (".section " x )
+/* Declare symbols as hidden. Hidden symbols are only seen by
+ * the link editor and not by the dynamic loader. */
+#define HIDDEN(func) asm (".hidden " #func )
+
/* The initial common code ends here. */
asm ("\n/*@HEADER_ENDS*/");
@@ -72,6 +76,7 @@ call_gmon_start(void)
#endif
SECTION (".init");
+HIDDEN(_init);
extern void _init (void);
void
_init (void)
@@ -108,6 +113,7 @@ asm ("\n/*@_init_EPILOG_ENDS*/");
asm ("\n/*@_fini_PROLOG_BEGINS*/");
SECTION (".fini");
+HIDDEN(_fini);
extern void _fini (void);
void
_fini (void)
diff --git a/libc/sysdeps/linux/sh/Makefile b/libc/sysdeps/linux/sh/Makefile
index 9b46c965a..6ff7f87e3 100644
--- a/libc/sysdeps/linux/sh/Makefile
+++ b/libc/sysdeps/linux/sh/Makefile
@@ -45,7 +45,7 @@ all: $(OBJS) $(LIBC)
$(LIBC): ar-target
-ar-target: $(OBJS) $(CRT0_OBJ) $(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
+ar-target: $(OBJS) $(CRT0_OBJ)
$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
cp $(CRT0_OBJ) $(TOPDIR)lib/$(CRT0_OBJ)
@@ -53,20 +53,6 @@ $(CRT0_OBJ): %.o : %.S
$(CC) $(SFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-crti.o: crti.S
- $(CC) $(SAFECFLAGS) -c crti.S -o crti.o
-
-$(TOPDIR)lib/crti.o: crti.o
- mkdir -p $(TOPDIR)lib/
- cp crti.o $(TOPDIR)lib/
-
-crtn.o: crtn.S
- $(CC) $(SAFECFLAGS) -c crtn.S -o crtn.o
-
-$(TOPDIR)lib/crtn.o: crtn.o
- mkdir -p $(TOPDIR)lib/
- cp crtn.o $(TOPDIR)lib/
-
$(SOBJS): %.o : %.S
$(CC) $(SFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
diff --git a/libc/sysdeps/linux/sh/crti.S b/libc/sysdeps/linux/sh/crti.S
deleted file mode 100644
index f79b6d2cf..000000000
--- a/libc/sysdeps/linux/sh/crti.S
+++ /dev/null
@@ -1,22 +0,0 @@
- .file "crti.S"
-
- .section .init
- .align 2
- .global _init
- .hidden _init
- .type _init,@function
-_init:
- mov.l r14,@-r15
- sts.l pr,@-r15
- mov r15,r14
-
- .section .fini
- .align 2
- .global _fini
- .hidden _fini
- .type _fini,@function
-_fini:
- mov.l r14,@-r15
- sts.l pr,@-r15
- mov r15,r14
-
diff --git a/libc/sysdeps/linux/sh/crtn.S b/libc/sysdeps/linux/sh/crtn.S
deleted file mode 100644
index 3a8761c1d..000000000
--- a/libc/sysdeps/linux/sh/crtn.S
+++ /dev/null
@@ -1,17 +0,0 @@
- .file "crtn.S"
-
- .section .init
- mov r14,r15
- lds.l @r15+,pr
- rts
- mov.l @r15+,r14
-.Lfe1:
- .size _init,.Lfe1-_init
-
- .section .fini
- mov r14,r15
- lds.l @r15+,pr
- rts
- mov.l @r15+,r14
-.Lfe2:
- .size _fini,.Lfe2-_fini