[PATCH] D56060: ELF: BLOCK Keyword linker script support

Martell Malone via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 23 08:51:00 PST 2018


martell created this revision.
martell added a reviewer: ruiu.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
martell added a comment.

I'm not sure if we should change the linker script or add BLOCK

https://github.com/ClangBuiltLinux/linux/issues/253


When Linking ppc64 with lld

ld.lld: error: ./arch/powerpc/kernel/vmlinux.lds:73: unknown section directive: 0

/*

- BLOCK(0) overrides the default output section alignment because
- this needs to start right after .head.text in order for fixed
- section placement to work. */

.text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D56060

Files:
  ELF/ScriptParser.cpp
  test/ELF/linkerscript/align-r.test


Index: test/ELF/linkerscript/align-r.test
===================================================================
--- test/ELF/linkerscript/align-r.test
+++ test/ELF/linkerscript/align-r.test
@@ -17,5 +17,5 @@
   . = 0x10000;
   .aaa : { *(.aaa) }
   .bbb : ALIGN(4096) { *(.bbb) }
-  .ccc : ALIGN(4096 * 4) { *(.ccc) }
+  .ccc : BLOCK(4096 * 4) { *(.ccc) }
 }
Index: ELF/ScriptParser.cpp
===================================================================
--- ELF/ScriptParser.cpp
+++ ELF/ScriptParser.cpp
@@ -821,7 +821,7 @@
   std::string Location = getCurrentLocation();
   if (consume("AT"))
     Cmd->LMAExpr = readParenExpr();
-  if (consume("ALIGN"))
+  if (consume("ALIGN") || consume("BLOCK"))
     Cmd->AlignExpr = checkAlignment(readParenExpr(), Location);
   if (consume("SUBALIGN"))
     Cmd->SubalignExpr = checkAlignment(readParenExpr(), Location);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56060.179449.patch
Type: text/x-patch
Size: 861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181223/1f3be70a/attachment.bin>


More information about the llvm-commits mailing list