Backport .init_array/.fini_array work.
Android requires ".init_array" and ".fini_array" for X86/MIPS as well, regardless the gcc version. This patch is basing on following patches: commit d6b43a31 Author: Rafael Espindola <rafael.espindola@gmail.com> Date: Tue Jun 19 00:48:28 2012 +0000 Move the support for using .init_array from ARM to the generic TargetLoweringObjectFileELF. Use this to support it on X86. Unlike ARM, on X86 it is not easy to find out if .init_array should be used or not, so the decision is made via TargetOptions and defaults to off. Add a command line option to llc that enables it. commit 8af669f2f1d92436fe6dc43144bb084a620e7516 Author: Rafael Espindola <rafael.espindola@gmail.com> Date: Tue Jun 19 01:26:10 2012 +0000 Add a -fuse-init-array option to cc1 and map to the UseInitArray target option. On the driver, check if we are using libraries from gcc 4.7 or newer and if so pass -fuse-init-array to the frontend. The crtbegin*.o files in gcc 4.7 no longer call the constructors listed in .ctors, so we have to use .init_array.
Loading
Please sign in to comment