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
This commit is contained in:
Colin Cross
2021-06-29 11:28:24 -07:00
parent 1c19b81e3d
commit 1cd80d9b8b

View File

@@ -85,7 +85,7 @@ func main() {
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 @@ func main() {
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 {