[lld] [lld][COFF] Fix: Merge `.drectve` sections in ObjFile::readSections (PR #86380)

Rickey Bowers Jr. via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 20:24:18 PDT 2024


================
@@ -89,16 +89,16 @@ class InputFile {
   // An archive file name if this file is created from an archive.
   StringRef parentName;
 
-  // Returns .drectve section contents if exist.
-  StringRef getDirectives() { return directives; }
+  // Returns .drectve section(s) content if exist.
+  llvm::SmallVector<StringRef, 0>  getDrectves() { return directives; }
 
   COFFLinkerContext &ctx;
 
 protected:
   InputFile(COFFLinkerContext &c, Kind k, MemoryBufferRef m, bool lazy = false)
       : mb(m), ctx(c), fileKind(k), lazy(lazy) {}
 
-  StringRef directives;
+  llvm::SmallVector<StringRef, 0> directives;
----------------
bitRAKE wrote:

If I understand the type correctly, it allocates 64 bytes minimum on the stack -- however any items that equates to (once overhead is subtracted, of course). Having the code reflect the intent is useful, though.

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


More information about the llvm-commits mailing list