aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2022-02-28 20:18:39 -0500
committerMike Frysinger <vapier@gentoo.org>2022-03-01 20:30:32 -0500
commitdea52d5c1e03586181f60beb93de2564cc5f3c0e (patch)
tree6e23020e5732bfb373e895c094b725ee72ba38f5 /newlib/libc
parente15b2e8691cb26b7ecf8b7ea3d52e508c3be6625 (diff)
downloadnewlib-dea52d5c1e03586181f60beb93de2564cc5f3c0e.zip
newlib-dea52d5c1e03586181f60beb93de2564cc5f3c0e.tar.gz
newlib-dea52d5c1e03586181f60beb93de2564cc5f3c0e.tar.bz2
newlib: convert INTERNAL_NEWLIB to _LIBC
Since we already set up _LIBC to indicate source files are building for newlib, we don't need this malloc-specific symbol. Convert it over to simplify the build a bit.
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/stdlib/Makefile.am26
-rw-r--r--newlib/libc/stdlib/Makefile.in25
-rw-r--r--newlib/libc/stdlib/mallocr.c22
-rw-r--r--newlib/libc/stdlib/nano-mallocr.c6
4 files changed, 38 insertions, 41 deletions
diff --git a/newlib/libc/stdlib/Makefile.am b/newlib/libc/stdlib/Makefile.am
index 771ce7c..50e22d9 100644
--- a/newlib/libc/stdlib/Makefile.am
+++ b/newlib/libc/stdlib/Makefile.am
@@ -208,43 +208,41 @@ lib_a_CFLAGS = $(AM_CFLAGS)
lib_a_DEPENDENCIES = $(LIBADD_OBJS) $(ELIX_OBJS)
LIB_COMPILE = $(AM_V_CC)$(COMPILE)
-MALLOC_COMPILE = $(LIB_COMPILE) -DINTERNAL_NEWLIB
-
$(lpfx)$(MALLOCR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MALLOC -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MALLOC -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(FREER).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_FREE -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_FREE -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(REALLOCR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(CALLOCR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(CFREER).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_CFREE -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_CFREE -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(MALIGNR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MEMALIGN -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MEMALIGN -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(VALLOCR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_VALLOC -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_VALLOC -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(PVALLOCR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(MALLINFOR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(MALLSTATSR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MALLOC_STATS -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MALLOC_STATS -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(MSIZER).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(MALLOPTR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)dtoa.o: dtoa.c mprec.h
$(lpfx)ldtoa.o: ldtoa.c mprec.h gdtoa.h
diff --git a/newlib/libc/stdlib/Makefile.in b/newlib/libc/stdlib/Makefile.in
index 5fbc478..9b873ef 100644
--- a/newlib/libc/stdlib/Makefile.in
+++ b/newlib/libc/stdlib/Makefile.in
@@ -513,7 +513,6 @@ lib_a_LIBADD = $(LIBADD_OBJS) $(ELIX_OBJS)
lib_a_CFLAGS = $(AM_CFLAGS)
lib_a_DEPENDENCIES = $(LIBADD_OBJS) $(ELIX_OBJS)
LIB_COMPILE = $(AM_V_CC)$(COMPILE)
-MALLOC_COMPILE = $(LIB_COMPILE) -DINTERNAL_NEWLIB
all: all-am
.SUFFIXES:
@@ -1501,40 +1500,40 @@ uninstall-am:
$(lpfx)$(MALLOCR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MALLOC -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MALLOC -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(FREER).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_FREE -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_FREE -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(REALLOCR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(CALLOCR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(CFREER).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_CFREE -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_CFREE -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(MALIGNR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MEMALIGN -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MEMALIGN -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(VALLOCR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_VALLOC -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_VALLOC -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(PVALLOCR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(MALLINFOR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(MALLSTATSR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MALLOC_STATS -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MALLOC_STATS -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(MSIZER).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)$(MALLOPTR).o: $(MALLOCR).c
- $(MALLOC_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@
+ $(LIB_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@
$(lpfx)dtoa.o: dtoa.c mprec.h
$(lpfx)ldtoa.o: ldtoa.c mprec.h gdtoa.h
diff --git a/newlib/libc/stdlib/mallocr.c b/newlib/libc/stdlib/mallocr.c
index 13d014c..6167433 100644
--- a/newlib/libc/stdlib/mallocr.c
+++ b/newlib/libc/stdlib/mallocr.c
@@ -209,7 +209,7 @@ int _dummy_mallocr = 1;
(for example, internally, `malloc' is named `mALLOc') needed
when compiling in this case. These look funny but don't otherwise
affect anything.
- INTERNAL_NEWLIB (default: NOT defined)
+ _LIBC (default: NOT defined)
Defined only when compiled as part of the Cygnus newlib
distribution.
WIN32 (default: undefined)
@@ -291,7 +291,7 @@ extern "C" {
*/
-#ifdef INTERNAL_NEWLIB
+#ifdef _LIBC
#include <sys/config.h>
@@ -345,7 +345,7 @@ extern void __malloc_unlock();
#define RCALL reent_ptr,
#define RONECALL reent_ptr
-#else /* ! INTERNAL_NEWLIB */
+#else /* ! _LIBC */
#define POINTER_UINT unsigned long
#define RARG
@@ -355,7 +355,7 @@ extern void __malloc_unlock();
#define RCALL
#define RONECALL
-#endif /* ! INTERNAL_NEWLIB */
+#endif /* ! _LIBC */
/*
Debugging:
@@ -953,7 +953,7 @@ Void_t *(*__morecore)() = __default_morecore_init;
#else /* INTERNAL_LINUX_C_LIB */
-#ifndef INTERNAL_NEWLIB
+#ifndef _LIBC
#if __STD_C
extern Void_t* sbrk(ptrdiff_t);
#else
@@ -1000,7 +1000,7 @@ extern Void_t* sbrk();
#else
-#ifdef INTERNAL_NEWLIB
+#ifdef _LIBC
#define cALLOc _calloc_r
#define fREe _free_r
@@ -1026,7 +1026,7 @@ extern Void_t* sbrk();
#define malloc_top_pad __malloc_top_pad
#define malloc_trim_threshold __malloc_trim_threshold
-#else /* ! INTERNAL_NEWLIB */
+#else /* ! _LIBC */
#define cALLOc calloc
#define fREe free
@@ -1038,7 +1038,7 @@ extern Void_t* sbrk();
#define mALLINFo mallinfo
#define mALLOPt mallopt
-#endif /* ! INTERNAL_NEWLIB */
+#endif /* ! _LIBC */
#endif
/* Public routines */
@@ -3274,14 +3274,14 @@ Void_t* cALLOc(RARG n, elem_size) RDECL size_t n; size_t elem_size;
*/
#if !defined(INTERNAL_LINUX_C_LIB) || !defined(__ELF__)
-#if !defined(INTERNAL_NEWLIB) || !defined(_REENT_ONLY)
+#if !defined(_LIBC) || !defined(_REENT_ONLY)
#if __STD_C
void cfree(Void_t *mem)
#else
void cfree(mem) Void_t *mem;
#endif
{
-#ifdef INTERNAL_NEWLIB
+#ifdef _LIBC
fREe(_REENT, mem);
#else
fREe(mem);
@@ -3522,7 +3522,7 @@ void malloc_stats(RONEARG) RDECL
#endif
MALLOC_UNLOCK;
-#ifdef INTERNAL_NEWLIB
+#ifdef _LIBC
_REENT_SMALL_CHECK_INIT(reent_ptr);
fp = _stderr_r(reent_ptr);
#define fprintf fiprintf
diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-mallocr.c
index 0c5fb28..7ba1c0a 100644
--- a/newlib/libc/stdlib/nano-mallocr.c
+++ b/newlib/libc/stdlib/nano-mallocr.c
@@ -50,7 +50,7 @@
#define _SBRK_R(X) _sbrk_r(X)
-#ifdef INTERNAL_NEWLIB
+#ifdef _LIBC
#include <sys/config.h>
#include <reent.h>
@@ -78,7 +78,7 @@
#define nano_mallinfo _mallinfo_r
#define nano_mallopt _mallopt_r
-#else /* ! INTERNAL_NEWLIB */
+#else /* ! _LIBC */
#define RARG
#define RONEARG
@@ -100,7 +100,7 @@
#define nano_malloc_stats malloc_stats
#define nano_mallinfo mallinfo
#define nano_mallopt mallopt
-#endif /* ! INTERNAL_NEWLIB */
+#endif /* ! _LIBC */
/* Redefine names to avoid conflict with user names */
#define free_list __malloc_free_list