Skip to content

Commit

Permalink
Defer to clang for --hash-style.
Browse files Browse the repository at this point in the history
We fixed the clang driver to "do the right thing" based on target api level years ago, but these manual workarounds predate that (or were copy & pasted from places that predated that). We don't need them any more.

See android/ndk#2005 for more detail.

Change-Id: I995741b8606e389e8de8272f1cc532624516245a
  • Loading branch information
enh-google committed Mar 20, 2024
1 parent 97409cd commit b48fb83
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 20 deletions.
1 change: 0 additions & 1 deletion cc/config/arm64_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ var (
}

arm64Ldflags = []string{
"-Wl,--hash-style=gnu",
"-Wl,-z,separate-code",
"-Wl,-z,separate-loadable-segments",
}
Expand Down
1 change: 0 additions & 1 deletion cc/config/arm64_linux_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ var (
"-Wl,-z,now",
"-Wl,--build-id=md5",
"-Wl,--fatal-warnings",
"-Wl,--hash-style=gnu",
"-Wl,--no-undefined-version",
}

Expand Down
1 change: 0 additions & 1 deletion cc/config/arm_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var (
}

armLdflags = []string{
"-Wl,--hash-style=gnu",
"-Wl,-m,armelf",
// Revert this after b/322359235 is fixed
"-Wl,-mllvm", "-Wl,-enable-shrink-wrap=false",
Expand Down
5 changes: 0 additions & 5 deletions cc/config/riscv64_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ var (
riscv64ArchVariantCflags = map[string][]string{}

riscv64Ldflags = []string{
// TODO: sysv hashes are the default for other architectures because gnu
// hashes weren't supported until api level 23, but riscv64 didn't exist
// back then, and could move today...
// https://android.googlesource.com/platform/bionic/+/main/android-changes-for-ndk-developers.md#gnu-hashes-availible-in-api-level-23
"-Wl,--hash-style=gnu",
// This is already the driver's Android default, but duplicated here (and
// above) for ease of experimentation with additional extensions.
"-march=rv64gcv_zba_zbb_zbs",
Expand Down
1 change: 0 additions & 1 deletion cc/config/x86_64_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ var (
x86_64Cppflags = []string{}

x86_64Ldflags = []string{
"-Wl,--hash-style=gnu",
"-Wl,-z,separate-loadable-segments",
}

Expand Down
4 changes: 1 addition & 3 deletions cc/config/x86_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ var (

x86Cppflags = []string{}

x86Ldflags = []string{
"-Wl,--hash-style=gnu",
}
x86Ldflags = []string{}

x86ArchVariantCflags = map[string][]string{
"": []string{
Expand Down
1 change: 0 additions & 1 deletion cc/config/x86_linux_bionic_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ var (
"-Wl,-z,now",
"-Wl,--build-id=md5",
"-Wl,--fatal-warnings",
"-Wl,--hash-style=gnu",
"-Wl,--no-undefined-version",

// Use the device gcc toolchain
Expand Down
7 changes: 0 additions & 7 deletions cc/linker.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,6 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
flags.Global.LdFlags = append(flags.Global.LdFlags, RpathFlags(ctx)...)
}

if ctx.useSdk() {
// The bionic linker now has support gnu style hashes (which are much faster!), but shipping
// to older devices requires the old style hash. Fortunately, we can build with both and
// it'll work anywhere.
flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--hash-style=both")
}

flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.ToolchainLdflags())

// Version_script is not needed when linking stubs lib where the version
Expand Down

0 comments on commit b48fb83

Please sign in to comment.