aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2019-04-24 14:38:09 -0700
committerPeter Collingbourne <pcc@google.com>2019-04-30 19:09:27 -0700
commit29df07e6ace889c198bcedac4af423a6999f18e9 (patch)
tree7b743095ced7bd0313dd7d351883046c39a36397
parent4b1f275e6b3826c86f791ae8c4d5ec3563c2fc11 (diff)
downloadlinux-x86-29df07e6ace889c198bcedac4af423a6999f18e9.tar.gz
Correctly set stubs properties on runtimes with stubs.
Together with the soong change, this causes soong to correctly recognize the sanitizer runtimes as having stub libraries. Change-Id: I42c613d5830ea1f27add0112908c3171902e6d1a
-rw-r--r--Android.bp5
-rw-r--r--soong/clangprebuilts.go40
2 files changed, 35 insertions, 10 deletions
diff --git a/Android.bp b/Android.bp
index e453d7529..826fbd2e5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -111,6 +111,7 @@ libclang_rt_prebuilt_library_shared {
},
},
check_elf_files: false, // Bypass circular dependency between libc++
+ has_stubs: true,
}
libclang_rt_prebuilt_library_shared {
@@ -124,6 +125,7 @@ libclang_rt_prebuilt_library_shared {
},
},
check_elf_files: false, // Bypass circular dependency between libc++
+ has_stubs: true,
}
libclang_rt_prebuilt_library_shared {
@@ -137,6 +139,7 @@ libclang_rt_prebuilt_library_shared {
},
},
check_elf_files: false, // Bypass circular dependency between libc++
+ has_stubs: true,
}
libclang_rt_prebuilt_library_shared {
@@ -156,6 +159,7 @@ libclang_rt_prebuilt_library_shared {
},
},
check_elf_files: false, // Bypass circular dependency between libc++
+ has_stubs: true,
}
libclang_rt_llndk_library {
@@ -364,6 +368,7 @@ libclang_rt_prebuilt_library_shared {
},
},
check_elf_files: false, // Bypass circular dependency between libc++
+ has_stubs: true,
}
libclang_rt_prebuilt_library_static {
diff --git a/soong/clangprebuilts.go b/soong/clangprebuilts.go
index a802c239b..86af1c73f 100644
--- a/soong/clangprebuilts.go
+++ b/soong/clangprebuilts.go
@@ -72,6 +72,11 @@ func getClangResourceDir(ctx android.LoadHookContext) string {
return path.Join(clangDir, "lib64", "clang", releaseVersion, "lib", "linux")
}
+func getSymbolFilePath(ctx android.LoadHookContext) string {
+ libDir := getClangResourceDir(ctx)
+ return path.Join(libDir, strings.TrimSuffix(ctx.ModuleName(), ".llndk")+".map.txt")
+}
+
func trimVersionNumbers(ver string, retain int) string {
sep := "."
versions := strings.Split(ver, sep)
@@ -182,7 +187,11 @@ func llvmPrebuiltLibraryStatic(ctx android.LoadHookContext) {
ctx.AppendProperties(p)
}
-func libClangRtPrebuiltLibraryShared(ctx android.LoadHookContext) {
+type prebuiltLibrarySharedProps struct {
+ Has_stubs *bool
+}
+
+func libClangRtPrebuiltLibraryShared(ctx android.LoadHookContext, in *prebuiltLibrarySharedProps) {
if ctx.AConfig().IsEnvTrue("FORCE_BUILD_SANITIZER_SHARED_OBJECTS") {
return
}
@@ -202,6 +211,10 @@ func libClangRtPrebuiltLibraryShared(ctx android.LoadHookContext) {
}
Pack_relocations *bool
Stl *string
+ Stubs struct {
+ Symbol_file *string
+ Versions []string
+ }
}
p := &props{}
@@ -217,6 +230,12 @@ func libClangRtPrebuiltLibraryShared(ctx android.LoadHookContext) {
disable := false
p.Pack_relocations = &disable
p.Stl = proptools.StringPtr("none")
+
+ if proptools.Bool(in.Has_stubs) {
+ p.Stubs.Versions = []string{"10000"}
+ p.Stubs.Symbol_file = proptools.StringPtr(getSymbolFilePath(ctx))
+ }
+
ctx.AppendProperties(p)
}
@@ -224,11 +243,11 @@ func libClangRtPrebuiltLibraryStatic(ctx android.LoadHookContext) {
libDir := getClangResourceDir(ctx)
type props struct {
- Srcs []string
+ Srcs []string
System_shared_libs []string
- No_libcrt *bool
- No_libgcc *bool
- Stl *string
+ No_libcrt *bool
+ No_libgcc *bool
+ Stl *string
}
name := strings.TrimPrefix(ctx.ModuleName(), "prebuilt_")
@@ -247,15 +266,12 @@ func libClangRtPrebuiltLibraryStatic(ctx android.LoadHookContext) {
}
func libClangRtLLndkLibrary(ctx android.LoadHookContext) {
- libDir := getClangResourceDir(ctx)
-
type props struct {
Symbol_file *string
}
p := &props{}
- symbol_file := string(path.Join(libDir, strings.TrimSuffix(ctx.ModuleName(), ".llndk")+".map.txt"))
- p.Symbol_file = proptools.StringPtr(symbol_file)
+ p.Symbol_file = proptools.StringPtr(getSymbolFilePath(ctx))
ctx.AppendProperties(p)
}
@@ -293,7 +309,11 @@ func llvmHostPrebuiltLibrarySharedFactory() android.Module {
func libClangRtPrebuiltLibrarySharedFactory() android.Module {
module, _ := cc.NewPrebuiltSharedLibrary(android.HostAndDeviceSupported)
- android.AddLoadHook(module, libClangRtPrebuiltLibraryShared)
+ props := &prebuiltLibrarySharedProps{}
+ module.AddProperties(props)
+ android.AddLoadHook(module, func(ctx android.LoadHookContext) {
+ libClangRtPrebuiltLibraryShared(ctx, props)
+ })
return module.Init()
}