[ELF] createSyntheticSections: simplify config->relocatable. NFC
authorFangrui Song <i@maskray.me>
Wed, 23 Nov 2022 04:09:15 +0000 (20:09 -0800)
committerFangrui Song <i@maskray.me>
Wed, 23 Nov 2022 04:09:15 +0000 (20:09 -0800)
We can add .riscv.attributes synthetic section here in the future.

lld/ELF/Writer.cpp

index eb5ebc8..ae2b7ff 100644 (file)
@@ -398,13 +398,12 @@ template <class ELFT> void elf::createSyntheticSections() {
       }
       part.ehFrame = std::make_unique<EhFrameSection>();
       add(*part.ehFrame);
-    }
 
-    if (config->emachine == EM_ARM && !config->relocatable) {
-      // The ARMExidxsyntheticsection replaces all the individual .ARM.exidx
-      // InputSections.
-      part.armExidx = std::make_unique<ARMExidxSyntheticSection>();
-      add(*part.armExidx);
+      if (config->emachine == EM_ARM) {
+        // This section replaces all the individual .ARM.exidx InputSections.
+        part.armExidx = std::make_unique<ARMExidxSyntheticSection>();
+        add(*part.armExidx);
+      }
     }
 
     if (!config->packageMetadata.empty()) {