[lld] [llvm] [LLD] Add support for two special OpenBSD sections (PR #97122)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 18:14:21 PDT 2024


================
@@ -2273,10 +2279,26 @@ SmallVector<PhdrEntry *, 0> Writer<ELFT>::createPhdrs(Partition &part) {
     addHdr(PT_GNU_EH_FRAME, part.ehFrameHdr->getParent()->getPhdrFlags())
         ->add(part.ehFrameHdr->getParent());
 
-  // PT_OPENBSD_RANDOMIZE is an OpenBSD-specific feature. That makes
-  // the dynamic linker fill the segment with random data.
-  if (OutputSection *cmd = findSection(".openbsd.randomdata", partNo))
-    addHdr(PT_OPENBSD_RANDOMIZE, cmd->getPhdrFlags())->add(cmd);
+  // Handle OpenBSD-specific section types for OpenBSD "OS ABI".
+  //
+  // Scoped to just this "OS ABI" because, as is written below "section
----------------
MaskRay wrote:

The comment "as is written .. " can be deleted. It's clear that `if (config->osabi == ELFOSABI_OPENBSD)` doesn't apply to other OSes.

https://github.com/llvm/llvm-project/pull/97122


More information about the llvm-commits mailing list