Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[R+D]Native GCC 4.6.0 + Binutils 2.22 ----- Bionic Arms Attached :)

$
0
0
Hi Folks

Here's a native Bonic GNU GCC ( 4.6.0 ) + BinUtils ( 2.22 ) compiled for armv7-a with c and c++ support!

Testing:
I used an HTC Sensation running CM9 for testing
[EDIT:] Using JB 4.2.1 on a Nexus 7 causes a segmentation fault when trying to compile...... Investigation Continues!

Installing:
Download and unpack this archive [ bionic_gcc_binutils.7z ]
copy the directories to the /system directory ,
adb push whilst in the directory you extracted the download to should do the trick
adb push . /system

Test the gcc
Code:

adb shell gcc /system/usr/src/hello.c -o /system/bin/hello
adb shell hello
HELLO OUTPUT: Hello Bionic

Check the Dynamic Linker
Code:

adb shell readelf -l /system/bin/hello | grep 'linker'
OUTPUT: [Requesting program interpreter: /system/bin/linker]

The GNU linker - ld
ld currently only has one search path by default, that is /system/lib, you must manually set links to other location ( i.e /vendor/lib )

Getting Help - RTFM ( Read The F***king Manual )
No seriously the man and info pages can be found in the share directory in the archive

Personal Thoughts
Although GCC is a very mature project, I'd still consider this as PRE-ALPHA R&D as I'm certainly not an expert when it comes to toolchains etc. I basically used a bruteforce attack to build this. which involves compile - test - tweak/fix - rinse - repeat and stop when it looks about right :) So I could have quite easily misconfigured a compiler flag or patch a file in an inappropriate manner which may manifest itself further down the line.

I suppose the acid test would be to try and compile the linux kernel using this toolchain.

I had a search around to see if this had already been covered, It looks like the C4Droid project has it covered, at a cost!! but I do see the question on native compilation come up every now and again so hopefully this should help some folks out at least.

Viewing all articles
Browse latest Browse all 3614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>