Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] clang driver should default to gnu hashes if the target api level is >= 23? #2005

Closed
enh-google opened this issue Mar 18, 2024 · 7 comments
Assignees

Comments

@enh-google
Copy link
Collaborator

enh-google commented Mar 18, 2024

Description

currently we have this in the android build system:

// 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",

and presumably similar stuff elsewhere. seems like that should just be the driver's problem instead?

@pirama-arumuga-nainar

@rprichard
Copy link
Collaborator

I think we already have this enhancement:

https://github.com/llvm/llvm-project/blob/ea72c082bc29fdceca33f37477b7588f31630a5f/clang/lib/Driver/ToolChains/Linux.cpp#L277-L290

  if (!IsMips && !IsHexagon) {
    if (Distro.IsOpenSUSE() || Distro == Distro::UbuntuLucid ||
        Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic ||
        (IsAndroid && Triple.isAndroidVersionLT(23)))
      ExtraOpts.push_back("--hash-style=both");
    else
      ExtraOpts.push_back("--hash-style=gnu");
  }

@rprichard
Copy link
Collaborator

It looks like @DanAlbert added it in 2018, https://reviews.llvm.org/D53118.

@pirama-arumuga-nainar
Copy link
Collaborator

pirama-arumuga-nainar commented Mar 18, 2024

Nice - it covers non-Android triples as well. I think we can remove all instances of this flag in https://cs.android.com/search?q=hash-style%3Dgnu%20file:build%2Fsoong&sq=&ss=android.

@enh-google
Copy link
Collaborator Author

awesome! i'll just update the docs, remove the cruft from our build system (once my outstanding comment cl is in, anyway), and call this "done"...

@enh-google enh-google self-assigned this Mar 19, 2024
@enh-google
Copy link
Collaborator Author

@DanAlbert
Copy link
Member

Duplicate of #883.

@DanAlbert DanAlbert closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2024
@enh-google
Copy link
Collaborator Author

https://android-review.googlesource.com/c/platform/build/soong/+/3007713 removes the obsolete workarounds from the build system.

jrguzman-ms pushed a commit to msft-mirror-aosp/platform.build.soong that referenced this issue Mar 21, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants