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

Commit 4dac3874 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Use SHT_RELR relocations where possible."

parents ccbbeb69 8df4b3dc
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -421,9 +421,13 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
		if !BoolDefault(linker.Properties.Pack_relocations, true) {
			flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=none")
		} else if ctx.Device() {
			// The SHT_RELR relocations is only supported by API level >= 28.
			// Do not turn this on if older version NDK is used.
			if !ctx.useSdk() || CheckSdkVersionAtLeast(ctx, 28) {
			// SHT_RELR relocations are only supported at API level >= 30.
			// ANDROID_RELR relocations were supported at API level >= 28.
			// Relocation packer was supported at API level >= 23.
			// Do the best we can...
			if !ctx.useSdk() || CheckSdkVersionAtLeast(ctx, 30) {
				flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=android+relr")
			} else if CheckSdkVersionAtLeast(ctx, 28) {
				flags.Global.LdFlags = append(flags.Global.LdFlags,
					"-Wl,--pack-dyn-relocs=android+relr",
					"-Wl,--use-android-relr-tags")