aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Richards <paul@FreeBSD.org>1993-11-09 04:44:30 +0000
committerPaul Richards <paul@FreeBSD.org>1993-11-09 04:44:30 +0000
commitbcd9d0cf1199974860c26f2e4ad0df04541ce6f2 (patch)
treea5788ed4c0af262ba6f83173cf6c7713cc757141
parentbfa077712ffca017eda0f6bb039eb9b55e5a0f14 (diff)
downloadsrc-bcd9d0cf1199974860c26f2e4ad0df04541ce6f2.tar.gz
src-bcd9d0cf1199974860c26f2e4ad0df04541ce6f2.zip
Added -lgcc_pic to Makefile -- Why do we need this and NetBSD don't ??
Incorporated patch by Guido (inspired by Davidg) that fixes stack problem. May not be final fix but it works more than the current method.
Notes
Notes: svn path=/head/; revision=742
-rw-r--r--gnu/usr.bin/ld/rtld/Makefile4
-rw-r--r--gnu/usr.bin/ld/rtld/rtld.c27
-rw-r--r--libexec/rtld-aout/Makefile4
-rw-r--r--libexec/rtld-aout/rtld.c27
4 files changed, 26 insertions, 36 deletions
diff --git a/gnu/usr.bin/ld/rtld/Makefile b/gnu/usr.bin/ld/rtld/Makefile
index a7975f668a40..06b215cdf2c5 100644
--- a/gnu/usr.bin/ld/rtld/Makefile
+++ b/gnu/usr.bin/ld/rtld/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.3 1993/11/08 13:20:39 pk Exp $
+# $Id: Makefile,v 1.3 1993/11/09 04:19:29 paul Exp $
PROG= ld.so
SRCS= mdprologue.S rtld.c shlib.c etc.c md.c
@@ -8,7 +8,7 @@ LDDIR?= $(.CURDIR)/..
PICFLAG=-fpic
CFLAGS += -I$(LDDIR) -I$(.CURDIR) -I$(LDDIR)/$(MACHINE) -O $(PICFLAG) -DRTLD
LDFLAGS = -Bshareable -Bsymbolic -assert nosymbolic
-LIBS = -lc_pic
+LIBS = -lc_pic -lgcc_pic
BINDIR= /usr/libexec
.PATH: $(LDDIR) $(LDDIR)/$(MACHINE)
diff --git a/gnu/usr.bin/ld/rtld/rtld.c b/gnu/usr.bin/ld/rtld/rtld.c
index e833787d6d78..9c4f0bcbb648 100644
--- a/gnu/usr.bin/ld/rtld/rtld.c
+++ b/gnu/usr.bin/ld/rtld/rtld.c
@@ -27,9 +27,10 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: rtld.c,v 1.8 1993/11/08 13:20:40 pk Exp $
+ * $Id: rtld.c,v 1.2 1993/11/09 04:19:31 paul Exp $
*/
+#include <machine/vmparam.h>
#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
@@ -888,11 +889,10 @@ int *usehints;
if (ld_path != NULL) {
/* Prefer paths from LD_LIBRARY_PATH */
- while ((cp = strsep(&ld_path, ":")) != NULL) {
+ while ((cp = strtok(ld_path, ":")) != NULL) {
+ ld_path = NULL;
hint = findhint(name, major, minor, cp);
- if (ld_path)
- *(ld_path-1) = ':';
if (hint)
return hint;
}
@@ -951,18 +951,13 @@ init_brk()
_exit(1);
}
- /*
- * Walk to the top of stack
- */
- if (*cpp) {
- while (*cpp) cpp++;
- cp = *--cpp;
- while (*cp) cp++;
- } else
- cp = (char *)&cp;
-
- curbrk = (caddr_t)
- (((long)(cp - 1 - rlim.rlim_cur) + PAGSIZ) & ~(PAGSIZ - 1));
+ if (environ < USRSTACK - MAXSSIZ) {
+ curbrk = (caddr_t)
+ (((long)(USRSTACK - MAXSSIZ - rlim.rlim_cur) + PAGSIZ) & ~(PAGSIZ - 1));
+ } else {
+ curbrk = (caddr_t)
+ (((long)(USRSTACK - rlim.rlim_cur) + PAGSIZ) & ~(PAGSIZ - 1)) ;
+ }
}
void
diff --git a/libexec/rtld-aout/Makefile b/libexec/rtld-aout/Makefile
index a7975f668a40..06b215cdf2c5 100644
--- a/libexec/rtld-aout/Makefile
+++ b/libexec/rtld-aout/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.3 1993/11/08 13:20:39 pk Exp $
+# $Id: Makefile,v 1.3 1993/11/09 04:19:29 paul Exp $
PROG= ld.so
SRCS= mdprologue.S rtld.c shlib.c etc.c md.c
@@ -8,7 +8,7 @@ LDDIR?= $(.CURDIR)/..
PICFLAG=-fpic
CFLAGS += -I$(LDDIR) -I$(.CURDIR) -I$(LDDIR)/$(MACHINE) -O $(PICFLAG) -DRTLD
LDFLAGS = -Bshareable -Bsymbolic -assert nosymbolic
-LIBS = -lc_pic
+LIBS = -lc_pic -lgcc_pic
BINDIR= /usr/libexec
.PATH: $(LDDIR) $(LDDIR)/$(MACHINE)
diff --git a/libexec/rtld-aout/rtld.c b/libexec/rtld-aout/rtld.c
index e833787d6d78..9c4f0bcbb648 100644
--- a/libexec/rtld-aout/rtld.c
+++ b/libexec/rtld-aout/rtld.c
@@ -27,9 +27,10 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: rtld.c,v 1.8 1993/11/08 13:20:40 pk Exp $
+ * $Id: rtld.c,v 1.2 1993/11/09 04:19:31 paul Exp $
*/
+#include <machine/vmparam.h>
#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
@@ -888,11 +889,10 @@ int *usehints;
if (ld_path != NULL) {
/* Prefer paths from LD_LIBRARY_PATH */
- while ((cp = strsep(&ld_path, ":")) != NULL) {
+ while ((cp = strtok(ld_path, ":")) != NULL) {
+ ld_path = NULL;
hint = findhint(name, major, minor, cp);
- if (ld_path)
- *(ld_path-1) = ':';
if (hint)
return hint;
}
@@ -951,18 +951,13 @@ init_brk()
_exit(1);
}
- /*
- * Walk to the top of stack
- */
- if (*cpp) {
- while (*cpp) cpp++;
- cp = *--cpp;
- while (*cp) cp++;
- } else
- cp = (char *)&cp;
-
- curbrk = (caddr_t)
- (((long)(cp - 1 - rlim.rlim_cur) + PAGSIZ) & ~(PAGSIZ - 1));
+ if (environ < USRSTACK - MAXSSIZ) {
+ curbrk = (caddr_t)
+ (((long)(USRSTACK - MAXSSIZ - rlim.rlim_cur) + PAGSIZ) & ~(PAGSIZ - 1));
+ } else {
+ curbrk = (caddr_t)
+ (((long)(USRSTACK - rlim.rlim_cur) + PAGSIZ) & ~(PAGSIZ - 1)) ;
+ }
}
void