[lld] 0d8bc10 - [ELF] Memory region: support quoted names

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 27 16:39:19 PDT 2024


Author: Fangrui Song
Date: 2024-07-27T16:39:15-07:00
New Revision: 0d8bc10acb46f5c7af3a7df3e5550c0fef3cc8b5

URL: https://github.com/llvm/llvm-project/commit/0d8bc10acb46f5c7af3a7df3e5550c0fef3cc8b5
DIFF: https://github.com/llvm/llvm-project/commit/0d8bc10acb46f5c7af3a7df3e5550c0fef3cc8b5.diff

LOG: [ELF] Memory region: support quoted names

Added: 
    

Modified: 
    lld/ELF/ScriptParser.cpp
    lld/test/ELF/linkerscript/at2.test
    lld/test/ELF/linkerscript/at3.test

Removed: 
    


################################################################################
diff  --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 1fd1084e237fc..0ff648fb310a3 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -1040,11 +1040,11 @@ OutputDesc *ScriptParser::readOutputSectionDescription(StringRef outSec) {
   }
 
   if (consume(">"))
-    osec->memoryRegionName = std::string(next());
+    osec->memoryRegionName = std::string(readName());
 
   if (consume("AT")) {
     expect(">");
-    osec->lmaRegionName = std::string(next());
+    osec->lmaRegionName = std::string(readName());
   }
 
   if (osec->lmaExpr && !osec->lmaRegionName.empty())

diff  --git a/lld/test/ELF/linkerscript/at2.test b/lld/test/ELF/linkerscript/at2.test
index d744fce911b48..24c49350dcfb3 100644
--- a/lld/test/ELF/linkerscript/at2.test
+++ b/lld/test/ELF/linkerscript/at2.test
@@ -19,7 +19,7 @@ SECTIONS {
  .foo2 : { *(.foo2) } > AX
 
  .bar1 : { *(.bar1) } > AW
- .bar2 : { *(.bar2) } > AW AT > RAM
+ .bar2 : { *(.bar2) } > "AW" AT > "RAM"
  .bar3 . : { *(.bar3) } > AW
  .bar4 : { *(.bar4) } > AW AT >RAM
 }

diff  --git a/lld/test/ELF/linkerscript/at3.test b/lld/test/ELF/linkerscript/at3.test
index 1e7f970c63ef3..4d6d753f6ab7d 100644
--- a/lld/test/ELF/linkerscript/at3.test
+++ b/lld/test/ELF/linkerscript/at3.test
@@ -13,7 +13,7 @@ MEMORY {
 SECTIONS {
  .foo1 : { *(.foo1) }            > FOO AT>FLASH
  .foo2 : { *(.foo2) BYTE(0x42) } > BAR AT>FLASH
- .foo3 : { *(.foo3) }            > ZED AT>FLASH
+ .foo3 : { *(.foo3) }            >"ZED" AT>"FLASH"
 }
 
 # CHECK: .foo1             PROGBITS        0000000000001000 001000


        


More information about the llvm-commits mailing list