[lld] [LLD] Add CLASS syntax to SECTIONS (PR #95323)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 09:14:20 PDT 2024


================
@@ -198,13 +198,52 @@ the current location to a max-page-size boundary, ensuring that the next
 LLD will insert ``.relro_padding`` immediately before the symbol assignment
 using ``DATA_SEGMENT_RELRO_END``.
 
+Section Classes
+~~~~~~~~~~~~~~~
+
+``SECTIONS`` commands can define classes of input sections:
+
+::
+
+  SECTIONS {
+    CLASS(class_name) {
----------------
smithp35 wrote:

Can CLASS be used within an OVERLAY. For example using the example from the docs
https://sourceware.org/binutils/docs/ld/Overlay-Description.html
```
OVERLAY 0x1000 : AT (0x4000)
   {
     .text0 { o1/*.o(.text) }
     CLASS(c) { *(.text) }
     .text1 { o2/*.o(.text) ; CLASS(C) }
   }
```
I can't see any reason not to. 

As OVERLAY is a part of a SECTIONS command then I don't think there is a need to explain this in detail. Maybe worth an example and a test to show it working.

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


More information about the llvm-commits mailing list