platform_build_soong/cc
Rahul Chaudhry 1ffac8e636 Enable SHT_RELR sections to encode relative relocations.
Proposal for adding SHT_RELR sections in the generic-abi is at
https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg

This CL requires clang-r328903.

The following test results are on clang-r339409.

Size comparison for "aosp_marlin-userdebug":
$ du -B1 -s {none,pack,relr,both}/out/target/product/marlin/system
1014616064      none/out/target/product/marlin/system
1001074688      pack/out/target/product/marlin/system
1004273664      relr/out/target/product/marlin/system
1000099840      both/out/target/product/marlin/system

none contains a build with no packing (--pack-dyn-relocs=none).
pack contains a build with current settings (--pack-dyn-relocs=android).
relr contains a build with relr packing only (--pack-dyn-relocs=relr).
both contains a build with both options enabled (--pack-dyn-relocs=android+relr).

With --pack-dyn-relocs=android+relr, lld will encode the relative
relocations in a SHT_ANDROID_RELR section, and pack the rest of
the dynamic relocations in a SHT_ANDROID_REL(A) section.

--pack-dyn-relocs=android was saving us 13,541,376 bytes (1.35%) (none - pack).
--pack-dyn-relocs=relr will save us 10,342,400 bytes (1.03%) (none - relr).
--pack-dyn-relocs=android+relr is saving us 14,516,224 bytes (1.45%) (none - both).

Size comparison for the "system/bin" directory:
$ du -B1 -s {none,pack,relr,both}/out/target/product/marlin/system/bin
29413376        none/out/target/product/marlin/system/bin
28319744        pack/out/target/product/marlin/system/bin
28258304        relr/out/target/product/marlin/system/bin
28180480        both/out/target/product/marlin/system/bin

--pack-dyn-relocs=android was saving us 1,093,632 bytes (3.72%) (none - pack).
--pack-dyn-relocs=relr will save us 1,155,072 bytes (3.93%) (none - relr).
--pack-dyn-relocs=android+relr is saving us 1,232,896 bytes (4.19%) (none - both).

Bug: None
Test: Built aosp_marlin-userdebug image, boots on device.
Test: Built aosp_x86_64-userdebug image, boots in emulator.
Change-Id: Ibb726c3b9d87688f387a7f2974fdae9bfc24efc9
2018-10-22 20:29:39 +00:00
..
config Enable SHT_RELR sections to encode relative relocations. 2018-10-22 20:29:39 +00:00
libbuildversion Mark as recovery_available:true 2018-05-24 14:14:08 +09:00
androidmk.go Add ApexModule interface for APEX-aware modules 2018-10-11 11:19:07 +09:00
binary.go Remove GCC checks 2018-10-09 02:16:58 +00:00
builder.go Switch include path of header-abi-dumper headers 2018-10-11 17:11:34 +08:00
cc.go Add ApexModule interface for APEX-aware modules 2018-10-11 11:19:07 +09:00
cc_test.go Revert "Revert "Move libgcc to libcrt.builtins"" 2018-10-09 20:39:50 +00:00
check.go Allow macro definition with space 2017-10-19 22:39:32 +09:00
cmakelists.go Remove GCC checks 2018-10-09 02:16:58 +00:00
compdb.go Don't include empty-string arguments in compile_commands.json 2018-10-02 11:28:25 -07:00
compiler.go Remove GCC checks 2018-10-09 02:16:58 +00:00
coverage.go Revert "Support coverage instrumentation for Linux host" 2018-04-23 22:44:39 +00:00
gen.go aidl: -ninja -> --ninja 2018-07-06 11:36:32 -07:00
gen_stub_libs.py Better error message for multiple defined symbols. 2018-10-11 13:50:49 -07:00
gen_test.go Fix using aidl files from filegroups 2017-11-17 11:22:08 -08:00
genrule.go Add recovery_available to cc_genrule 2018-05-24 14:01:54 +09:00
installer.go Change bool, and string properties to *bool, and *string for cc 2017-11-07 15:57:16 -08:00
kernel_headers.go Fix double space in include argument 2018-10-02 11:16:56 -07:00
library.go Remove GCC checks 2018-10-09 02:16:58 +00:00
library_test.go Add cc_library tests 2017-11-17 11:22:04 -08:00
linker.go Add an option for libraries to opt out of libcrt 2018-10-10 15:56:14 -07:00
llndk_library.go Fix double space in include argument 2018-10-02 11:16:56 -07:00
lto.go Add USE_CLANG_LLD and use_clang_lld. 2018-04-12 14:37:35 -07:00
makevars.go Define HWADDRESS_SANITIZER_GLOBAL_OPTIONS. 2018-10-12 18:18:13 +00:00
ndk_headers.go Add a preprocessed_ndk_headers module type. 2018-06-01 11:02:38 -07:00
ndk_library.go Export cc module types and mutators needed for JNI testing 2018-10-08 15:20:56 -07:00
ndk_prebuilt.go Fix double space in include argument 2018-10-02 11:16:56 -07:00
ndk_sysroot.go NDK sysroot: include each license file only once 2018-08-24 13:28:04 -07:00
object.go Remove GCC checks 2018-10-09 02:16:58 +00:00
pgo.go Take Enable_profile_use into account when checking if PGO is enabled 2018-05-07 15:16:36 -07:00
prebuilt.go Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules 2018-09-10 23:12:12 -07:00
proto.go Add a dependency fixer for proto deps 2018-05-07 16:21:59 -07:00
pylintrc Don't warn for TODOish comments. 2016-08-01 14:36:22 -07:00
rs.go Mark generated renderscript header files as implicit outputs 2018-03-19 22:44:29 -07:00
sabi.go Remove flags from ClangLibToolingUnknownCflags 2018-10-16 17:52:12 +08:00
sanitize.go Define HWADDRESS_SANITIZER_GLOBAL_OPTIONS. 2018-10-12 18:18:13 +00:00
stl.go Change STL for Windows to libc++. 2018-10-10 20:09:37 +00:00
strip.go Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules 2018-09-10 23:12:12 -07:00
test.go Add an isolated option for cc_test targets. 2018-09-27 22:23:13 -07:00
test_data_test.go Fix go vet issues 2018-07-22 21:18:45 -07:00
test_gen_stub_libs.py Better error message for multiple defined symbols. 2018-10-11 13:50:49 -07:00
tidy.go Remove GCC checks 2018-10-09 02:16:58 +00:00
toolchain_library.go Remove GCC checks 2018-10-09 02:16:58 +00:00
util.go Remove GCC checks 2018-10-09 02:16:58 +00:00
util_test.go Allow cc_prebuilt version suffix to include svn 2018-09-26 10:59:56 +08:00
vendor_public_library.go Allow platform modules to link to vendor public libraries 2018-03-30 12:59:06 +09:00
vndk.go Improve messages for VNDK dependency errors. 2018-10-16 10:38:57 +01:00
vndk_prebuilt.go Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules 2018-09-10 23:12:12 -07:00