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

Commit 1cd80d9b authored by Colin Cross's avatar Colin Cross
Browse files

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
parent 1c19b81e
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -85,7 +85,7 @@ func main() {


		fmt.Fprintf(asm, ".globl %s\n%s:\n\n", symName, symName)
		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.Fprintf(script, "    KEEP(*(%s));\n", sectionName)
		fmt.Fprintln(script, "  }")
		fmt.Fprintln(script, "  }")


@@ -106,8 +106,10 @@ func main() {
		load += 1
		load += 1
	}
	}


	fmt.Fprintln(asm, `.section .note.android.embedded_linker,"a",%note`)

	fmt.Fprintln(script, "}")
	fmt.Fprintln(script, "}")
	fmt.Fprintln(script, "INSERT BEFORE .note.android.ident;")
	fmt.Fprintln(script, "INSERT BEFORE .note.android.embedded_linker;")


	if asmPath != "" {
	if asmPath != "" {
		if err := ioutil.WriteFile(asmPath, asm.Bytes(), 0777); err != nil {
		if err := ioutil.WriteFile(asmPath, asm.Bytes(), 0777); err != nil {