[PATCH] D41397: [ELF] - Fix for ld.lld does not accept "AT" syntax for declaring LMA region
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 10:16:36 PST 2018
George Rimar via Phabricator <reviews at reviews.llvm.org> writes:
> Index: test/ELF/linkerscript/at2.s
> ===================================================================
> --- test/ELF/linkerscript/at2.s
> +++ test/ELF/linkerscript/at2.s
> @@ -0,0 +1,68 @@
> +# REQUIRES: x86
> +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
> +# RUN: echo "MEMORY { \
> +# RUN: FLASH (ax) : ORIGIN = 0x2000, LENGTH = 0x100 \
> +# RUN: RAM (aw) : ORIGIN = 0x5000, LENGTH = 0x100 } \
> +# RUN: SECTIONS { \
> +# RUN: .foo1 : { *(.foo1) } > FLASH AT>FLASH \
> +# RUN: .foo2 : { *(.foo2) } > FLASH \
> +# RUN: .bar1 : { *(.bar1) } > RAM AT> RAM \
> +# RUN: .bar2 : { *(.bar2) } > RAM AT > RAM \
> +# RUN: .bar3 : { *(.bar3) } > RAM AT >RAM \
> +# RUN: }" > %t.script
> +# RUN: ld.lld %t --script %t.script -o %t2
> +# RUN: llvm-readobj -program-headers %t2 | FileCheck %s
This test passes if I delete all "AT> FLASH" and "AT> RAM", so it is not
clear what this feature is for. Please expand the test a bit.
> Index: ELF/LinkerScript.cpp
> ===================================================================
> --- ELF/LinkerScript.cpp
> +++ ELF/LinkerScript.cpp
> @@ -667,6 +667,15 @@
> Ctx->LMAOffset = [=] { return Sec->LMAExpr().getValue() - D; };
> }
>
> + if (!Sec->LMARegionName.empty()) {
> + if (MemoryRegion *MR = MemoryRegions.lookup(Sec->LMARegionName)) {
> + uint64_t Offset = MR->Origin - Dot;
> + Ctx->LMAOffset = [=] { return Offset; };
> + } else {
> + error("memory region '" + Sec->LMARegionName + "' not declared");
> + }
> + }
> +
Or saying it differently, the unmodified at2.s test passes if I delete
this if.
Cheers,
Rafael
More information about the llvm-commits
mailing list