Rebuild Android NDK v5 with PIC

RESOLVED INVALID

Status

RESOLVED INVALID
8 years ago
5 years ago

People

(Reporter: mwu, Assigned: bear)

Tracking

(Blocks: 1 bug, {mobile, perf})

other
All
Android
mobile, perf
Dependency tree / graph

Firefox Tracking Flags

(fennec+)

Details

(Whiteboard: [ts][mobile], mobilestartupshrink)

(Reporter)

Description

8 years ago
I'd like to get the NDK rebuilt with -fPIC so we can remove most of the text relocations in the libraries we build on Android. Text relocations slow down startup and increase memory usage.

I basically did this to get it building with -fPIC:

--- a/build/tools/patches/005-flags.patch
+++ b/build/tools/patches/005-flags.patch
@@ -6,8 +6,8 @@ index 670b620..06c95e9 100644
  LDFLAGS_FOR_TARGET=-mandroid
  
  CFLAGS_FOR_TARGET+= -DANDROID -D__ANDROID__
-+CFLAGS_FOR_TARGET+= -fexceptions
-+CXXFLAGS_FOR_TARGET+= -frtti
++CFLAGS_FOR_TARGET+= -fexceptions -fPIC
++CXXFLAGS_FOR_TARGET+= -frtti -fPIC
  
  # Helper
  prefix-list = $(foreach e, $(2), $(join $1, $e))

I followed the latest instructions on the crystax site to build it. (which are a little different now.. the source pulling part pulls code from a specific date now)
(Reporter)

Updated

8 years ago
Depends on: 616061
(Assignee)

Updated

8 years ago
Assignee: nobody → bear
(Reporter)

Updated

8 years ago
Duplicate of this bug: 646843
From bug 646843:

Mike Hommey [:glandium]:

Currently libgcc.a and libstdc++.a are not built as PIC. From my experiments,
this should get us between 2 and 5% less time spent before main(), provided bug
646815 is fixed as well.
Whiteboard: [fennec-4.1?]
Bear - What's the status here?
tracking-fennec: --- → ?
Whiteboard: [fennec-4.1?]
(Assignee)

Comment 4

7 years ago
(In reply to comment #3)
> Bear - What's the status here?

it's on my task list.  right now i'm buildduty and will get back to it after buildduty.
tracking-fennec: ? → 7+
Blocks: 622908
Keywords: mobile, perf
Whiteboard: [ts]
Bear is working on deploying the r5 NDK via puppet right now (Bug 657723). Once that's done, we'll revisit this bug and re-compile r5 with -fPIC.
From bug 646843:

From my experiments, all that is needed is to add --with-pic as a compile option to gcc (which I did through build/tools/build-gcc.sh), and add -fPIC to libgcc config options (which I did through the TARGET_LIBGCC2_CFLAGS variable in src/gcc/gcc-4.4.0/gcc/config/arm/t-arm-softfp, though there's probably a better place)
Whiteboard: [ts] → [ts][mobile]
tracking-fennec: 7+ → +
Whiteboard: [ts][mobile] → [ts][mobile], mobilestartupshrink
(Assignee)

Updated

7 years ago
Summary: Rebuild Android NDK with PIC → Rebuild Android NDK v5 with PIC
(Assignee)

Comment 7

7 years ago
edited bug title to be very clear that we will be compiling only the r5 NDK with -fPIC support
glandium noted in IRC that PIC support may already be in NDK5.
(Assignee)

Comment 9

7 years ago
yep, good catch - according to

http://groups.google.com/group/android-ndk/browse_thread/thread/9fd148aa92a6fab6

PIC is available and enabled by default with NDK5
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
Product: mozilla.org → Release Engineering
You need to log in before you can comment on or make changes to this bug.