Commit graph

55 commits

Author SHA1 Message Date
Colin Cross
3e87e83557 Give strip depfile a unique name, properly include it
$(LOCAL_BUILT_MODULE).d may conflict with the .d file for a .o file,
use $(LOCAL_BUILT_MODULE).strip.d.  Also pass the required second
arg to include-depfile.

Bug: 148387048
Test: m checkbuild
Change-Id: I1f5f4c38010294a12d6777439b0f66c0102c1c96
2020-01-27 22:06:21 +00:00
Colin Cross
70bfe07e6c Support injecting boringssl hash in Make
Add LOCAL_INJECT_BSSL_HASH for the two modules in Make that
statically link libcrypto.

Bug: 137267623
Test: m checkbuild
Change-Id: I5d21c262ff388aeb2dbd02595706c5531a628b7e
2019-09-05 15:31:31 -07:00
Yi Kong
9e86573fd1 Use llvm-{strip,objcopy} by default
... except for Darwin Mach-O, as it is not supported by llvm-strip.

Test: m checkbuild
Bug: 119221035
Change-Id: I492853486e49dd0e82abe60cbf354d79b760b9a7
2019-01-30 13:40:44 +00:00
Colin Cross
830eed81ab Use build/soong/scripts/strip.sh for Make modules
Replace the complicated rules in Make with calls the same strip.sh
script that Soong uses.

Bug: 113936524
Test: m checkbuild
Change-Id: If7beeb8381b5a9bc6e9ba15d443a834eb43fc0d4
2018-09-10 11:05:32 -07:00
Colin Cross
979f9f9b18 Disable standalone relocation packer
We only support relocation packing inside lld now, remove calls to
the standalone relocation packer.  Any shared library built with
LOCAL_USE_CLANG_LLD := false will no longer have relocation packing.

This will also prevent relocation packing on prebuilt shared
libraries.

Also enables relocation packing on Darwin since lld will work on
Darwin.

Bug: 110715614
Test: m checkbuild
Change-Id: Ib4d4bc86f164d05dd78455c8e7605d4b4f5a2a77
2018-06-26 00:35:46 +00:00
Chih-Hung Hsieh
9546d67fe9 Use llvm-{objcopy,strip} when clang lld is used.
* PRIVATE_OBJCOPY is still set to objcopy and used
  when llvm-objcopy cannot replace objcopy.

Bug: 80093681
Test: build/boot with USE_CLANG_LLD=true
Change-Id: I4bd8a53f74864b49e007f0c5f1b0f4b16e121135
2018-06-06 15:09:58 -07:00
Chih-Hung Hsieh
9020c2323b Skip copying files from LINKED to PACKED directories.
When stand-alone relocation_packer is not used,
use the LINKED file and skip the copy to PACKED directory.

Test: make checkbuild
Change-Id: Ia1e5d1cd22ca6dfb68e406ffdcbb367b4d07d437
2018-06-01 14:11:15 -07:00
Chih-Hung Hsieh
289e8d6011 Call lld with --pack-dyn-relocs=none if my_pack_module_relocations is false
* Factor out the logic that sets up my_pack_module_relocations
  from dynamic_binary.mk to pack_dyn_relocs_setup.mk.
* Use stand-alone relocation_packer only if my_pack_module_relocations
  is true and my_use_clang_lld is false.

Bug: 80093890
Bug: 73768157
Test: build and boot with USE_CLANG_LLD=true
Change-Id: I7c4b5fcdce0754c57cff4acf86185cac65a26c40
2018-05-31 16:18:22 -07:00
Chih-Hung Hsieh
32427d6903 Add USE_CLANG_LLD and LOCAL_USE_CLANG_LLD
* Current default is not using lld.
* When USE_CLANG_LLD or LOCAL_USE_CLANG_LLD is true or 1,
  * Use *GLOBAL_LLDFLAGS instead of *GLOBAL_LDFLAGS.
    GLOBAL_LLDFLAGS should call lld and with correct lld flags.
  * set my_pack_module_relocations to false.

Bug: 73768157
Test: make checkbuild
Change-Id: I3e63cf8ae0865d01d2bc1f36e9304f4a5d092cb8
2018-04-12 11:00:06 -07:00
Rahul Chaudhry
4cf8458734 Revert "Disable relocation_packer and migrate to SHT_RELR sections."
This reverts commit dbf3bfffc6.

Reason for revert: New Build Breakages in git_pi-dev-plus-aosp-without-vendor/aosp_walleye-userdebug and git_pi-dev-plus-aosp/aosp_crosshatch-userdebug

Change-Id: I75b968c94df33a25e91a4aa1c55435a6b8b4268b
2018-03-23 19:02:36 +00:00
Rahul Chaudhry
dbf3bfffc6 Disable relocation_packer and migrate to SHT_RELR sections.
Proposal for adding SHT_RELR sections in the generic-abi is at
https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg

Comparison with relocation_packer for aosp_marlin-userdebug:
$ du -B1 -s */out/target/product/marlin/system
 996958208      base/out/target/product/marlin/system
1008340992      no_pack/out/target/product/marlin/system
 997801984      sht_relr/out/target/product/marlin/system

base contains a build with current settings.
no_pack contains a build with relocation_packer disabled.
sht_relr contains a build with SHT_RELR sections enabled.

relocation_packer was saving 11,382,784 bytes (no_pack - base).
SHT_RELR sections are saving 10,539,008 bytes (no_pack - sht_relr).

Bug: None
Test: Built aosp_marlin-userdebug image, boots on device.
Test: Built aosp_x86_64-userdebug image, boots in emulator.
Change-Id: Ic753abecb77863c64996157c543c344e66f0f4dd
2018-03-22 15:14:40 -07:00
Dan Willemsen
893859573d Use xz prebuilt
Instead of whichever xz happens to be on the PATH.

Bug: 36130900
Test: m
Change-Id: Ib37d8db4e935ef8f69f3d43b5065c22d34028cf3
2018-03-09 12:56:01 -08:00
Steve Fung
445beae409 Only generate breakpad symbols for ELF binaries
When BREAKPAD_GENERATE_SYMBOLS is set to true, the build will attempt
to run dump_syms for all dynamic binaries.  However some build targets
are now using cc_prebuilt_binary for installing python host scripts.
This causes dump_syms to return an error, causing the build to fail.
So check instead if the file is an ELF binary before running dump_syms.

Bug: 65065674
Test: Built AT target successfully.
Merged-In: Ibe7d3ebd312376600cf21efa111489451a4e7578
Change-Id: Ibe7d3ebd312376600cf21efa111489451a4e7578
(cherry picked from commit ee848655db)
2017-08-31 15:57:44 -07:00
Dan Willemsen
50e8753686 Use installed module stem for .so soname
So that the SONAME will match the actual installed name. This allows two
shared libraries (with different LOCAL_MODULE names) to be built with
the same name, but in different locations. So to partially emulate
Soong's vendor_available, you could define:

  include $(CLEAR_VARS)
  LOCAL_MODULE := libmyutils
  ...
  include $(BUILD_SHARED_LIBRARY)

  include $(CLEAR_VARS)
  LOCAL_MODULE := libmyutils_vendor
  LOCAL_VENDOR_MODULE := true
  LOCAL_INSTALLED_MODULE_STEM := libmyutils.so
  ...
  include $(BUILD_SHARED_LIBRARY)

All of the users would need to explicitly use libmyutils vs
libmyutils_vendor based on how their runtime lookup paths are going to
work, but it will install into both places:

  /system/lib/libmyutils.so
  /vendor/lib/libmyutils.so

Bug: 38225484
Test: Example similar to above, ensure DT_NEEDED / DT_SONAME are correct
Test: multiproduct_kati to verify the only module this changes on
      master is libart_fake
Change-Id: Ifa4b8adff50d8b5a754c70ce8e865b05f9889c6c
2017-05-19 14:30:12 -07:00
Dan Willemsen
7fe992c0cc Add NATIVE_TESTS class, move host native tests
Host native tests have been getting installed into
out/host/linux-x86/bin/..., but this pollutes the bin directory with a
lot of poorly named tests. Also, to support 32-bit and 64-bit tests, we
need to have different names with different suffixes. This causes
problems when tests expect to be named something specific (like gtest).
It's also convenient to store test data next to the test itself.

So with this change, native tests will be installed in
out/host/linux-x86/nativetest[64]/$(LOCAL_MODULE)/$(LOCAL_MODULE_STEM)
just like target tests get installed into /data/nativetest[64].

Implement this using a new NATIVE_TESTS class, which is like
EXECUTABLES, but sets up the install path differently, and configures
the rpath to load shared libraries with the proper relative path.
LOCAL_MODULE_RELATIVE_PATH can be used to control the directory name, it
will default to $(LOCAL_MODULE). This way multiple related tests can be
grouped together.

Target native tests also use NATIVE_TESTS now, but nothing should change
other than LOCAL_MODULE_RELATIVE_PATH can be used.

Change-Id: I535e42b1a6b21c5b8d6a580aa2f944d2be35e27d
2016-05-24 12:43:16 -07:00
Yabin Cui
700883eadd Use strip mode mini-debug-info by default except on mips.
Bug: 27923447
Change-Id: I818dea44f126155b4b9b3cd929823d8eda1a1174
2016-04-26 17:39:59 -07:00
Yabin Cui
3aa7df592b Revert "Use strip mode mini-debug-info by default."
This reverts commit 0e131e7e2c.

breaks in aosp_mips-eng

Change-Id: I468b0a47c878ffde9afc78442e8d4f0dabf7eb6e
2016-04-19 03:38:34 +00:00
Yabin Cui
0e131e7e2c Use strip mode mini-debug-info by default.
Bug: 27923447
Change-Id: If52eed69ea5c2e91bffacdb8520bf53deafced3e
2016-04-15 17:42:17 -07:00
Yabin Cui
fab7995cd8 Add strip mode mini-debug-info.
Mini-debug-info strip mode strips most debug information, but
maintains minimal debugging information similar to
https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html.

Bug: 27923447

Change-Id: I0405f0b3c33cb3cadeafbd22ce94d645c4dbe7b9
2016-04-15 16:12:00 -07:00
Ying Wang
6efe88ba95 Support arch specific variants of LOCAL_STRIP_MODULE/LOCAL_PACK_MODULE_RELOCATIONS
So that we can disable only one in multilib modules.

Bug: 27442756
Change-Id: I4ca379fac997f9165c47cb93d34bf1f483f5a241
(cherry-pick from commit b6eb8ddbde)
2016-03-02 10:59:23 -08:00
Dan Willemsen
479311bc7c Remove LOCAL_ACP_UNAVAILABLE
Now that copy-file-to-target doesn't use acp, nothing in the acp build
path uses acp, so we don't need to special case it to prevent loops.

Change-Id: I12810c1b064d0c03135a80077a76bc4c9cc18b24
2016-03-01 13:16:53 -08:00
Dan Willemsen
7f016150a0 Remove unused dependencies on $(ACP)
Most of these are calling to copy-file-to-target or similar, which no
longer use $(ACP).

Change-Id: I62287a80c577c34df587b74e70055c2f56050ce7
2016-03-01 13:15:35 -08:00
Dan Albert
52831d118c Allow globally disabling the relocation packer.
The relocation packer is part of prebuilts/misc, and pulling that
repository into the manifest requires pulling in a lot of other things
not needed by the simpler builds (like the clang toolchain manifest).

Bug: http://b/17441393
Change-Id: If4a94804fc1a3f81215b840247f8e332d0b510c1
2015-11-12 15:27:49 -08:00
Steve Fung
dfbab49bed Package breakpad symbols in target files zip
When BREAKPAD_GENERATE_SYMBOLS is set to true, package the breakpad
symbols into the target files zip thats generated with `make dist`.

Bug: 24165970
Change-Id: I11c0d9a9d9e159475bfdb7bc338f9e9ac60aeada
2015-09-25 18:34:15 -07:00
Steve Fung
cb2e67fdb7 Generate breakpad symbols
When BREAKPAD_GENERATE_SYMBOLS is set to true, generate breakpad
symbols for binaries.

Bug: 23900817
Change-Id: I7b992d819350f4f80df5868d16f13016502dfca0
2015-09-24 16:49:40 -07:00
Dmitriy Ivanov
e24b6f77ff Do not pack relocations for executables
Bug: http://b/20665974
Change-Id: Ibc13b5d6bd05dfbc7ff8475068fe7363f58e7e67
2015-05-07 13:10:02 -07:00
Dmitriy Ivanov
86bd653f70 Pack module before making symbolic version
We need PT_LOAD segments to match for the gdb sake.
  If we pack module after stripping symbolic version
  PT_LOAD differ from actual ones; this confuses gdb.

Bug: http://b/20687795
Change-Id: If7b1ffcda918d0cc47051a30ca1202007ed62403
(cherry picked from commit 258b29cf76)
2015-05-04 13:13:01 -07:00
Dmitriy Ivanov
4c2d1a64fb Pack relocation tables for dynamic executables
Add replocation-packer step for dynmic executables.

  Enable it by default for arm and arm64 platforms.

Bug: http://b/18051137
Change-Id: I0c88fd31595bcea62a087f219acb9ecf9c80f2e5
2015-04-23 12:07:16 -07:00
Dimitry Ivanov
1eca10fa9d Revert "Pack relocation tables for all dynamic executables"
This reverts commit e7a1b8a0c6.

Change-Id: I1a2185e1c68d364941e3b3e525a8c4a7a42e0cc1
2015-04-23 04:22:33 +00:00
Dmitriy Ivanov
e7a1b8a0c6 Pack relocation tables for all dynamic executables
Bug: http://b/18051137
Change-Id: I277277d5f5eb450ef9b4a23cfec16d75d977eb89
2015-04-22 13:30:43 -07:00
Dmitriy Ivanov
4eb120b999 Remove unsupported *_COMPRESS_MODULE_SYMBOLS
Change-Id: Ibb7da2997a0bb5b9f435213c9d3206bc4aad18db
2015-04-20 12:24:12 -07:00
Ying Wang
c1729f3602 Strip prebuilt shared library by default.
Strip prebuilt shared library but not try adding gnu debuglink.
It would fail if you try run the adding gnu debuglink command if a
prebuilt is already stripped.

Bug: 17177288
Change-Id: If5811865715c2437e45fbd329983ef1212ef0109
(cherry picked from commit bfb52a2ec1)
2015-03-13 11:36:15 -07:00
Ying Wang
98ae798535 Fix using variable intermediates.COMMON before defining.
In commit e9dd9f2bf we moved "include $(BUILD_SYSTEM)/android_manifest.mk"
forward before the variable intermediates.COMMON gets defined. That's a
mistake.
This change replaced the tentative variables
package_expected_intermediates_COMMON and guessed_intermediates with
their proper counterparts defined in base_rules.mk.
If their values differ in the two file, that's an error and we should
fix.

Bug: 18168693
Change-Id: I2bf17b0476b4a7f97810fbb0bde7630eb8878b53
2014-12-18 15:13:04 -08:00
Ying Wang
d8c5ca9e0d Allow to strip everything for only some build variants.
When LOCAL_STRIP_MODULE is keep_symbols, you can still use
STRIP_EVERYTHING_BUILD_VARIANTS in product configuration to strip
everything for some build variants, such as user build to save image
space.

Bug: 16897368
Change-Id: I2a1b7204e5c976387ddea8846c82e11a7b478d8d
2014-08-10 16:19:04 -07:00
Ying Wang
966c1e0cae Add HOST_PREFER_32_BIT to support 32-bit-by-default multilib build
We already support pure 32-bit and 64-bit-by-default multilib build.
With HOST_PREFER_32_BIT we can build 32-bit-by-default multilib build.
This will be lest disruptive during the period we transition to
64-bit-by-default.

Bug: 13751317
Change-Id: I0d56ce4abbe4afeaacfd70d709f6a349791c0722
2014-05-20 18:03:21 -07:00
Ying Wang
6feb6d5607 Support host multilib build
This change basically ported our target multilib to the host side.
It supports 2 host build modes: x86 and x86_64 multilib build.
For now you need to set "BUILD_HOST_64bit=true" to switch to x86_64
multilib build. Later we'll default to x86_64 build and have a flag
to force 32-bit only build, which may be needed by SDK build.

In host module definition, like in target ones, you can use the
following
LOCAL variables to set up multilib configuration:
LOCAL_MULTILIB: can be "both", "first", "32" or "64".
It also supports the same set of arch or 32-vs-64 specific LOCAL
variables.
By default, it builds only for the first arch.

To keep path compatibility, in x86_64 build files are still output to
out/host/linux-x86; Both 32-bit and 64-bit executables are in
out/host/linux-86/bin;
In x86_64 build 32-bit shared libraries are installed to
out/host/linux-x86/lib32
and 64-bit shared libraries are installed to out/host/linux-x86/lib;
32-bit object files are output to out/host/linux-x86/obj32 and 64-bit
object files
are output to out/host/linux-x86/obj.

Bug: 13751317
Change-Id: I6044f83b7db369a33e05209e8c588eb6dc83409f
2014-05-14 16:55:04 -07:00
Colin Cross
5a9db90e40 add support for LOCAL_MODULE_STEM_32 and LOCAL_MODULE_STEM_64
Some executables will need to be built for both 32-bit and 64-bit.
For linker/linker64, debuggerd/debuggerd64, and a few more, they
will be installed in the same path (/system/bin), but with different
filenames.  Allow the module to specify LOCAL_MODULE_STEM_32 and
LOCAL_MODULE_STEM_64 to name the two versions.

Change-Id: I573e8678c7332245a064f31246be0a05f0a9e25f
2014-03-25 13:49:58 -07:00
Christopher Ferris
a6e2f9322c Add a method to leave the symbol table in a library.
When LOCAL_STRIP_MODULE := keep_symbols is set, then the normal strip rules
will be modified so that only the .debug_* sections are removed. The original
symbol table is left alone.

This allows the compilation of certain libraries so that libbacktrace library
can provide meaningful names to functions.

Bug: 12958251
Change-Id: I82bdc304a463012e29086325ccb51163464cb4a9
2014-03-18 17:34:41 -07:00
Ying Wang
e1889af2d5 Don't modify LOCAL_STRIP_MODULE
LOCAL_STRIP_MODULE will be reused in multilib build.

Change-Id: I3512efb360c7eaafad02859723ab4368778effed
2014-03-16 12:43:49 -07:00
Ying Wang
b8e0185489 Support arch-specific LOCAL_ variables
With those variables, you can set up different values for TARGET_ARCH
and TARGET_2ND_ARCH.
Also fixed a couple of variables.

Bug: 11654773
Change-Id: I4c7684a562cd5877d18f67d4f848b8df07d0103b

Conflicts:
	core/base_rules.mk
2014-01-24 13:38:34 -08:00
Ying Wang
4d2cc665ea Set up rules to build shared libraries for TARGET_2ND_ARCH
The rules for the 2nd arch are set up in the second inclusion
of shared_library_internal.mk.
Intermediate fils of libfoo of the 2nd arch will be built into
$(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)/SHARED_LIBRARIES/libfoo_intermediates/
and the built libfoo.so will be in
$(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)/lib.

Bug: 11654773
Change-Id: I58bbe5a05a65f63bce6279131552f3792000716e
2014-01-24 13:35:30 -08:00
Ying Wang
1d274d2686 Load compiler environment for a second arch.
This is the first step to build 32-bit libraries in a 64-bit product.
It will work like this:
1) In the product's BoardConfig.mk, define:
TARGET_2ND_ARCH, TARGET_2ND_ARCH_VARIANT, TARGET_2ND_CPU_VARIANT.
The build system uses those variables to set up an additional compiler
environment for the second arch.

2) When parsing Android.mks, the build system sets up rules to build a
module for both the 1st arch and the 2nd arch, unless it's explicitly
asked to skip so.
Android.mk will be adapted if there is additional rule of generating
source files.
The build system will accept arch-specific LOCAL_ variables, such as
LOCAL_CFLAGS_arm, LOCAL_CFLAGS_armv7-a-neon, LOCAL_CFLAGS_cortex-a15,
LOCAL_CFLAGS_aarch64 etc. Modules use such variables to set up build for
various archs at the same time.

3) Install binary of the 2nd arch by adding "<module_name>:32" to
PRODUCT_PACKAGES. All 2nd-arch libraries linked in by "<module_name>:32"
will be installed automatically.

Bug: 11654773
Change-Id: I2df63cd5463a07bf5358bee2a109f8fb9590fe30

Conflicts:
	core/combo/TARGET_linux-arm.mk
2014-01-24 13:34:26 -08:00
Ying Wang
f3584968ff Simplify the calculation of LOCAL_UNSTRIPPED_PATH
Also this fixes the LOCAL_UNSTRIPPED_PATH if the module is installed to
the vendor dir via LOCAL_PROPRIETARY_MODULE.

Bug: 11289169
Change-Id: Ib07e5761411210963076487fe0e148c259e1e082
2013-12-18 10:41:01 -08:00
Ying Wang
2408479cf9 Allow module to specify LOCAL_INSTALLED_MODULE_STEM
With this change, you can install a shared library with module name foo
as bar.so to the system.img with:
LOCAL_INSTALLED_MODULE_STEM := bar.so
Note that we in general still disallow a static/shared library to
specify LOCAL_MODULE_STEM or LOCAL_BUILT_MODULE_STEM, because the build
system uses LOCAL_MODULE to compute build time dependencies, such as
export_includes, the -l linker flag etc.
Also, if you use LOCAL_INSTALLED_MODULE_STEM to change the installed
file name and if any other module links against this library, you may
run into runtime error: the library name baked in to the binary is not
the same as file name in the system image.

Change-Id: I55b571c8139c3bda07a4a0e50cea0f20d8d6c168
2013-09-25 12:30:59 -07:00
Ying Wang
eda6ac2487 Use += to append to target-specific PRIVATE_CLEAN_FILES
Instead of incorrectly including global variable PRIVATE_CLEAN_FILES

Change-Id: I9b5e12448dad5001de051a566d8a94a89b20ecac
2013-01-28 10:58:01 -08:00
Ying Wang
374b3256d2 Make a copy of symbol files after prelinking is removed.
Change-Id: I1628b54fc747154d48f213c634b081e43eb41696
2011-03-14 11:44:57 -07:00
Iliyan Malchev
b375e71d30 build: remove prelinker build build system
This patch removes support for prelinking from the build system.  By now, the
prelinker has outlived its usefulness for several reasons.  Firstly, the
speedup that it afforded in the early days of Android is now nullified by the
speed of hardware, as well as by the presence of Zygote.  Secondly, the space
savings that come with prelinking (measued at 17MB on a recent honeycomb
stingray build) are no longer important either.  Thirdly, prelinking reduces
the effectiveness of Address-Space-Layout Randomization.  Finally, since it is
not part of the gcc suite, the prelinker needs to be maintained separately.

The patch deletes apriori, soslim, lsd, isprelinked, and iself from the source
tree.  It also removes the prelink map.

LOCAL_PRELINK_MODULE becomes a no-op.  Individual Android.mk will get cleaned
separately.  Support for prelinking will have to be removed from the recovery
code and from the dynamic loader as well.

Change-Id: I5839c9c25f7772d5183eedfe20ab924f2a7cd411
2011-03-12 14:59:46 -08:00
Jeff Brown
703e7c6d50 Build system tweaks for Valgrind.
Added LOCAL_NO_CRT to enable building executables that do not link
to the C runtime library.

Removed support for LOCAL_MODULE_SUBDIR since it was broken
and unused.  (Was going to use it but ended up using LOCAL_MODULE_PATH
instead.)

Change-Id: I3b6f5ab7e5ae6aaa7119899adccece2b4ab1cbb3
2011-02-08 16:38:56 -08:00
Ying Wang
90ca11a2d3 Fix the unstripped path if LOCAL_MODULE_PATH is set.
Bug: 2953067

Change-Id: I12a0bdb1f3df4fa98bea70f60e0ce26bf863c924
2010-09-03 16:24:01 -07:00
Bruce Beare
45ac434151 Refactor Stripper. Allow a stripper other than SOSLIM to be specified
Change-Id: I61137f5bb123dc5f610af9928ed3debdf85ba74d
Signed-off-by: Bruce Beare <brucex.j.beare@intel.com>
2010-07-09 12:16:46 -07:00