Use note in linker.s to place linker
Use a note added to linker.s to place the linker in the linker script,
which will work musl, which doesn't have .note.android.ident, while
continuing to work for linux bionic.
Test: m checkbuild
Change-Id: I9cd4ad7c8e8fcb4d725746106d5beaa699a77807
diff --git a/cmd/extract_linker/main.go b/cmd/extract_linker/main.go
index 2dcb894..f1f7bc7 100644
--- a/cmd/extract_linker/main.go
+++ b/cmd/extract_linker/main.go
@@ -85,7 +85,7 @@
fmt.Fprintf(asm, ".globl %s\n%s:\n\n", symName, symName)
- fmt.Fprintf(script, " %s %d : {\n", sectionName, baseLoadAddr+prog.Vaddr)
+ fmt.Fprintf(script, " %s 0x%x : {\n", sectionName, baseLoadAddr+prog.Vaddr)
fmt.Fprintf(script, " KEEP(*(%s));\n", sectionName)
fmt.Fprintln(script, " }")
@@ -106,8 +106,10 @@
load += 1
}
+ fmt.Fprintln(asm, `.section .note.android.embedded_linker,"a",%note`)
+
fmt.Fprintln(script, "}")
- fmt.Fprintln(script, "INSERT BEFORE .note.android.ident;")
+ fmt.Fprintln(script, "INSERT BEFORE .note.android.embedded_linker;")
if asmPath != "" {
if err := ioutil.WriteFile(asmPath, asm.Bytes(), 0777); err != nil {