soong: Add crt_pad_segment to .so's am: f4ffe0a026
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2933932 Change-Id: I0b5580c9c2fa0a1f00ab5a617a7c45a29c8d9a5d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1455,6 +1455,7 @@ func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
|
|||||||
name: "libc",
|
name: "libc",
|
||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stubs: { versions: ["1"] },
|
stubs: { versions: ["1"] },
|
||||||
@@ -1469,6 +1470,7 @@ func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
|
|||||||
name: "libclang_rt.hwasan",
|
name: "libclang_rt.hwasan",
|
||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
srcs: [""],
|
srcs: [""],
|
||||||
@@ -1511,6 +1513,7 @@ func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
|
|||||||
name: "libc",
|
name: "libc",
|
||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stubs: { versions: ["1"] },
|
stubs: { versions: ["1"] },
|
||||||
@@ -1521,6 +1524,7 @@ func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
|
|||||||
name: "libclang_rt.hwasan",
|
name: "libclang_rt.hwasan",
|
||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
srcs: [""],
|
srcs: [""],
|
||||||
|
@@ -24,6 +24,7 @@ var (
|
|||||||
bionicCrtBeginStaticBinary, bionicCrtEndStaticBinary = []string{"crtbegin_static"}, []string{"crtend_android"}
|
bionicCrtBeginStaticBinary, bionicCrtEndStaticBinary = []string{"crtbegin_static"}, []string{"crtend_android"}
|
||||||
bionicCrtBeginSharedBinary, bionicCrtEndSharedBinary = []string{"crtbegin_dynamic"}, []string{"crtend_android"}
|
bionicCrtBeginSharedBinary, bionicCrtEndSharedBinary = []string{"crtbegin_dynamic"}, []string{"crtend_android"}
|
||||||
bionicCrtBeginSharedLibrary, bionicCrtEndSharedLibrary = []string{"crtbegin_so"}, []string{"crtend_so"}
|
bionicCrtBeginSharedLibrary, bionicCrtEndSharedLibrary = []string{"crtbegin_so"}, []string{"crtend_so"}
|
||||||
|
bionicCrtPadSegmentSharedLibrary = []string{"crt_pad_segment"}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (toolchainBionic) Bionic() bool { return true }
|
func (toolchainBionic) Bionic() bool { return true }
|
||||||
@@ -36,9 +37,10 @@ func (toolchainBionic) ExecutableSuffix() string { return "" }
|
|||||||
|
|
||||||
func (toolchainBionic) AvailableLibraries() []string { return nil }
|
func (toolchainBionic) AvailableLibraries() []string { return nil }
|
||||||
|
|
||||||
func (toolchainBionic) CrtBeginStaticBinary() []string { return bionicCrtBeginStaticBinary }
|
func (toolchainBionic) CrtBeginStaticBinary() []string { return bionicCrtBeginStaticBinary }
|
||||||
func (toolchainBionic) CrtBeginSharedBinary() []string { return bionicCrtBeginSharedBinary }
|
func (toolchainBionic) CrtBeginSharedBinary() []string { return bionicCrtBeginSharedBinary }
|
||||||
func (toolchainBionic) CrtBeginSharedLibrary() []string { return bionicCrtBeginSharedLibrary }
|
func (toolchainBionic) CrtBeginSharedLibrary() []string { return bionicCrtBeginSharedLibrary }
|
||||||
func (toolchainBionic) CrtEndStaticBinary() []string { return bionicCrtEndStaticBinary }
|
func (toolchainBionic) CrtEndStaticBinary() []string { return bionicCrtEndStaticBinary }
|
||||||
func (toolchainBionic) CrtEndSharedBinary() []string { return bionicCrtEndSharedBinary }
|
func (toolchainBionic) CrtEndSharedBinary() []string { return bionicCrtEndSharedBinary }
|
||||||
func (toolchainBionic) CrtEndSharedLibrary() []string { return bionicCrtEndSharedLibrary }
|
func (toolchainBionic) CrtEndSharedLibrary() []string { return bionicCrtEndSharedLibrary }
|
||||||
|
func (toolchainBionic) CrtPadSegmentSharedLibrary() []string { return bionicCrtPadSegmentSharedLibrary }
|
||||||
|
@@ -100,6 +100,7 @@ type Toolchain interface {
|
|||||||
CrtEndStaticBinary() []string
|
CrtEndStaticBinary() []string
|
||||||
CrtEndSharedBinary() []string
|
CrtEndSharedBinary() []string
|
||||||
CrtEndSharedLibrary() []string
|
CrtEndSharedLibrary() []string
|
||||||
|
CrtPadSegmentSharedLibrary() []string
|
||||||
|
|
||||||
// DefaultSharedLibraries returns the list of shared libraries that will be added to all
|
// DefaultSharedLibraries returns the list of shared libraries that will be added to all
|
||||||
// targets unless they explicitly specify system_shared_libs.
|
// targets unless they explicitly specify system_shared_libs.
|
||||||
@@ -155,12 +156,13 @@ func (toolchainBase) LibclangRuntimeLibraryArch() string {
|
|||||||
|
|
||||||
type toolchainNoCrt struct{}
|
type toolchainNoCrt struct{}
|
||||||
|
|
||||||
func (toolchainNoCrt) CrtBeginStaticBinary() []string { return nil }
|
func (toolchainNoCrt) CrtBeginStaticBinary() []string { return nil }
|
||||||
func (toolchainNoCrt) CrtBeginSharedBinary() []string { return nil }
|
func (toolchainNoCrt) CrtBeginSharedBinary() []string { return nil }
|
||||||
func (toolchainNoCrt) CrtBeginSharedLibrary() []string { return nil }
|
func (toolchainNoCrt) CrtBeginSharedLibrary() []string { return nil }
|
||||||
func (toolchainNoCrt) CrtEndStaticBinary() []string { return nil }
|
func (toolchainNoCrt) CrtEndStaticBinary() []string { return nil }
|
||||||
func (toolchainNoCrt) CrtEndSharedBinary() []string { return nil }
|
func (toolchainNoCrt) CrtEndSharedBinary() []string { return nil }
|
||||||
func (toolchainNoCrt) CrtEndSharedLibrary() []string { return nil }
|
func (toolchainNoCrt) CrtEndSharedLibrary() []string { return nil }
|
||||||
|
func (toolchainNoCrt) CrtPadSegmentSharedLibrary() []string { return nil }
|
||||||
|
|
||||||
func (toolchainBase) DefaultSharedLibraries() []string {
|
func (toolchainBase) DefaultSharedLibraries() []string {
|
||||||
return nil
|
return nil
|
||||||
|
@@ -328,12 +328,13 @@ type toolchainMusl struct {
|
|||||||
|
|
||||||
func (toolchainMusl) Musl() bool { return true }
|
func (toolchainMusl) Musl() bool { return true }
|
||||||
|
|
||||||
func (toolchainMusl) CrtBeginStaticBinary() []string { return muslCrtBeginStaticBinary }
|
func (toolchainMusl) CrtBeginStaticBinary() []string { return muslCrtBeginStaticBinary }
|
||||||
func (toolchainMusl) CrtBeginSharedBinary() []string { return muslCrtBeginSharedBinary }
|
func (toolchainMusl) CrtBeginSharedBinary() []string { return muslCrtBeginSharedBinary }
|
||||||
func (toolchainMusl) CrtBeginSharedLibrary() []string { return muslCrtBeginSharedLibrary }
|
func (toolchainMusl) CrtBeginSharedLibrary() []string { return muslCrtBeginSharedLibrary }
|
||||||
func (toolchainMusl) CrtEndStaticBinary() []string { return muslCrtEndStaticBinary }
|
func (toolchainMusl) CrtEndStaticBinary() []string { return muslCrtEndStaticBinary }
|
||||||
func (toolchainMusl) CrtEndSharedBinary() []string { return muslCrtEndSharedBinary }
|
func (toolchainMusl) CrtEndSharedBinary() []string { return muslCrtEndSharedBinary }
|
||||||
func (toolchainMusl) CrtEndSharedLibrary() []string { return muslCrtEndSharedLibrary }
|
func (toolchainMusl) CrtEndSharedLibrary() []string { return muslCrtEndSharedLibrary }
|
||||||
|
func (toolchainMusl) CrtPadSegmentSharedLibrary() []string { return nil }
|
||||||
|
|
||||||
func (toolchainMusl) DefaultSharedLibraries() []string { return MuslDefaultSharedLibraries }
|
func (toolchainMusl) DefaultSharedLibraries() []string { return MuslDefaultSharedLibraries }
|
||||||
|
|
||||||
|
@@ -974,6 +974,10 @@ func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
|||||||
if library.baseLinker.Properties.crt() {
|
if library.baseLinker.Properties.crt() {
|
||||||
deps.CrtBegin = append(deps.CrtBegin, ctx.toolchain().CrtBeginSharedLibrary()...)
|
deps.CrtBegin = append(deps.CrtBegin, ctx.toolchain().CrtBeginSharedLibrary()...)
|
||||||
deps.CrtEnd = append(deps.CrtEnd, ctx.toolchain().CrtEndSharedLibrary()...)
|
deps.CrtEnd = append(deps.CrtEnd, ctx.toolchain().CrtEndSharedLibrary()...)
|
||||||
|
|
||||||
|
}
|
||||||
|
if library.baseLinker.Properties.crtPadSegment() {
|
||||||
|
deps.CrtEnd = append(deps.CrtEnd, ctx.toolchain().CrtPadSegmentSharedLibrary()...)
|
||||||
}
|
}
|
||||||
deps.WholeStaticLibs = append(deps.WholeStaticLibs, library.SharedProperties.Shared.Whole_static_libs...)
|
deps.WholeStaticLibs = append(deps.WholeStaticLibs, library.SharedProperties.Shared.Whole_static_libs...)
|
||||||
deps.StaticLibs = append(deps.StaticLibs, library.SharedProperties.Shared.Static_libs...)
|
deps.StaticLibs = append(deps.StaticLibs, library.SharedProperties.Shared.Static_libs...)
|
||||||
|
@@ -91,6 +91,10 @@ type BaseLinkerProperties struct {
|
|||||||
// compiling crt or libc.
|
// compiling crt or libc.
|
||||||
Nocrt *bool `android:"arch_variant"`
|
Nocrt *bool `android:"arch_variant"`
|
||||||
|
|
||||||
|
// don't link in crt_pad_segment. This flag is currently only used internal to
|
||||||
|
// soong for testing and for vndk prebuilt shared libraries.
|
||||||
|
No_crt_pad_segment *bool `android:"arch_variant"`
|
||||||
|
|
||||||
// deprecated and ignored because lld makes it unnecessary. See b/189475744.
|
// deprecated and ignored because lld makes it unnecessary. See b/189475744.
|
||||||
Group_static_libs *bool `android:"arch_variant"`
|
Group_static_libs *bool `android:"arch_variant"`
|
||||||
|
|
||||||
@@ -253,6 +257,10 @@ func (blp *BaseLinkerProperties) libCrt() bool {
|
|||||||
return blp.No_libcrt == nil || !*blp.No_libcrt
|
return blp.No_libcrt == nil || !*blp.No_libcrt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (blp *BaseLinkerProperties) crtPadSegment() bool {
|
||||||
|
return blp.No_crt_pad_segment == nil || !*blp.No_crt_pad_segment
|
||||||
|
}
|
||||||
|
|
||||||
func NewBaseLinker(sanitize *sanitize) *baseLinker {
|
func NewBaseLinker(sanitize *sanitize) *baseLinker {
|
||||||
return &baseLinker{sanitize: sanitize}
|
return &baseLinker{sanitize: sanitize}
|
||||||
}
|
}
|
||||||
|
@@ -77,6 +77,7 @@ func commonDefaultModules() string {
|
|||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
sdk_version: "minimum",
|
sdk_version: "minimum",
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
check_elf_files: false,
|
check_elf_files: false,
|
||||||
@@ -384,6 +385,11 @@ func commonDefaultModules() string {
|
|||||||
objs: ["crtbrand"],
|
objs: ["crtbrand"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_object {
|
||||||
|
name: "crt_pad_segment",
|
||||||
|
defaults: ["crt_defaults"],
|
||||||
|
}
|
||||||
|
|
||||||
cc_object {
|
cc_object {
|
||||||
name: "crtbrand",
|
name: "crtbrand",
|
||||||
defaults: ["crt_defaults"],
|
defaults: ["crt_defaults"],
|
||||||
|
@@ -341,6 +341,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
vendor: true,
|
vendor: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
compile_multilib: "64",
|
compile_multilib: "64",
|
||||||
@@ -458,6 +459,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
vendor: true,
|
vendor: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
}
|
}
|
||||||
@@ -467,6 +469,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
vendor: true,
|
vendor: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
shared_libs: ["libvndk", "libvendor_available", "libllndk"],
|
shared_libs: ["libvndk", "libvendor_available", "libllndk"],
|
||||||
@@ -487,6 +490,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
vendor: true,
|
vendor: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
static_libs: ["libvendor"],
|
static_libs: ["libvendor"],
|
||||||
@@ -501,6 +505,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
vendor: true,
|
vendor: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
vndk: {
|
vndk: {
|
||||||
@@ -597,6 +602,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
target_arch: "arm64",
|
target_arch: "arm64",
|
||||||
compile_multilib: "both",
|
compile_multilib: "both",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"libvendor_without_snapshot",
|
"libvendor_without_snapshot",
|
||||||
"libvendor_available",
|
"libvendor_available",
|
||||||
@@ -620,6 +626,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
target_arch: "arm64",
|
target_arch: "arm64",
|
||||||
compile_multilib: "both",
|
compile_multilib: "both",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
overrides: ["libvendor"],
|
overrides: ["libvendor"],
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"libvendor_without_snapshot",
|
"libvendor_without_snapshot",
|
||||||
@@ -657,6 +664,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
target_arch: "arm64",
|
target_arch: "arm64",
|
||||||
compile_multilib: "32",
|
compile_multilib: "32",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
arch: {
|
arch: {
|
||||||
arm: {
|
arm: {
|
||||||
src: "lib32.so",
|
src: "lib32.so",
|
||||||
@@ -683,6 +691,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
target_arch: "arm64",
|
target_arch: "arm64",
|
||||||
compile_multilib: "64",
|
compile_multilib: "64",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
arch: {
|
arch: {
|
||||||
arm64: {
|
arm64: {
|
||||||
src: "lib64.so",
|
src: "lib64.so",
|
||||||
@@ -722,6 +731,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
target_arch: "arm64",
|
target_arch: "arm64",
|
||||||
compile_multilib: "both",
|
compile_multilib: "both",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
arch: {
|
arch: {
|
||||||
arm64: {
|
arm64: {
|
||||||
src: "libvendor_available.so",
|
src: "libvendor_available.so",
|
||||||
|
@@ -232,6 +232,7 @@ func vndkPrebuiltSharedLibrary() *Module {
|
|||||||
prebuilt.properties.Check_elf_files = BoolPtr(false)
|
prebuilt.properties.Check_elf_files = BoolPtr(false)
|
||||||
prebuilt.baseLinker.Properties.No_libcrt = BoolPtr(true)
|
prebuilt.baseLinker.Properties.No_libcrt = BoolPtr(true)
|
||||||
prebuilt.baseLinker.Properties.Nocrt = BoolPtr(true)
|
prebuilt.baseLinker.Properties.Nocrt = BoolPtr(true)
|
||||||
|
prebuilt.baseLinker.Properties.No_crt_pad_segment = BoolPtr(true)
|
||||||
|
|
||||||
// Prevent default system libs (libc, libm, and libdl) from being linked
|
// Prevent default system libs (libc, libm, and libdl) from being linked
|
||||||
if prebuilt.baseLinker.Properties.System_shared_libs == nil {
|
if prebuilt.baseLinker.Properties.System_shared_libs == nil {
|
||||||
|
@@ -553,6 +553,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
vendor: true,
|
vendor: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
no_libcrt: true,
|
no_libcrt: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
}
|
}
|
||||||
@@ -857,6 +858,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
target_arch: "arm64",
|
target_arch: "arm64",
|
||||||
compile_multilib: "32",
|
compile_multilib: "32",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
arch: {
|
arch: {
|
||||||
arm: {
|
arm: {
|
||||||
src: "lib32.so",
|
src: "lib32.so",
|
||||||
@@ -870,6 +872,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
target_arch: "arm64",
|
target_arch: "arm64",
|
||||||
compile_multilib: "64",
|
compile_multilib: "64",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
arch: {
|
arch: {
|
||||||
arm64: {
|
arm64: {
|
||||||
src: "lib64.so",
|
src: "lib64.so",
|
||||||
@@ -882,6 +885,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
target_arch: "arm64",
|
target_arch: "arm64",
|
||||||
compile_multilib: "64",
|
compile_multilib: "64",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
arch: {
|
arch: {
|
||||||
arm64: {
|
arm64: {
|
||||||
src: "liblog.so",
|
src: "liblog.so",
|
||||||
@@ -913,6 +917,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
target_arch: "arm64",
|
target_arch: "arm64",
|
||||||
compile_multilib: "both",
|
compile_multilib: "both",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
no_crt_pad_segment: true,
|
||||||
arch: {
|
arch: {
|
||||||
arm64: {
|
arm64: {
|
||||||
src: "libvendor_available.so",
|
src: "libvendor_available.so",
|
||||||
|
Reference in New Issue
Block a user