The __BIONIC_NO_PAGE_SIZE_MACRO flag has to be passed to
the build system because there are C/C++ libraries using
__BIONIC_NO_PAGE_SIZE_MACRO to decide whether to use getpagesize()
or PAGE_SIZE macro.
Bug: 333973679
Test: Build manually
Change-Id: Ie5d71f4b2b256ab8f429ed4724b8d249b364d5da
There was infrastructure to export ninja variables to bazel. Now that
the bazel migration is cancelled, we don't need it anymore.
Bug: 315353489
Test: m nothing
Change-Id: I298cc2ac7ebd004557be3b30d75f7357cab0b7a0
The default compilation behavior is set to be the future direction,
and a flag is set for backwards compatibility.
Bug: 312546062
Test: build/boot
Change-Id: Ibf87cbb2ab5da8640bcf7eb5f8cd643bf500e2e5
We fixed the clang driver to "do the right thing" based on target api level years ago, but these manual workarounds predate that (or were copy & pasted from places that predated that). We don't need them any more.
See https://github.com/android/ndk/issues/2005 for more detail.
Change-Id: I995741b8606e389e8de8272f1cc532624516245a
To suport >4KB page sizes, the loader may extend LOAD segment mappings
to be contiguous in the virtual address space. This is done in order to
reduce the use of unreclaimable kernel slab memory for the otherwise
necessary gap VMAs (when the runtime-page-size < ELF-segment-p_align).
Such mappings may beyond the end of the backing file when extended;
which breaks the common userspace assumption that file memory maps are
entirely backed by the underlying file.
Existing apps (not yet updated for larger page size support) may
encounter breakages if they parse /proc/self/[s]maps and use the
[start, end] addresses to operate on system libraries that have
crt_pad_segment optimization (VMA extension) [1].
In order to avoid breaking exisiting apps, update the build system to
ensure the platform ELFs' segments are entirely backed by the file
even when the VMA is extended to be contiguous with the subsequent
segment's. This is achieved using the linker flag
-z separate-loadable-segments, which inserts enough padding (zeros)
to also align each segment's offset on file by it's p_align
(max-page-size).
Although laying out the ELF segments on disk to respect the p_align
causes an increase in the file's apparent size (i_size), on Android the
actual disk usage increase is not significant due to most of the padding
being zero blocks which don't get alloacted in the read-only partitions.
The following results were obtained on an ARM64 device on a recent
git_main build:
No Separate Separate Delta Delta % Partition
Loadable Loadable
Segments Segments
4208.90MB 4214.6MB 5.70MB 0.14% All RO Partitions
Note: The overhead of -z separate-loadable-segments is minimized by the
fact that ARM64 android already builds with -z separate-code. [2]
[1] https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/arch-common/bionic/crt_pad_segment.S
[2] 733198152d:build/soong/cc/config/arm64_device.go;l=53
Bug: 328797737
Test: Manually test previously crashing application
Change-Id: Icb14ad10b5c9282855d54c7945b065b7b4184163
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
For chromebooks, we need a new build variant whose target arch is
goldmont, but without SHA and XSAVES support (b/314243939#comment21)
Bug: 314243939
Test: Build an image with TARGET_ARCH_VARIANT:=goldmont-without-sha-xsaves
Change-Id: If73660b515b443d5c138ca367fa3d1c6f18485b5
Its target arch is goldmont, but without xsaves support.
This ensures efficient execution on a broad range of Intel/AMD CPUs used
in Chromebooks, including those lacking xsaves support.
(e.g. Kaby Lake, Gemini Lake, Alder Lake and AMD Zen series)
Bug: 314243939
Test: Build an image with TARGET_ARCH_VARIANT:=goldmont-without-xsaves
Change-Id: I9963cc3356394815f068fc998a9708bdb30c8266
This is part of a larger change to update the flag
PRODUCT_PAGE_SIZE_AGNOSTIC to PRODUCT_NO_BIONIC_PAGE_SIZE_MACRO.
This is to help clarify that this flag doesn't mean the device
will actually work end-to-end with any page size.
Bug: 312541564
Test:
```
source build/envsetup.sh
lunch aosp_cf_arm64_phone_pgagnostic-trunk-userdebug
m
cat out/soong/build.aosp_cf_arm64_phone_pgagnostic.ninja | grep __BIONIC_NO_PAGE_SIZE_MACRO
```
Change-Id: I33033876d0d4a276d1bb962d40315b71a3968c66
To simulate 16k page size in x86-64 cuttefish, it is necessary
to compile the shared libraries and binaries with max-page-size greater
than 4096.
Bug: 309816695
Test: source build/envsetup.sh
lunch aosp_cf_x86_64_phone_pgagnostic-trunk-userdebug
m
Change-Id: I32670ef2c25fdcefec11bd07ba41cd0ea96c92bd
To simulate 16k page size in x86-64 cuttefish, it is necessary
to compile the shared libraries and binaries with max-page-size greater
than 4096.
Bug: 309816695
Test: source build/envsetup.sh
lunch aosp_cf_x86_64_phone_pgagnostic-trunk-userdebug
m
readelf -l out/target/product/vsoc_x86_64_only/system/bin/toybox
Change-Id: I38e4449a7826a2eca0c1a1cccc916af21f0b3a93
Remove Toolchain.GccRoot, Toolchain.GccVersion, and Toolchain.GccTriple
that were only used by an unused function. This removes most of the
references to GCC, although there are still some left in the host
toolchains.
Test: No change to build.ninja for aosp_cf_x86_64_phone-userdebug or aosp_raven-userdebug
Change-Id: I72b8af1f9aa83e6e15c9e00ed1e817b6cc3a031a
Most of the variable export code for cc modules can be re-used for
exporting variables for java modules. Refactor this code into a more
composable structure for reuse.
Test: build/bazel/bp2build.sh
Test: manual comparison of
out/soong/soong_injection/cc_toolchain/constants.bzl
with previous output
Change-Id: Ie5a6fee08cc888b7dc69c3e324e5c3f8aa269a8f
Previously this would result in a Ninja variable lookup, instead, let's
error sooner in Soong.
Test: CI
Change-Id: Ib3e15dce84364e6f7a83b82cb5f0e8694ffc9d2a
Rename the ninja variables that have an extraneous Clang in the name,
since there are no longer any non-Clang variables.
Bug: 68947919
Test: no change to command lines used to build mmma bionic
Change-Id: I081d5e1d423a66d55faece6cb1d265cd5e504d5f
Remove cflags that are not handled by clang from the global defaults,
and remove calls to ClangFilterUnknownCflags.
Squash lists of clang-specific default flags into the main default
flags lists.
Rename Toolchain.Clang*flags to Toolchain.*flags.
Rename Go variables with Clang in the name that have no non-Clang
equivalent.
Remove unused ninja variables.
Bug: 68947919
Test: no change to build.ninja for aosp_cf_x86_64_phone-userdebug or aosp_crosshatch-userdebug
Change-Id: Id287945315d53e5eaef197adbbb4f1302f2e3680
Host bionic and each of the device bionic architectures will share some
new toolchain functionality in common, create a toolchainBionic and embed
it into the toolchains. Use it to implement Bionic() once and change
the default implementation from true to false.
Test: go test ./cc/...
Test: m checkbuild
Change-Id: Ia34b80d9691edc4ab1cbdbd005d1ffc950d0881c
They are now explicit in the Bionic blueprints, and brought in through
dependencies on libc (which in turn is usually implicit through the
default system_shared_libs value). Modules that may break are cc_object
which don't depend on system_shared_libs, and those that explicitly set
system_shared_libs:[] but still assumes libc headers. In either case
the fix should be to add header_libs:["libc_headers"].
Test: Build and boot
Test: m checkbuild (on aosp_taimen and aosp_x86_64)
Bug: 153590472
Change-Id: I3217d8f36e49a987f5377866c8647f9dcccc37ce
Library components can enable the flags based on
performance impact
Test: run-test gtest
Change-Id: I41c4464cffd2b0e830d4ab1c5a25b378e2a25129
Signed-off-by: jaishank <jaishankar.rajendran@intel.com>
This patch adds new arch features avx2 and avx512 and
their supported archictectures for x86 and x86_64
Bug: 123376719
Test: m checkbuild
Change-Id: I3c079741815b39d7dbb4072e12ef7c9c2c15f5fe
Signed-off-by: Shalini Salomi Bodapati <shalini.salomi.bodapati@intel.com>
This enables using arch-dependent property values in modules defined in
android/.
Bug: 122332178
Test: Soong tests + TreeHugger
Change-Id: I89869e395fabf0e69f505b77eab8a4221384124e
The minimum set of supported features are different between Android and
Linux with X86_64. So while the list of variants and features are still
technically correct, and may be shared more in the future, the default
needs to be configured differently.
Bug: 120208462
Test: add `host_supported: true` to libopus; m libopus
Change-Id: Ib79707d17b852f77341026085230c026b6386b78
... and rename SanitizerRuntimeLibrary to LibclangRuntimeLibrary since
some of them are not sanitizers.
Bug: 29275768
Test: m
Change-Id: Id638adea42d22b02438fce26120aa155bea14d42
* USE_CLANG_LLD is unedefined in current builds.
* When USE_CLANG_LLD is defined to 'true' or '1',
use clang's lld instead of ld or ld.gold.
* When lld is enabled:
* ld-only flags are not passed to 'lld'.
* location_packer is disabled.
* Use new lld's --pack-dyn-relocs=android.
* When lld does not work:
* In Android.mk files use LOCAL_USE_CLANG_LLD := false.
* In Android.bp files use use_clang_lld: false.
* Only arm, arm64, x86, and x86_64_devices have LLD flags;
all other hosts and targets do not call lld yet.
Bug: 73768157
Test: make checkbuild and boot
Change-Id: I06b8a1e868a600997a7e70fe05c299d751d23d5f
This reverts commit fa00dfda13.
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: Iec9e695cccc3f206df67f0c01cfd4c2c3023dcec
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: I448dc95baa4976b68ce2659b80498539426775f9
These flags were added for gcc, but are always stripped out when
compiling for clang. Since gcc is barely used, removed them.
Bug: 68855788
Bug: 68947919
Test: m checkbuild
Change-Id: Iae2bda9808dd9499848ce145ccdf71c4c490b80e
Move -fdata-sections and -fno-short-enums to global device flags.
-fdata-sections was not previously set on x86[_64], -fno-short-enums
was not previously set on mips[64].
Bug: 68855788
Test: m checkbuild
Change-Id: I68e64888d5414fc022366eb2b6c5cd92c28a5542
Move ldflags that are specified for all devices into
deviceGlobalLdflags, and add them to linker.go:
-Wl,-z,noexecstack
-Wl,-z,relro
-Wl,-z,now
-Wl,--build-id=md5
-Wl,--warn-shared-textrel
-Wl,--fatal-warnings
-Wl,--no-undefined-version
Bug: 68855788
Test: m checkbuild
Change-Id: I82561b4189287d7638006f9e298c5151f9930c5e
-Wl,--gc-sections is already added by library.go and binary.go for
anything that uses bionic.
Bug: 68855788
Test: m checkbuild
Change-Id: I229199045ef8595d69c07fcf1aa6bbdc0b753fe3
Move cflags that are set on all devices to deviceGlobalCflags:
-fno-canonical-system-headers
-ffunction-sections
-funwind-tables
-fstack-protector-strong
-Wa,--noexecstack
-D_FORTIFY_SOURCE=2
-Wstrict-aliasing=2
-Werror=format-security
Bug: 68855788
Test: m checkbuild
Change-Id: Iefec689fdd2749013d0cc003b3abec674a85fb74
Move all the flags that are used everywhere (or should be used
everywhere) into cc/config/global.go:
-no-canonical-prefixes
-fno-exceptions
-Wno-multichar
-O2
-g
-fno-strict-aliasing
Also remove flags that are already in noOverrideGlobalCflags:
-Werror=pointer-to-int-cast
-Werror=int-to-pointer-cast
x86 and x86_64 were specifying -fstrict-aliasing, but that was
being overriden later by -fno-strict-aliasing, so remove it.
ARM devices still override -fno-strict-aliasing to -fstrict-aliasing
when using ARM (vs. Thumb) instruction set.
Bug: 68855788
Test: m checkbuild
Change-Id: Ia2b5891bdefb60f974ad92b4b84a8548c2dcc7dc
and export the library name to make. Refactor the code a bit to avoid repeating the library name
multiple times.
Bug: 22033465
Test: Ran external/clang/build.py for aosp-llvm
Change-Id: I25eb3858eb92e1dd493b09524d559802551b2547