Skip to content
This repository
Browse code

[droid] fix libtool system link order

Libtool runs some checks internally, then sets the link order for toolchain
libs like libc/libm/libstdc++/libdl/etc. When using libcrystax, in order to
link correctly and pick up all symbols, -lstdc++ MUST come before -lcrystax,
because libstdc++ actually depends on libcrystax for locales, rtti, wchar_t,
and a few other things.

Libtool does not know about this dependency, so we must set it explicitly.
This fixes runtime errors due to missing symbols when loading a lib linked by
libtool, most commonly missing _CurrentRuneLocale.
  • Loading branch information...
commit 8f0d270ed98a8c7081216d05133b24823661b3fe 1 parent 4f6d354
authored November 27, 2012
1  tools/android/depends/libtool/Makefile
@@ -24,6 +24,7 @@ $(TARBALLS_LOCATION)/$(ARCHIVE):
24 24
 $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
25 25
 	-rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
26 26
 	$(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
  27
+	cd $(PLATFORM); patch -p0 < ../fix-libcrystax.patch
27 28
 	cd $(PLATFORM); $(CONFIGURE)
28 29
 
29 30
 $(LIBDYLIB): $(PLATFORM)
13  tools/android/depends/libtool/fix-libcrystax.patch
... ...
@@ -0,0 +1,13 @@
  1
+--- libltdl/m4/libtool.m4	2008-09-05 07:54:41.000000000 -0400
  2
++++ libltdl/m4/libtool.m4	2012-11-27 23:25:25.414701465 -0500
  3
+@@ -6489,6 +6489,10 @@
  4
+   _LT_TAGVAR(postdeps,$1)=
  5
+   ;;
  6
+ 
  7
++linux-android*)
  8
++  _LT_TAGVAR(postdeps, $1)="$_LT_TAGVAR(postdeps, $1) -lcrystax"
  9
++  ;;
  10
++ 
  11
+ linux*)
  12
+   case `$CC -V 2>&1 | sed 5q` in
  13
+   *Sun\ C*)

0 notes on commit 8f0d270

Please sign in to comment.
Something went wrong with that request. Please try again.