Merge "Define clang lld flags for hosts."

This commit is contained in:
Chih-hung Hsieh 2018-04-19 17:03:02 +00:00 committed by Gerrit Code Review
commit 94853de469
5 changed files with 36 additions and 16 deletions

View File

@ -99,7 +99,7 @@ var (
hostGlobalLdflags = []string{} hostGlobalLdflags = []string{}
hostGlobalLldflags = []string{} hostGlobalLldflags = []string{"-fuse-ld=lld"}
commonGlobalCppflags = []string{ commonGlobalCppflags = []string{
"-Wsign-promo", "-Wsign-promo",

View File

@ -73,10 +73,16 @@ var (
darwinClangLdflags = ClangFilterUnknownCflags(darwinLdflags) darwinClangLdflags = ClangFilterUnknownCflags(darwinLdflags)
darwinClangLldflags = ClangFilterUnknownLldflags(darwinClangLdflags)
darwinX86ClangLdflags = ClangFilterUnknownCflags(darwinX86Ldflags) darwinX86ClangLdflags = ClangFilterUnknownCflags(darwinX86Ldflags)
darwinX86ClangLldflags = ClangFilterUnknownLldflags(darwinX86ClangLdflags)
darwinX8664ClangLdflags = ClangFilterUnknownCflags(darwinX8664Ldflags) darwinX8664ClangLdflags = ClangFilterUnknownCflags(darwinX8664Ldflags)
darwinX8664ClangLldflags = ClangFilterUnknownLldflags(darwinX8664ClangLdflags)
darwinSupportedSdkVersions = []string{ darwinSupportedSdkVersions = []string{
"10.10", "10.10",
"10.11", "10.11",
@ -141,6 +147,7 @@ func init() {
pctx.StaticVariable("DarwinClangCflags", strings.Join(darwinClangCflags, " ")) pctx.StaticVariable("DarwinClangCflags", strings.Join(darwinClangCflags, " "))
pctx.StaticVariable("DarwinClangLdflags", strings.Join(darwinClangLdflags, " ")) pctx.StaticVariable("DarwinClangLdflags", strings.Join(darwinClangLdflags, " "))
pctx.StaticVariable("DarwinClangLldflags", strings.Join(darwinClangLldflags, " "))
// Extended cflags // Extended cflags
pctx.StaticVariable("DarwinX86Cflags", strings.Join(darwinX86Cflags, " ")) pctx.StaticVariable("DarwinX86Cflags", strings.Join(darwinX86Cflags, " "))
@ -152,7 +159,9 @@ func init() {
pctx.StaticVariable("DarwinX8664ClangCflags", pctx.StaticVariable("DarwinX8664ClangCflags",
strings.Join(ClangFilterUnknownCflags(darwinX8664Cflags), " ")) strings.Join(ClangFilterUnknownCflags(darwinX8664Cflags), " "))
pctx.StaticVariable("DarwinX86ClangLdflags", strings.Join(darwinX86ClangLdflags, " ")) pctx.StaticVariable("DarwinX86ClangLdflags", strings.Join(darwinX86ClangLdflags, " "))
pctx.StaticVariable("DarwinX86ClangLldflags", strings.Join(darwinX86ClangLldflags, " "))
pctx.StaticVariable("DarwinX8664ClangLdflags", strings.Join(darwinX8664ClangLdflags, " ")) pctx.StaticVariable("DarwinX8664ClangLdflags", strings.Join(darwinX8664ClangLdflags, " "))
pctx.StaticVariable("DarwinX8664ClangLldflags", strings.Join(darwinX8664ClangLldflags, " "))
pctx.StaticVariable("DarwinX86YasmFlags", "-f macho -m x86") pctx.StaticVariable("DarwinX86YasmFlags", "-f macho -m x86")
pctx.StaticVariable("DarwinX8664YasmFlags", "-f macho -m amd64") pctx.StaticVariable("DarwinX8664YasmFlags", "-f macho -m amd64")
} }
@ -274,8 +283,7 @@ func (t *toolchainDarwinX86) ClangLdflags() string {
} }
func (t *toolchainDarwinX86) ClangLldflags() string { func (t *toolchainDarwinX86) ClangLldflags() string {
// TODO: define and use Darwin*ClangLldflags return "${config.DarwinClangLldflags} ${config.DarwinX86ClangLldflags}"
return "${config.DarwinClangLdflags} ${config.DarwinX86ClangLdflags}"
} }
func (t *toolchainDarwinX8664) ClangLdflags() string { func (t *toolchainDarwinX8664) ClangLdflags() string {
@ -283,8 +291,7 @@ func (t *toolchainDarwinX8664) ClangLdflags() string {
} }
func (t *toolchainDarwinX8664) ClangLldflags() string { func (t *toolchainDarwinX8664) ClangLldflags() string {
// TODO: define and use Darwin*ClangLldflags return "${config.DarwinClangLldflags} ${config.DarwinX8664ClangLldflags}"
return "${config.DarwinClangLdflags} ${config.DarwinX8664ClangLdflags}"
} }
func (t *toolchainDarwinX86) YasmFlags() string { func (t *toolchainDarwinX86) YasmFlags() string {

View File

@ -61,11 +61,14 @@ var (
// Use the device gcc toolchain // Use the device gcc toolchain
"--gcc-toolchain=${LinuxBionicGccRoot}", "--gcc-toolchain=${LinuxBionicGccRoot}",
}) })
linuxBionicLldflags = ClangFilterUnknownLldflags(linuxBionicLdflags)
) )
func init() { func init() {
pctx.StaticVariable("LinuxBionicCflags", strings.Join(linuxBionicCflags, " ")) pctx.StaticVariable("LinuxBionicCflags", strings.Join(linuxBionicCflags, " "))
pctx.StaticVariable("LinuxBionicLdflags", strings.Join(linuxBionicLdflags, " ")) pctx.StaticVariable("LinuxBionicLdflags", strings.Join(linuxBionicLdflags, " "))
pctx.StaticVariable("LinuxBionicLldflags", strings.Join(linuxBionicLldflags, " "))
pctx.StaticVariable("LinuxBionicIncludeFlags", bionicHeaders("x86")) pctx.StaticVariable("LinuxBionicIncludeFlags", bionicHeaders("x86"))
@ -127,8 +130,7 @@ func (t *toolchainLinuxBionic) ClangLdflags() string {
} }
func (t *toolchainLinuxBionic) ClangLldflags() string { func (t *toolchainLinuxBionic) ClangLldflags() string {
// TODO: define and use LinuxBionicLldflags return "${config.LinuxBionicLldflags}"
return "${config.LinuxBionicLdflags}"
} }
func (t *toolchainLinuxBionic) ToolchainClangCflags() string { func (t *toolchainLinuxBionic) ToolchainClangCflags() string {

View File

@ -78,18 +78,24 @@ var (
"--sysroot ${LinuxGccRoot}/sysroot", "--sysroot ${LinuxGccRoot}/sysroot",
}...) }...)
linuxClangLldflags = ClangFilterUnknownLldflags(linuxClangLdflags)
linuxX86ClangLdflags = append(ClangFilterUnknownCflags(linuxX86Ldflags), []string{ linuxX86ClangLdflags = append(ClangFilterUnknownCflags(linuxX86Ldflags), []string{
"-B${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}/32", "-B${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}/32",
"-L${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}/32", "-L${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}/32",
"-L${LinuxGccRoot}/${LinuxGccTriple}/lib32", "-L${LinuxGccRoot}/${LinuxGccTriple}/lib32",
}...) }...)
linuxX86ClangLldflags = ClangFilterUnknownLldflags(linuxX86ClangLdflags)
linuxX8664ClangLdflags = append(ClangFilterUnknownCflags(linuxX8664Ldflags), []string{ linuxX8664ClangLdflags = append(ClangFilterUnknownCflags(linuxX8664Ldflags), []string{
"-B${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}", "-B${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}",
"-L${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}", "-L${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}",
"-L${LinuxGccRoot}/${LinuxGccTriple}/lib64", "-L${LinuxGccRoot}/${LinuxGccTriple}/lib64",
}...) }...)
linuxX8664ClangLldflags = ClangFilterUnknownLldflags(linuxX8664ClangLdflags)
linuxClangCppflags = []string{ linuxClangCppflags = []string{
"-isystem ${LinuxGccRoot}/${LinuxGccTriple}/include/c++/${LinuxGccVersion}", "-isystem ${LinuxGccRoot}/${LinuxGccTriple}/include/c++/${LinuxGccVersion}",
"-isystem ${LinuxGccRoot}/${LinuxGccTriple}/include/c++/${LinuxGccVersion}/backward", "-isystem ${LinuxGccRoot}/${LinuxGccTriple}/include/c++/${LinuxGccVersion}/backward",
@ -134,6 +140,7 @@ func init() {
pctx.StaticVariable("LinuxClangCflags", strings.Join(linuxClangCflags, " ")) pctx.StaticVariable("LinuxClangCflags", strings.Join(linuxClangCflags, " "))
pctx.StaticVariable("LinuxClangLdflags", strings.Join(linuxClangLdflags, " ")) pctx.StaticVariable("LinuxClangLdflags", strings.Join(linuxClangLdflags, " "))
pctx.StaticVariable("LinuxClangLldflags", strings.Join(linuxClangLldflags, " "))
pctx.StaticVariable("LinuxClangCppflags", strings.Join(linuxClangCppflags, " ")) pctx.StaticVariable("LinuxClangCppflags", strings.Join(linuxClangCppflags, " "))
// Extended cflags // Extended cflags
@ -147,7 +154,9 @@ func init() {
pctx.StaticVariable("LinuxX8664ClangCflags", pctx.StaticVariable("LinuxX8664ClangCflags",
strings.Join(ClangFilterUnknownCflags(linuxX8664Cflags), " ")) strings.Join(ClangFilterUnknownCflags(linuxX8664Cflags), " "))
pctx.StaticVariable("LinuxX86ClangLdflags", strings.Join(linuxX86ClangLdflags, " ")) pctx.StaticVariable("LinuxX86ClangLdflags", strings.Join(linuxX86ClangLdflags, " "))
pctx.StaticVariable("LinuxX86ClangLldflags", strings.Join(linuxX86ClangLldflags, " "))
pctx.StaticVariable("LinuxX8664ClangLdflags", strings.Join(linuxX8664ClangLdflags, " ")) pctx.StaticVariable("LinuxX8664ClangLdflags", strings.Join(linuxX8664ClangLdflags, " "))
pctx.StaticVariable("LinuxX8664ClangLldflags", strings.Join(linuxX8664ClangLldflags, " "))
pctx.StaticVariable("LinuxX86ClangCppflags", strings.Join(linuxX86ClangCppflags, " ")) pctx.StaticVariable("LinuxX86ClangCppflags", strings.Join(linuxX86ClangCppflags, " "))
pctx.StaticVariable("LinuxX8664ClangCppflags", strings.Join(linuxX8664ClangCppflags, " ")) pctx.StaticVariable("LinuxX8664ClangCppflags", strings.Join(linuxX8664ClangCppflags, " "))
// Yasm flags // Yasm flags
@ -242,8 +251,7 @@ func (t *toolchainLinuxX86) ClangLdflags() string {
} }
func (t *toolchainLinuxX86) ClangLldflags() string { func (t *toolchainLinuxX86) ClangLldflags() string {
// TODO: define and use Linux*ClangLldflags return "${config.LinuxClangLldflags} ${config.LinuxX86ClangLldflags}"
return "${config.LinuxClangLdflags} ${config.LinuxX86ClangLdflags}"
} }
func (t *toolchainLinuxX8664) ClangLdflags() string { func (t *toolchainLinuxX8664) ClangLdflags() string {
@ -251,8 +259,7 @@ func (t *toolchainLinuxX8664) ClangLdflags() string {
} }
func (t *toolchainLinuxX8664) ClangLldflags() string { func (t *toolchainLinuxX8664) ClangLldflags() string {
// TODO: define and use Linux*ClangLldflags return "${config.LinuxClangLldflags} ${config.LinuxX8664ClangLldflags}"
return "${config.LinuxClangLdflags} ${config.LinuxX8664ClangLdflags}"
} }
func (t *toolchainLinuxX86) YasmFlags() string { func (t *toolchainLinuxX86) YasmFlags() string {

View File

@ -64,7 +64,8 @@ var (
windowsLdflags = []string{ windowsLdflags = []string{
"--enable-stdcall-fixup", "--enable-stdcall-fixup",
} }
windowsClangLdflags = append(ClangFilterUnknownCflags(windowsLdflags), []string{}...) windowsClangLdflags = append(ClangFilterUnknownCflags(windowsLdflags), []string{}...)
windowsClangLldflags = ClangFilterUnknownLldflags(windowsClangLdflags)
windowsX86Cflags = []string{ windowsX86Cflags = []string{
"-m32", "-m32",
@ -84,6 +85,7 @@ var (
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32", "-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib32", "-B${WindowsGccRoot}/${WindowsGccTriple}/lib32",
}...) }...)
windowsX86ClangLldflags = ClangFilterUnknownLldflags(windowsX86ClangLdflags)
windowsX8664Ldflags = []string{ windowsX8664Ldflags = []string{
"-m64", "-m64",
@ -94,6 +96,7 @@ var (
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3", "-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib64", "-B${WindowsGccRoot}/${WindowsGccTriple}/lib64",
}...) }...)
windowsX8664ClangLldflags = ClangFilterUnknownLldflags(windowsX8664ClangLdflags)
windowsAvailableLibraries = addPrefix([]string{ windowsAvailableLibraries = addPrefix([]string{
"gdi32", "gdi32",
@ -128,6 +131,7 @@ func init() {
pctx.StaticVariable("WindowsClangCflags", strings.Join(windowsClangCflags, " ")) pctx.StaticVariable("WindowsClangCflags", strings.Join(windowsClangCflags, " "))
pctx.StaticVariable("WindowsClangLdflags", strings.Join(windowsClangLdflags, " ")) pctx.StaticVariable("WindowsClangLdflags", strings.Join(windowsClangLdflags, " "))
pctx.StaticVariable("WindowsClangLldflags", strings.Join(windowsClangLldflags, " "))
pctx.StaticVariable("WindowsClangCppflags", strings.Join(windowsClangCppflags, " ")) pctx.StaticVariable("WindowsClangCppflags", strings.Join(windowsClangCppflags, " "))
pctx.StaticVariable("WindowsX86Cflags", strings.Join(windowsX86Cflags, " ")) pctx.StaticVariable("WindowsX86Cflags", strings.Join(windowsX86Cflags, " "))
@ -140,7 +144,9 @@ func init() {
pctx.StaticVariable("WindowsX8664ClangCflags", pctx.StaticVariable("WindowsX8664ClangCflags",
strings.Join(ClangFilterUnknownCflags(windowsX8664Cflags), " ")) strings.Join(ClangFilterUnknownCflags(windowsX8664Cflags), " "))
pctx.StaticVariable("WindowsX86ClangLdflags", strings.Join(windowsX86ClangLdflags, " ")) pctx.StaticVariable("WindowsX86ClangLdflags", strings.Join(windowsX86ClangLdflags, " "))
pctx.StaticVariable("WindowsX86ClangLldflags", strings.Join(windowsX86ClangLldflags, " "))
pctx.StaticVariable("WindowsX8664ClangLdflags", strings.Join(windowsX8664ClangLdflags, " ")) pctx.StaticVariable("WindowsX8664ClangLdflags", strings.Join(windowsX8664ClangLdflags, " "))
pctx.StaticVariable("WindowsX8664ClangLldflags", strings.Join(windowsX8664ClangLldflags, " "))
pctx.StaticVariable("WindowsX86ClangCppflags", strings.Join(windowsX86ClangCppflags, " ")) pctx.StaticVariable("WindowsX86ClangCppflags", strings.Join(windowsX86ClangCppflags, " "))
pctx.StaticVariable("WindowsX8664ClangCppflags", strings.Join(windowsX8664ClangCppflags, " ")) pctx.StaticVariable("WindowsX8664ClangCppflags", strings.Join(windowsX8664ClangCppflags, " "))
@ -246,8 +252,7 @@ func (t *toolchainWindowsX86) ClangLdflags() string {
} }
func (t *toolchainWindowsX86) ClangLldflags() string { func (t *toolchainWindowsX86) ClangLldflags() string {
// TODO: define and use Windows*ClangLldflags return "${config.WindowsClangLldflags} ${config.WindowsX86ClangLldflags}"
return "${config.WindowsClangLdflags} ${config.WindowsX86ClangLdflags}"
} }
func (t *toolchainWindowsX8664) ClangLdflags() string { func (t *toolchainWindowsX8664) ClangLdflags() string {
@ -255,8 +260,7 @@ func (t *toolchainWindowsX8664) ClangLdflags() string {
} }
func (t *toolchainWindowsX8664) ClangLldflags() string { func (t *toolchainWindowsX8664) ClangLldflags() string {
// TODO: define and use Windows*ClangLldflags return "${config.WindowsClangLldflags} ${config.WindowsX8664ClangLldflags}"
return "${config.WindowsClangLdflags} ${config.WindowsX8664ClangLdflags}"
} }
func (t *toolchainWindows) ShlibSuffix() string { func (t *toolchainWindows) ShlibSuffix() string {