Commit graph

32 commits

Author SHA1 Message Date
Colin Cross
4fa894d366 Removed unused GCC references
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
2022-09-30 19:32:48 -07:00
Colin Cross
fc3b064c9a Make toolchain more compose-y
Remove many of the overridden methods from toolchainBase in favor
of having smaller composable types.  toolchainNoCrt, toolchain32Bit
and toolchain64Bit now only provide a few methods and can be mixed
in to any toolchain type.  toolchainLinux, toolchainBionic,
toolchainWindows and toolchainDarwin now embed toolchainBase to provide
the default flags methods for when they don't override them.

This avoids the need for disambiguation methods required when a
type embeds two types that implement the same method.

Test: cc_test.go
Change-Id: I641da2a47aba597c517f693efedb65cf41273c82
2022-09-01 14:21:36 -07:00
Chih-Hung Hsieh
57da82697a Do not add non-existing -Bprebuilts/gcc/.../bin
* Only prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/bin
  exists for x86_windows_host.
* Remove config.ToolPath;
  add required -B flags into ToolchainCflags and ToolchainLdflags.

Bug: 218883919
Test: make droid tidy-soong_subset
Change-Id: I9a18bf8cc0cf84e091c7463b3bda316eaab53aa3
2022-02-16 15:49:39 -08:00
Nick Desaulniers
16bc50a128 remove support for *.rc files
We're now packaging llvm-windres (aosp/1870074) which can be used as a
substitute for GNU binutils' windres, but we've also removed the last
consumer of .rc files in aosp/1867048 (external/mdnsresponder/).

In the worst case, we can bring back support for .rc files but instead
process them with llvm-windres.

Bug: 203794880
Test: lunch aosp_cf_x86_64_phone-userdebug && m
Change-Id: I30a873537e004b46a87191a932d076a89463c873
2021-10-26 11:32:36 -07:00
Colin Cross
0523ba2675 Rename ninja variables with Clang in the name
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
2021-07-14 20:55:23 -07:00
Colin Cross
33bac24bb9 Remove clang indirection without affecting build.ninja
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
2021-07-14 20:54:22 -07:00
Stephen Hines
2210e720c9 Switch to clang-r399163.
Bug: http://b/155835175
Bug: http://b/151457797
Bug: http://b/165945989
Test: m with aosp_blueline
Change-Id: Id2c2932ccbc34fcbb19cd0b4da0d66ea92cc099a
2020-09-15 13:48:05 -07:00
Pirama Arumuga Nainar
af68337d36 Set -fsjlj-exceptions for all 32-bit Windows compiles
Bug: http://b/116784799

Previously this was set only when stl was requested.  We can now pass
this for all C++ compilations.

Test: go/android-llvm-windows-testing
Change-Id: I43e635ff50d0f1a5e000f13021506aeece368b4a
2020-09-10 09:33:22 -07:00
Yi Kong
a3c22e7ee2 Pass -Brepro ldflag to Windows builds
The default build-id is generated using timestamp. Pass -Brepro to
avoid using timestamp for deterministic build.

Bug: 153462962
Test: build fastboot.exe twice, got same shasum
Change-Id: I38fe993eec23c60bfcf1b76188774bfe06839fa4
2020-04-09 15:53:11 +08:00
Pirama Arumuga Nainar
105cab2b5a Pass -static-libgcc to Windows link commands
This was unnecessary in the past, when -nodefaultlibs was used while
linking, but that changed with
aosp/I722bd6596a1f3f5819f2767c29c0fa1e8b3ec0e8.

Test: simpleperf_ndk64.exe no longer depends on libgcc_s_seh-1.dll.
Change-Id: I435d7302906eb3758e758b5aefca8763bfba6290
2019-10-15 13:58:30 -07:00
Jerome Gaillard
7f7f34f81a Add Skia deps to the list of available Windows libraries
Building Skia for Windows requires linking some Windows libraries that
were not in the list of available ones. This adds the necessary
libraries.

Test: N/A
Change-Id: I803b7b05f47163316c6f03866145dc50656a6bef
2019-01-21 11:34:46 +00:00
Jerome Gaillard
82bb8b1359 Upgrade Windows default build version from Vista to 7
This is needed to build libicui18n on Windows, as it depends on APIs
created in Windows 7 (ResolveLocaleName).

Test: sdk build
Change-Id: If64510a262f7f1d4d356b1a9960ceea114cfa78a
2018-12-06 12:39:12 +00:00
Jerome Gaillard
80fec097b1 Add flags for Windows assembly builds
This is necessary to build libjpeg for Windows.

Test: lunch sdk, make libjpeg
Change-Id: I6ace0e524d1d710b5ce78320e7a06777511d1634
2018-11-29 15:47:31 +00:00
Pirama Arumuga Nainar
8fd5a96959 Remove --allow-multiple-definitions for 32-bit Windows
Bug: http://b/109759970
Bug: http://b/91353691

There are no multiple-defintion errors after switching to clang-r339409
and libc++.

Test: m native-host-cross
Change-Id: I5576b3894ed1d88c9b2e5f4d92e1d3bfadfb029b
2018-10-10 20:10:15 +00:00
Pirama Arumuga Nainar
a403cc7254 Change STL for Windows to libc++.
- Stop including libstdc++ headers.
- '-pthread' and 'static-libgcc' are unused when we pass -nodefaultlibs.
We didn't pass -nodefaultlibs for libstdc++.
- Use SjLj exceptions for 32-bit.  libgcc_eh implements SjLj exception
model for 32-bit.
- Disable visibility annotations for libcxx and libcxxabi since we are
only going to support these as static libraries.
- Use Win32 threads.  MinGW pthreads throws an error when building
libcxx since it's pthread_mutex_initializer is not constant (needs a
cast).
- Link libgcc_eh, which needs pthread, which in turn depends on
kernel32.  Wrap the libraries with --start-group and --end-group and
remove duplicates.

Test: Build and test Windows binaries under Wine.

Change-Id: I8be51b004585e11ef51b7d5012f2a51330d1260f
2018-10-10 20:09:37 +00:00
Dan Willemsen
bd4abf5dfc Remove GCC-specific toolchain methods
Test: m
Change-Id: I06442347ade2d60bc42131b3126ecc17840c9e31
2018-10-09 19:44:54 -07:00
Pirama Arumuga Nainar
b83de950e7 Remove --allow-multiple-definion linker flag for 64-bit Windows
Bug: http://b/109759970

r335286 fixed this for 64-bit Windows.  This remains broken for 32-bit
Windows.

Test: m native-host-cross
Change-Id: I4d11b83d51db055406c6723aad89efd1b86b9b7b
2018-10-03 11:40:23 -07:00
Dan Willemsen
f640dbcd1f Remove GCC support from Make
We need to keep support in Soong until toolchain_library no longer uses
GCC.

Test: out/build-aosp_arm64.ninja is the same before/after
Test: build_test on downstream branches
Change-Id: Ib78bcd6d5544afc3a3164f65fa72a3f08b2acf29
2018-09-06 22:37:54 +00:00
Pirama Arumuga Nainar
191f646295 Use Windows security mitigation features: ASLR, DEP
Bug: https://issuetracker.google.com/36952278
Bug: http://b/113171785

From
https://android-review.googlesource.com/c/platform/system/core/+/737292:

The --dynamicbase linker flag enables use of Address Space Layout
Randomization (ASLR) on Windows Vista and newer. It causes the code
segment / module to be loaded at unpredictable addresses to make
exploits harder to construct.

The --nxcompat linker flag enables use of Data Execution Protection
(DEP) on Windows XP SP2 and newer. It causes the process to be killed if
the process tries to execute code on memory pages not marked executable.
This makes exploits harder to construct because the stack is then not
executable, other data pages aren't, etc.

These bits are already set on AdbWinApi.dll and AdbWinUsbApi.dll.

--high-entropy-va provides improved ASLR.

Credit: Spencer Low for doing the initial work at
https://android-review.googlesource.com/c/platform/system/core/+/737292.

Test: Verify that DLLCharacteristics reported by 'objdump -x' is:
      0x140 for 32-bit and 0x160 for 64-bit.  Also verified trivial use
      cases under Wine.

Change-Id: I1b898cd36c7c627916dae9ce7dfd1c27de1e3c59
2018-08-30 12:54:33 -07:00
Pirama Arumuga Nainar
8a852e7694 Use clang for windows host modules
Bug: http://b/69933068

- Remove GCC's intrinsic header path so Clang's headers get included.
- Add '-B' with GCC's binary directory so Clang detects the linker.
- Bug: http://b/109759970 - Pass '--allow-multiple-definition' linker
flag to deal with ld.bfd's inability to handle Clang-generated section
names is fixed.
- Bug: http://b/110800681 - lld cannot link Android's Windows modules
yet

Test: m native-host-cross and run adb_test.exe under wine.

Change-Id: I9be9cfc34a47cbeee04024438dea214305112eaa
2018-06-25 18:36:50 -07:00
Pirama Arumuga Nainar
abf1b31a20 Use -static-libgcc for Windows
Bug: http://b/69970955

With the MinGW prebuilts update (http://aosp/709402), executables get a
runtime dependency on libgcc_s_sjlj-1.dll with both gcc and Clang.
Passing -static-libgcc removes this dependency and is a better option
than having to package an extra dll with executables.

Test: Run gcc-built adb_test.exe under wine
Change-Id: I18e5fadb1b8ace510ae684e2d4cfa7fe7d007cff
2018-06-25 18:31:01 -07:00
Chih-Hung Hsieh
3101a969aa Define clang lld flags for hosts.
* Add -fuse-ld=lld to hostGlobalLldflags.
* Set up *ClangLldflags variables for hosts.
  They are the same as *ClangLdflags, but could be changed in the future.

Bug: 73768157
Test: make checkbuild
Change-Id: I3d61504ab7262d472bbf933df7c1a9bef62519e1
2018-04-17 16:01:08 -07:00
Chih-Hung Hsieh
02b4da53a7 Add USE_CLANG_LLD and use_clang_lld.
* 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
2018-04-12 14:37:35 -07:00
Dan Willemsen
01f388c343 Add base variables for windows clang
This just copies most of what exists for clang on Linux, but doesn't
actually turn on clang support.

Bug: 69933068
Test: m nothing; compare ninja files
Change-Id: I2cf203026e7ced32004a91d7f3baf4a6415085eb
2017-11-30 15:42:53 -08:00
Colin Cross
7278afc5a8 Consolidate global cflags
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
2017-11-03 11:34:45 -07:00
Dan Willemsen
b18cf7a5a0 Add windows libraries used by mdnsresponder
Test: Check for presence in prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8
Change-Id: Iaa0b56ca8ff94ebcd925238f211d9bd5d52a4a0c
2017-09-09 13:06:25 -07:00
Dan Willemsen
4f1c3d4116 Add support for Windows Message Compiler
We've only got one user of this currently, but since it needs the
location of the toolchain, and different flags based on 32 vs 64-bit,
it's easier just to add support than to get this into a genrule.

Test: Convert external/mdnsresponder to Soong, build
Change-Id: I6c19a82bc14f6ab556f6cc5f37164862ba5f9083
2017-09-09 13:06:25 -07:00
Dan Willemsen
7752bca25d Enable large-address-aware for 32-bit windows
Bug: 36046324
Test: m -j winsdk-tools
Change-Id: I232d7dac9a6708542e70392801259141bec297c6
2017-03-14 13:37:26 -07:00
Colin Cross
124fd9afbd Add more whitelisted host libraries
Add AppKit, Foundation and Security to darwin for libchrome.

Add -lm and -lversion to windows for llvm.

Test: m -j libLLVMObject
Change-Id: Ie5c922d3fbb41fba1de5f1ce9e530683bf411c5a
2016-11-22 15:41:04 -08:00
Dan Willemsen
2e47b34435 Add Toolchain.Bionic()
Move some cc ctx.Host() / ctx.Device() checks over to using
ctx.toolchain().Bionic(). There will be more changes, these are just the
obvious ones dealing with host_ldlibs / crt / system libraries.

Bug: 31559095
Test: out/soong/build.ninja is identical
Change-Id: Ibba60483b4ab0e01f6996eb7d883120e4acc1830
2016-11-17 01:50:43 -08:00
Kenny Root
b912349c03 Add pthread to Windows allowed ldlibs
The MinGW update now includes pthread.

Test: update BoringSSL to use pthreads on Windows and compile
Change-Id: Id85d9fd3e03a310e07e0093ca80cefaf10fe8930
2016-09-20 14:49:33 -07:00
Colin Cross
b98c8b0595 Move toolchain and global variables into separate package
Move all of the configuration into a cc/config package

Change-Id: If56fc7242062ed1ce3cb297f78a1e0ef7537373c
2016-08-01 13:37:01 -07:00
Renamed from cc/x86_windows_host.go (Browse further)