summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/binutils')
-rw-r--r--gnu/usr.bin/binutils/mmalloc/ChangeLog18
-rw-r--r--gnu/usr.bin/binutils/mmalloc/Makefile.in14
-rw-r--r--gnu/usr.bin/binutils/mmalloc/mm.c37
-rw-r--r--gnu/usr.bin/binutils/mmalloc/mvalloc.c8
4 files changed, 70 insertions, 7 deletions
diff --git a/gnu/usr.bin/binutils/mmalloc/ChangeLog b/gnu/usr.bin/binutils/mmalloc/ChangeLog
index 5d5908c463e..78f203faa99 100644
--- a/gnu/usr.bin/binutils/mmalloc/ChangeLog
+++ b/gnu/usr.bin/binutils/mmalloc/ChangeLog
@@ -1,3 +1,21 @@
+Tue Feb 4 16:30:59 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * mvalloc.c (cache_pagesize): Rename from pagesize, so that if we
+ are building mm.o, it does not conflict with the variable of the
+ same name in mmap-sup.c.
+
+Sat Dec 28 12:48:32 1996 Fred Fish <fnf@cygnus.com>
+
+ * Makefile.in (mm.o): New target that combines all the functions
+ into a single object module. This avoids client programs picking
+ up part of the allocation routines from mmalloc and part from libc,
+ which can lead to undefined behavior.
+ (CFILES): Add mm.c
+ (TARGETOBJS): Define to be either the individual objects or the
+ single combined object.
+ (TARGETLIB): Create the archive using TARGETOBJS.
+ * mm.c: New file that simply #includes the other source C files.
+
Thu Oct 3 15:45:23 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
* Makefile.in (maintainer-clean): Depend on distclean, remove
diff --git a/gnu/usr.bin/binutils/mmalloc/Makefile.in b/gnu/usr.bin/binutils/mmalloc/Makefile.in
index f039277bdbb..f9dd5573da1 100644
--- a/gnu/usr.bin/binutils/mmalloc/Makefile.in
+++ b/gnu/usr.bin/binutils/mmalloc/Makefile.in
@@ -73,7 +73,7 @@ TARGETLIB = libmmalloc.a
CFILES = mcalloc.c mfree.c mmalloc.c mmcheck.c mmemalign.c mmstats.c \
mmtrace.c mrealloc.c mvalloc.c mmap-sup.c attach.c detach.c \
- keys.c sbrk-sup.c
+ keys.c sbrk-sup.c mm.c
HFILES = mmalloc.h
@@ -83,6 +83,11 @@ OFILES = mcalloc.o mfree.o mmalloc.o mmcheck.o mmemalign.o mmstats.o \
DEFS = @DEFS@
+# The current default is to build a single object module with all the mmalloc
+# functions. To build a more traditional library, flip this macro definition.
+#TARGETOBJS = $(OFILES)
+TARGETOBJS = mm.o
+
.c.o:
$(CC) -c $(CFLAGS) $(DEFS) -I. -I$(srcdir)/../include $<
@@ -122,13 +127,16 @@ install: all
$(RANLIB) $(DESTDIR)$(libdir)/$(TARGETLIB).n
mv -f $(DESTDIR)$(libdir)/$(TARGETLIB).n $(DESTDIR)$(libdir)/$(TARGETLIB)
-$(TARGETLIB): $(OFILES)
+$(TARGETLIB): $(TARGETOBJS)
$(RM) -rf $@
- $(AR) $(AR_FLAGS) $@ $(OFILES)
+ $(AR) $(AR_FLAGS) $@ $(TARGETOBJS)
$(RANLIB) $@
$(OFILES) : $(HFILES) Makefile
+mm.o: $(HFILES) $(CFILES)
+ $(CC) -c $(CFLAGS) $(DEFS) -I. -I$(srcdir)/../include $(srcdir)/mm.c
+
.always.:
# Do nothing.
diff --git a/gnu/usr.bin/binutils/mmalloc/mm.c b/gnu/usr.bin/binutils/mmalloc/mm.c
new file mode 100644
index 00000000000..b555f09f173
--- /dev/null
+++ b/gnu/usr.bin/binutils/mmalloc/mm.c
@@ -0,0 +1,37 @@
+/* Build the entire mmalloc library as a single object module. This
+ avoids having clients pick up part of their allocation routines
+ from mmalloc and part from libc, which results in undefined
+ behavior. It should also still be possible to build the library
+ as a standard library with multiple objects.
+
+ Copyright 1996 Free Software Foundation
+
+The GNU C Library 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 Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include "mcalloc.c"
+#include "mfree.c"
+#include "mmalloc.c"
+#include "mmcheck.c"
+#include "mmemalign.c"
+#include "mmstats.c"
+#include "mmtrace.c"
+#include "mrealloc.c"
+#include "mvalloc.c"
+#include "mmap-sup.c"
+#include "attach.c"
+#include "detach.c"
+#include "keys.c"
+#include "sbrk-sup.c"
diff --git a/gnu/usr.bin/binutils/mmalloc/mvalloc.c b/gnu/usr.bin/binutils/mmalloc/mvalloc.c
index 61c90dccdfe..7acef67e84f 100644
--- a/gnu/usr.bin/binutils/mmalloc/mvalloc.c
+++ b/gnu/usr.bin/binutils/mmalloc/mvalloc.c
@@ -23,7 +23,7 @@ Boston, MA 02111-1307, USA. */
elsewhere, not clutter up this file with lots of kluges to try to figure
it out. */
-static size_t pagesize;
+static size_t cache_pagesize;
extern int getpagesize PARAMS ((void));
PTR
@@ -31,12 +31,12 @@ mvalloc (md, size)
PTR md;
size_t size;
{
- if (pagesize == 0)
+ if (cache_pagesize == 0)
{
- pagesize = getpagesize ();
+ cache_pagesize = getpagesize ();
}
- return (mmemalign (md, pagesize, size));
+ return (mmemalign (md, cache_pagesize, size));
}