[lld] [ELF] Move target-specific synthetic sections into Arch/ files (PR #184057)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 07:27:21 PST 2026


================
@@ -32,6 +32,7 @@ class TargetInfo {
 public:
   TargetInfo(Ctx &ctx) : ctx(ctx) {}
   virtual uint32_t calcEFlags() const { return 0; }
+  virtual void initTargetSections() {}
----------------
smithp35 wrote:

perhaps `initTargetSpecificSections()` 

I think it would be worth progressively adding some documentation to Target.h to guide new contributors into following the intended design. For example:
```
When possible, all target specific SyntheticSections should be declared and defined in the source file defining the Target. The initTargetSections() implementation is responsible for creating the SyntheticSections and adding them to ctx.in and ctx.inputSections as appropriate.
```

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


More information about the llvm-commits mailing list