Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8544683 authored by Colin Cross's avatar Colin Cross
Browse files

Add DefaultSharedLibraries to Toolchain

Move the default value for system_shared_libs out of linker.go and into
a new DefaultSharedLibraries method in Toolchain.  This will simplify
adding system_shared_libs to cc_object, and adding new toolchains with
different default system_shared_libs.

Test: m checkbuild
Test: go test ./cc/...
Change-Id: I422315f090be20719c08a4d33bd39b0b26a93d6c
parent e3fee34a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -17,4 +17,10 @@ package config
type toolchainBionic struct {
}

var (
	bionicDefaultSharedLibraries = []string{"libc", "libm", "libdl"}
)

func (toolchainBionic) Bionic() bool { return true }

func (toolchainBionic) DefaultSharedLibraries() []string { return bionicDefaultSharedLibraries }
+9 −1
Original line number Diff line number Diff line
@@ -106,6 +106,10 @@ type Toolchain interface {

	AvailableLibraries() []string

	// DefaultSharedLibraries returns the list of shared libraries that will be added to all
	// targets unless they explicitly specify system_shared_libs.
	DefaultSharedLibraries() []string

	Bionic() bool
}

@@ -165,7 +169,11 @@ func (toolchainBase) LibclangRuntimeLibraryArch() string {
}

func (toolchainBase) AvailableLibraries() []string {
	return []string{}
	return nil
}

func (toolchainBase) DefaultSharedLibraries() []string {
	return nil
}

func (toolchainBase) Bionic() bool {
+3 −3
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
			// Provide a default system_shared_libs if it is unspecified. Note: If an
			// empty list [] is specified, it implies that the module declines the
			// default system_shared_libs.
			deps.SystemSharedLibs = []string{"libc", "libm", "libdl"}
			deps.SystemSharedLibs = append(deps.SystemSharedLibs, ctx.toolchain().DefaultSharedLibraries()...)
		}

		if inList("libdl", deps.SharedLibs) {
@@ -365,9 +365,9 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
			indexList("libdl", deps.SystemSharedLibs) < indexList("libc", deps.SystemSharedLibs) {
			ctx.PropertyErrorf("system_shared_libs", "libdl must be after libc")
		}
	}

	deps.LateSharedLibs = append(deps.LateSharedLibs, deps.SystemSharedLibs...)
	}

	if ctx.Fuchsia() {
		if ctx.ModuleName() != "libbioniccompat" &&