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

Commit 9deb87e8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Escape cc ldflags in bp2build conversion"

parents 11181743 f38a8379
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -2437,3 +2437,18 @@ cc_library {
	},
	)
}

func TestCcLibraryEscapeLdflags(t *testing.T) {
	runCcLibraryTestCase(t, bp2buildTestCase{
		moduleTypeUnderTest:        "cc_library",
		moduleTypeUnderTestFactory: cc.LibraryFactory,
		blueprint: soongCcProtoPreamble + `cc_library {
	name: "foo",
	ldflags: ["-Wl,--rpath,${ORIGIN}"],
	include_build_directory: false,
}`,
		expectedBazelTargets: makeCcLibraryTargets("foo", attrNameToString{
			"linkopts": `["-Wl,--rpath,$${ORIGIN}"]`,
		}),
	})
}
+1 −1
Original line number Diff line number Diff line
@@ -644,7 +644,7 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion

	var linkerFlags []string
	if len(props.Ldflags) > 0 {
		linkerFlags = append(linkerFlags, props.Ldflags...)
		linkerFlags = append(linkerFlags, proptools.NinjaEscapeList(props.Ldflags)...)
		// binaries remove static flag if -shared is in the linker flags
		if isBinary && android.InList("-shared", linkerFlags) {
			axisFeatures = append(axisFeatures, "-static_flag")