Replace the complicated rules in Make with calls the same strip.sh
script that Soong uses.
Bug: 113936524
Test: m checkbuild
Change-Id: If7beeb8381b5a9bc6e9ba15d443a834eb43fc0d4
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
* 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
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
* 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
* 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
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
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
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)
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
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
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
So that we can disable only one in multilib modules.
Bug: 27442756
Change-Id: I4ca379fac997f9165c47cb93d34bf1f483f5a241
(cherry-pick from commit b6eb8ddbde)
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
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
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
When BREAKPAD_GENERATE_SYMBOLS is set to true, generate breakpad
symbols for binaries.
Bug: 23900817
Change-Id: I7b992d819350f4f80df5868d16f13016502dfca0
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)
Add replocation-packer step for dynmic executables.
Enable it by default for arm and arm64 platforms.
Bug: http://b/18051137
Change-Id: I0c88fd31595bcea62a087f219acb9ecf9c80f2e5
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)
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
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
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
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
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
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
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
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
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
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
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
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
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