aboutsummaryrefslogtreecommitdiff
path: root/malloc/Makefile
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-08-26 22:40:27 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-08-26 23:20:41 +0200
commitef4f97648dc95849e417dd3e6328165de4c22185 (patch)
tree8d250b1f15efcb2d718939c8d75d732efa8e70c2 /malloc/Makefile
parent21e79af4cf72429f98480fa34912a4ce236b09a0 (diff)
downloadglibc-ef4f97648dc95849e417dd3e6328165de4c22185.zip
glibc-ef4f97648dc95849e417dd3e6328165de4c22185.tar.gz
glibc-ef4f97648dc95849e417dd3e6328165de4c22185.tar.bz2
malloc: Simplify static malloc interposition [BZ #20432]
Existing interposed mallocs do not define the glibc-internal fork callbacks (and they should not), so statically interposed mallocs lead to link failures because the strong reference from fork pulls in glibc's malloc, resulting in multiple definitions of malloc-related symbols.
Diffstat (limited to 'malloc/Makefile')
-rw-r--r--malloc/Makefile27
1 files changed, 26 insertions, 1 deletions
diff --git a/malloc/Makefile b/malloc/Makefile
index 4d5c81d..037e830 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -30,7 +30,16 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
tst-pvalloc tst-memalign tst-mallopt tst-scratch_buffer \
tst-malloc-backtrace tst-malloc-thread-exit \
tst-malloc-thread-fail tst-malloc-fork-deadlock \
- tst-mallocfork2
+ tst-mallocfork2 \
+ tst-interpose-nothread \
+ tst-interpose-thread \
+ tst-interpose-static-nothread \
+ tst-interpose-static-thread \
+
+tests-static := \
+ tst-interpose-static-nothread \
+ tst-interpose-static-thread \
+
test-srcs = tst-mtrace
routines = malloc morecore mcheck mtrace obstack \
@@ -44,6 +53,15 @@ non-lib.a := libmcheck.a
extra-libs = libmemusage
extra-libs-others = $(extra-libs)
+# Helper objects for some tests.
+extra-tests-objs += \
+ tst-interpose-aux-nothread.o \
+ tst-interpose-aux-thread.o \
+
+test-extras = \
+ tst-interpose-aux-nothread \
+ tst-interpose-aux-thread \
+
libmemusage-routines = memusage
libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
@@ -170,3 +188,10 @@ $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c
# Compile the tests with a flag which suppresses the mallopt call in
# the test skeleton.
$(tests:%=$(objpfx)%.o): CPPFLAGS += -DTEST_NO_MALLOPT
+
+$(objpfx)tst-interpose-nothread: $(objpfx)tst-interpose-aux-nothread.o
+$(objpfx)tst-interpose-thread: \
+ $(objpfx)tst-interpose-aux-thread.o $(shared-thread-library)
+$(objpfx)tst-interpose-static-nothread: $(objpfx)tst-interpose-aux-nothread.o
+$(objpfx)tst-interpose-static-thread: \
+ $(objpfx)tst-interpose-aux-thread.o $(static-thread-library)