Re: Unrecognised option '--icf=safe' when compiling with Android-ndk-r7 and Android-ndk-r6

1,109 views
Skip to first unread message

Bart Van Bos

unread,
Mar 5, 2013, 2:27:17 PM3/5/13
to andro...@googlegroups.com
@Khatri

In the mean while I have found the problem with the missing '--flag icf=safe'.

This flag is used by the optimized ELF linker from google called Gold. Gold was developed by a small team at Google. The motivation for writing gold was to make a linker that is faster than the GNU linker ld.bdf, especially for large applications coded in C++. The gold linker can be found as ld.gold binary in your cross compilation toolchain. I suspect you will only have the ld.bdf over there.


The fact the it is not available in NDK 6 and 7, means that Google did not deliver it in there cross toolchain provided in the NDK. A possible solution would be to compile your own toolchain with gold support.

BR,
Bart

On 2 March 2013 00:09, Bart Van Bos <bartv...@gmail.com> wrote:
I have the same problem trying to compile the latest android-4.2.2_r1.

I try to compile 'lunch full-eng'. I am using my own gcc 4.7 cross compilation toolchain build from source (a 32 bit one, since I did not have 64 machine). I did had to make some minor changes in the build/core/ and prebuilts/tools/gcc-sdk/gcc folder in order to get this 32 bit toolchain selected properly, but that went smoothly in the end.

Using the --help options on both 4.6 (64 bit toolchain by default in prebuild folder for ARM) and 4.7 did not show the option as being available.

Any idea on this one really appreciated.

BR,
Bart

Op vrijdag 10 augustus 2012 10:07:49 UTC+2 schreef Saurabh Khatri het volgende:
I could successfully compile my project with Android-ndk-r8 but with Android-ndk-r6 and Android-ndk-r6 i got the following error at the time of linking.

arm-2009q1-203-arm-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: unrecognized option '--icf=safe'
arm-2009q1-203-arm-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status

This flag is used for code size reduction, as the file that uses this flag mentions:
         "-Wl,--icf=safe',  # Enable identical code folding to reduce size"

If i remove this flag my project compiles even with Android-ndk-r7 and Android-ndk-r6, but i do not want to remove this flag as it is code size optimization.

1. Is this flag --icf=safe a new addition in Android-ndk-r8?
2. I want to add this flag to my Android-ndk-r(7/6). How and where can i implement it?

--
You received this message because you are subscribed to a topic in the Google Groups "android-ndk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-ndk/xfBZRZpJLPE/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

David Turner

unread,
Mar 5, 2013, 7:39:10 PM3/5/13
to andro...@googlegroups.com
I don't remember arm-2009q1-203-arm-none-linux-gnueabi being part of any NDK release :-) It seems you're using the wrong linker, for some reason. Maybe there is some issue with your setup.

On Fri, Aug 10, 2012 at 1:07 AM, Saurabh Khatri <sunnyshin...@gmail.com> wrote:
I could successfully compile my project with Android-ndk-r8 but with Android-ndk-r6 and Android-ndk-r6 i got the following error at the time of linking.

arm-2009q1-203-arm-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: unrecognized option '--icf=safe'
arm-2009q1-203-arm-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status

This flag is used for code size reduction, as the file that uses this flag mentions:
         "-Wl,--icf=safe',  # Enable identical code folding to reduce size"

If i remove this flag my project compiles even with Android-ndk-r7 and Android-ndk-r6, but i do not want to remove this flag as it is code size optimization.

1. Is this flag --icf=safe a new addition in Android-ndk-r8?
2. I want to add this flag to my Android-ndk-r(7/6). How and where can i implement it?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/youbhl-F-csJ.

To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

Reply all
Reply to author
Forward
0 new messages