Support prefix_symbols for linker
The linker needs to add __dl_ to the beginning of all of its symbols
to avoid conflicts. Add support for a prefix_symbols property, and
insert an objcopy --prefix_symbols build step to produce the final
binary.
Change-Id: I70de7c830cd64305e5900c6de53efecea2e17c75
diff --git a/cc/cc.go b/cc/cc.go
index 64a7526..8217030 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1271,6 +1271,12 @@
outputFile := filepath.Join(common.ModuleOutDir(ctx), c.getStem(ctx))
c.out = outputFile
+ if c.BinaryProperties.Prefix_symbols != "" {
+ afterPrefixSymbols := outputFile
+ outputFile = outputFile + ".intermediate"
+ TransformBinaryPrefixSymbols(ctx, c.BinaryProperties.Prefix_symbols, outputFile,
+ ccFlagsToBuilderFlags(flags), afterPrefixSymbols)
+ }
TransformObjToDynamicBinary(ctx, objFiles, deps.SharedLibs, deps.StaticLibs,
deps.LateStaticLibs, deps.WholeStaticLibs, deps.CrtBegin, deps.CrtEnd, true,