230a9e15f1372785845f1bb19bf5a5fab3c3b38f
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / dmalloc / 0001-add-fpic.patch
1 Without -fPIC, dmalloc does not build with:
2
3 /home/test/mips-4.4/bin/mips-linux-gnu-ld --sysroot=/home/test/outputs/test-35/staging -shared --whole-archive -soname libdmallocxx.so -o libdmallocxx.so.t libdmallocxx.a
4 /home/test/mips-4.4/bin/mips-linux-gnu-ld: libdmalloc.a(arg_check.o): relocation R_MIPS_HI16 against `_dmalloc_flags' can not be used when making a shared object; recompile with -fPIC
5 libdmalloc.a(arg_check.o): could not read symbols: Bad value
6
7 This patch, taken from
8 http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/dmalloc/files/dmalloc-5.2.4-fpic.patch?hideattic=0&view=markup,
9 fixes the problem by passing the -fPIC flag. It isn't passed through
10 the ./configure environment in order to not clutter the configuration
11 cache with incorrect values.
12
13 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
14 ---
15  Makefile.in |   10 +++++-----
16  1 file changed, 5 insertions(+), 5 deletions(-)
17
18 --- a/Makefile.in
19 +++ b/Makefile.in
20 @@ -318,17 +318,17 @@
21  # special _th versions of objects with the LOCK_THREADS variable defined to 1
22  chunk_th.o : $(srcdir)/chunk.c
23         rm -f $@
24 -       $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
25 +       $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
26                 -c $(srcdir)/chunk.c -o ./$@
27  
28  error_th.o : $(srcdir)/error.c
29         rm -f $@
30 -       $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
31 +       $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
32                 -c $(srcdir)/error.c -o ./$@
33  
34  malloc_th.o : $(srcdir)/malloc.c
35         rm -f $@
36 -       $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
37 +       $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
38                 -c $(srcdir)/malloc.c -o ./$@
39  
40  tests : $(TEST) $(TEST_FC)
41 @@ -360,7 +360,7 @@
42  
43  .c.o :
44         rm -f $@
45 -       $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
46 +       $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
47  
48  #
49  # .cc.o auto-target doesn't work on some systems. 
50 @@ -368,7 +368,7 @@
51  #
52  dmallocc.o : $(srcdir)/dmallocc.cc
53         rm -f $@
54 -       $(CXX) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -c $(srcdir)/dmallocc.cc \
55 +       $(CXX) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $(srcdir)/dmallocc.cc \
56                 -o ./$@
57  
58  #