[lld] 9eb1f2d - [ELF] Remove a special case from ExprValue::getSectionOffset. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 17:45:57 PDT 2023


Author: Fangrui Song
Date: 2023-09-15T17:45:52-07:00
New Revision: 9eb1f2d0ace33ada64c7ec816e1b24414c12b030

URL: https://github.com/llvm/llvm-project/commit/9eb1f2d0ace33ada64c7ec816e1b24414c12b030
DIFF: https://github.com/llvm/llvm-project/commit/9eb1f2d0ace33ada64c7ec816e1b24414c12b030.diff

LOG: [ELF] Remove a special case from ExprValue::getSectionOffset. NFC

The special cases added by https://reviews.llvm.org/D42911
(defsym-reserved-syms.s) are unneeded after https://reviews.llvm.org/D66717

Added: 
    

Modified: 
    lld/ELF/LinkerScript.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 77d13e54de125ca..943fd865ae0c15c 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -122,11 +122,6 @@ uint64_t ExprValue::getSecAddr() const {
 }
 
 uint64_t ExprValue::getSectionOffset() const {
-  // If the alignment is trivial, we don't have to compute the full
-  // value to know the offset. This allows this function to succeed in
-  // cases where the output section is not yet known.
-  if (alignment == 1 && !sec)
-    return val;
   return getValue() - getSecAddr();
 }
 


        


More information about the llvm-commits mailing list