Skip to content

[Hashing] Remove Clang<=11 -fno-pic workaround #110952

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

Merged
merged 1 commit into from
Oct 3, 2024
Merged

Conversation

MaskRay
Copy link
Member

@MaskRay MaskRay commented Oct 3, 2024

If the LLVM build and an API user have different
(!defined(__clang__) || __clang_major__ > 11) values, we will have a non-benign ODR violation and some users prefer a clear error to silent breakage.

The Clang<=11 -fno-pic x86-64 workaround is likely not useful anyway because builds are mostly PIC (POSITION_INDEPENDENT_CODE or LLVM_ENABLE_PIC).

If the LLVM build and an API user have different
`(!defined(__clang__) || __clang_major__ > 11)` values, we will have a
non-benign ODR violation and some users prefer a clear error to silent
breakage.

The Clang<=11 -fno-pic x86-64 workaround is likely not useful anyway
because builds are mostly PIC (`POSITION_INDEPENDENT_CODE` or
LLVM_ENABLE_PIC).
@MaskRay MaskRay requested review from nikic and chsigg October 3, 2024 03:44
@llvmbot
Copy link
Member

llvmbot commented Oct 3, 2024

@llvm/pr-subscribers-llvm-adt

Author: Fangrui Song (MaskRay)

Changes

If the LLVM build and an API user have different
(!defined(__clang__) || __clang_major__ &gt; 11) values, we will have a non-benign ODR violation and some users prefer a clear error to silent breakage.

The Clang<=11 -fno-pic x86-64 workaround is likely not useful anyway because builds are mostly PIC (POSITION_INDEPENDENT_CODE or LLVM_ENABLE_PIC).


Full diff: https://github.com/llvm/llvm-project/pull/110952.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/Hashing.h (+1-4)
diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h
index 109966257b51c0..17dcf31c616aa7 100644
--- a/llvm/include/llvm/ADT/Hashing.h
+++ b/llvm/include/llvm/ADT/Hashing.h
@@ -311,10 +311,7 @@ struct hash_state {
 /// depend on the particular hash values. On platforms without ASLR, this is
 /// still likely non-deterministic per build.
 inline uint64_t get_execution_seed() {
-  // Work around x86-64 negative offset folding for old Clang -fno-pic
-  // https://reviews.llvm.org/D93931
-#if LLVM_ENABLE_ABI_BREAKING_CHECKS &&                                         \
-    (!defined(__clang__) || __clang_major__ > 11)
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
   return static_cast<uint64_t>(
       reinterpret_cast<uintptr_t>(&install_fatal_error_handler));
 #else

Copy link
Contributor

@chsigg chsigg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is acceptable, I'm all for it. Thank you very much.

@MaskRay MaskRay merged commit def9550 into llvm:main Oct 3, 2024
10 checks passed
@MaskRay MaskRay deleted the hashing branch October 3, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants