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

Commit 03156929 authored by Thiébaud Weksteen's avatar Thiébaud Weksteen Committed by Gerrit Code Review
Browse files

Merge "cc: export Stripper struct"

parents 38414db4 d458745f
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ func binaryHostFactory() android.Module {
type binaryDecorator struct {
	*baseLinker
	*baseInstaller
	stripper
	stripper Stripper

	Properties BinaryLinkerProperties

@@ -317,14 +317,14 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
	}

	builderFlags := flagsToBuilderFlags(flags)

	if binary.stripper.needsStrip(ctx) {
	stripFlags := flagsToStripFlags(flags)
	if binary.stripper.NeedsStrip(ctx) {
		if ctx.Darwin() {
			builderFlags.stripUseGnuStrip = true
			stripFlags.StripUseGnuStrip = true
		}
		strippedOutputFile := outputFile
		outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
		binary.stripper.stripExecutableOrSharedLib(ctx, outputFile, strippedOutputFile, builderFlags)
		binary.stripper.StripExecutableOrSharedLib(ctx, outputFile, strippedOutputFile, stripFlags)
	}

	binary.unstrippedOutputFile = outputFile
@@ -333,7 +333,7 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
		afterPrefixSymbols := outputFile
		outputFile = android.PathForModuleOut(ctx, "unprefixed", fileName)
		TransformBinaryPrefixSymbols(ctx, String(binary.Properties.Prefix_symbols), outputFile,
			flagsToBuilderFlags(flags), afterPrefixSymbols)
			builderFlags, afterPrefixSymbols)
	}

	outputFile = maybeInjectBoringSSLHash(ctx, outputFile, binary.Properties.Inject_bssl_hash, fileName)
@@ -347,10 +347,10 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
			versionedOutputFile := android.PathForModuleOut(ctx, "versioned", fileName)
			binary.distFiles = android.MakeDefaultDistFiles(versionedOutputFile)

			if binary.stripper.needsStrip(ctx) {
			if binary.stripper.NeedsStrip(ctx) {
				out := android.PathForModuleOut(ctx, "versioned-stripped", fileName)
				binary.distFiles = android.MakeDefaultDistFiles(out)
				binary.stripper.stripExecutableOrSharedLib(ctx, versionedOutputFile, out, builderFlags)
				binary.stripper.StripExecutableOrSharedLib(ctx, versionedOutputFile, out, stripFlags)
			}

			binary.injectVersionSymbol(ctx, outputFile, versionedOutputFile)
+19 −16
Original line number Diff line number Diff line
@@ -349,13 +349,6 @@ type builderFlags struct {

	groupStaticLibs bool

	stripKeepSymbols              bool
	stripKeepSymbolsList          string
	stripKeepSymbolsAndDebugFrame bool
	stripKeepMiniDebugInfo        bool
	stripAddGnuDebuglink          bool
	stripUseGnuStrip              bool

	proto            android.ProtoFlags
	protoC           bool
	protoOptionsFile bool
@@ -363,6 +356,16 @@ type builderFlags struct {
	yacc *YaccProperties
}

type StripFlags struct {
	Toolchain                     config.Toolchain
	StripKeepSymbols              bool
	StripKeepSymbolsList          string
	StripKeepSymbolsAndDebugFrame bool
	StripKeepMiniDebugInfo        bool
	StripAddGnuDebuglink          bool
	StripUseGnuStrip              bool
}

type Objects struct {
	objFiles      android.Paths
	tidyFiles     android.Paths
@@ -939,26 +942,26 @@ func TransformBinaryPrefixSymbols(ctx android.ModuleContext, prefix string, inpu
}

func TransformStrip(ctx android.ModuleContext, inputFile android.Path,
	outputFile android.WritablePath, flags builderFlags) {
	outputFile android.WritablePath, flags StripFlags) {

	crossCompile := gccCmd(flags.toolchain, "")
	crossCompile := gccCmd(flags.Toolchain, "")
	args := ""
	if flags.stripAddGnuDebuglink {
	if flags.StripAddGnuDebuglink {
		args += " --add-gnu-debuglink"
	}
	if flags.stripKeepMiniDebugInfo {
	if flags.StripKeepMiniDebugInfo {
		args += " --keep-mini-debug-info"
	}
	if flags.stripKeepSymbols {
	if flags.StripKeepSymbols {
		args += " --keep-symbols"
	}
	if flags.stripKeepSymbolsList != "" {
		args += " -k" + flags.stripKeepSymbolsList
	if flags.StripKeepSymbolsList != "" {
		args += " -k" + flags.StripKeepSymbolsList
	}
	if flags.stripKeepSymbolsAndDebugFrame {
	if flags.StripKeepSymbolsAndDebugFrame {
		args += " --keep-symbols-and-debug-frame"
	}
	if flags.stripUseGnuStrip {
	if flags.StripUseGnuStrip {
		args += " --use-gnu-strip"
	}

+11 −6
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ type libraryDecorator struct {
	tocFile android.OptionalPath

	flagExporter
	stripper
	stripper Stripper

	// If we're used as a whole_static_lib, our missing dependencies need
	// to be given
@@ -955,13 +955,14 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
	library.tocFile = android.OptionalPathForPath(tocFile)
	TransformSharedObjectToToc(ctx, outputFile, tocFile, builderFlags)

	if library.stripper.needsStrip(ctx) {
	stripFlags := flagsToStripFlags(flags)
	if library.stripper.NeedsStrip(ctx) {
		if ctx.Darwin() {
			builderFlags.stripUseGnuStrip = true
			stripFlags.StripUseGnuStrip = true
		}
		strippedOutputFile := outputFile
		outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
		library.stripper.stripExecutableOrSharedLib(ctx, outputFile, strippedOutputFile, builderFlags)
		library.stripper.StripExecutableOrSharedLib(ctx, outputFile, strippedOutputFile, stripFlags)
	}
	library.unstrippedOutputFile = outputFile

@@ -976,10 +977,10 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
			versionedOutputFile := android.PathForModuleOut(ctx, "versioned", fileName)
			library.distFile = versionedOutputFile

			if library.stripper.needsStrip(ctx) {
			if library.stripper.NeedsStrip(ctx) {
				out := android.PathForModuleOut(ctx, "versioned-stripped", fileName)
				library.distFile = out
				library.stripper.stripExecutableOrSharedLib(ctx, versionedOutputFile, out, builderFlags)
				library.stripper.StripExecutableOrSharedLib(ctx, versionedOutputFile, out, stripFlags)
			}

			library.injectVersionSymbol(ctx, outputFile, versionedOutputFile)
@@ -1027,6 +1028,10 @@ func (library *libraryDecorator) unstrippedOutputFilePath() android.Path {
	return library.unstrippedOutputFile
}

func (library *libraryDecorator) disableStripping() {
	library.stripper.StripProperties.Strip.None = BoolPtr(true)
}

func (library *libraryDecorator) nativeCoverage() bool {
	if library.header() || library.buildStubs() {
		return false
+1 −1
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ func NewLLndkStubLibrary() *Module {
	library.BuildOnlyShared()
	module.stl = nil
	module.sanitize = nil
	library.StripProperties.Strip.None = BoolPtr(true)
	library.disableStripping()

	stub := &llndkStubDecorator{
		libraryDecorator: library,
+1 −1
Original line number Diff line number Diff line
@@ -405,7 +405,7 @@ func newStubLibrary() *Module {
	library.BuildOnlyShared()
	module.stl = nil
	module.sanitize = nil
	library.StripProperties.Strip.None = BoolPtr(true)
	library.disableStripping()

	stub := &stubDecorator{
		libraryDecorator: library,
Loading