Skip to content

[lld][ELF] Delete useless assertions #98028

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

Closed
wants to merge 1 commit into from

Conversation

kovdan01
Copy link
Contributor

@kovdan01 kovdan01 commented Jul 8, 2024

Assertions in the member functions below are considered not useful. See #96169 (comment)

  • GotSection::addEntry
  • GotSection::addTlsDescEntry
  • GotSection::addDynTlsEntry

Assertions in the member functions below are considered not useful. See
llvm#96169 (comment)

- `GotSection::addEntry`
- `GotSection::addTlsDescEntry`
- `GotSection::addDynTlsEntry`
@kovdan01 kovdan01 requested review from asl and MaskRay July 8, 2024 14:23
@kovdan01 kovdan01 self-assigned this Jul 8, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 8, 2024

@llvm/pr-subscribers-lld

@llvm/pr-subscribers-lld-elf

Author: Daniil Kovalev (kovdan01)

Changes

Assertions in the member functions below are considered not useful. See #96169 (comment)

  • GotSection::addEntry
  • GotSection::addTlsDescEntry
  • GotSection::addDynTlsEntry

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

1 Files Affected:

  • (modified) lld/ELF/SyntheticSections.cpp (-3)
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 5d3f3df216b85..624dfd94ce8bf 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -653,19 +653,16 @@ GotSection::GotSection()
 
 void GotSection::addConstant(const Relocation &r) { relocations.push_back(r); }
 void GotSection::addEntry(const Symbol &sym) {
-  assert(sym.auxIdx == symAux.size() - 1);
   symAux.back().gotIdx = numEntries++;
 }
 
 bool GotSection::addTlsDescEntry(const Symbol &sym) {
-  assert(sym.auxIdx == symAux.size() - 1);
   symAux.back().tlsDescIdx = numEntries;
   numEntries += 2;
   return true;
 }
 
 bool GotSection::addDynTlsEntry(const Symbol &sym) {
-  assert(sym.auxIdx == symAux.size() - 1);
   symAux.back().tlsGdIdx = numEntries;
   // Global Dynamic TLS entries take two GOT slots.
   numEntries += 2;

@MaskRay
Copy link
Member

MaskRay commented Jul 8, 2024

assert(sym.auxIdx == symAux.size() - 1); assertions are useful to prevent allocating more than one entries for one symbol. I used the assertions to prevent some failures. NEEDS_GOT_AUTH is clearly AArch64 specific.

@MaskRay MaskRay closed this Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants