dmalloc-5.4.3-add-fpic.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. Without -fPIC, dmalloc does not build with:
  2. /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
  3. /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
  4. libdmalloc.a(arg_check.o): could not read symbols: Bad value
  5. This patch, taken from
  6. http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/dmalloc/files/dmalloc-5.2.4-fpic.patch?hideattic=0&view=markup,
  7. fixes the problem by passing the -fPIC flag. It isn't passed through
  8. the ./configure environment in order to not clutter the configuration
  9. cache with incorrect values.
  10. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  11. ---
  12. Makefile.in | 10 +++++-----
  13. 1 file changed, 5 insertions(+), 5 deletions(-)
  14. Index: dmalloc-5.4.3/Makefile.in
  15. ===================================================================
  16. --- dmalloc-5.4.3.orig/Makefile.in
  17. +++ dmalloc-5.4.3/Makefile.in
  18. @@ -319,17 +319,17 @@
  19. # special _th versions of objects with the LOCK_THREADS variable defined to 1
  20. chunk_th.o : $(srcdir)/chunk.c
  21. rm -f $@
  22. - $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
  23. + $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
  24. -c $(srcdir)/chunk.c -o ./$@
  25. error_th.o : $(srcdir)/error.c
  26. rm -f $@
  27. - $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
  28. + $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
  29. -c $(srcdir)/error.c -o ./$@
  30. malloc_th.o : $(srcdir)/malloc.c
  31. rm -f $@
  32. - $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
  33. + $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -DLOCK_THREADS=1 \
  34. -c $(srcdir)/malloc.c -o ./$@
  35. tests : $(TEST)
  36. @@ -355,7 +355,7 @@
  37. .c.o :
  38. rm -f $@
  39. - $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
  40. + $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
  41. #
  42. # .cc.o auto-target doesn't work on some systems.
  43. @@ -363,7 +363,7 @@
  44. #
  45. dmallocc.o : $(srcdir)/dmallocc.cc
  46. rm -f $@
  47. - $(CXX) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -c $(srcdir)/dmallocc.cc \
  48. + $(CXX) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $(srcdir)/dmallocc.cc \
  49. -o ./$@
  50. .texi.info :