diff options
| author | George Rimar <grimar@accesssoftek.com> | 2017-02-21 14:50:38 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2017-02-21 14:50:38 +0000 |
| commit | 2ee2d2dcb5fee830c277bc8b15ad722402dec210 (patch) | |
| tree | 7153276dc68d95a652bedc64e3b11de6886c51dd /lld/ELF/LinkerScript.cpp | |
| parent | ec36f3b79a2e5c67624cae5aa2658d2caba8c990 (diff) | |
| download | bcm5719-llvm-2ee2d2dcb5fee830c277bc8b15ad722402dec210.tar.gz bcm5719-llvm-2ee2d2dcb5fee830c277bc8b15ad722402dec210.zip | |
[ELF] - Improve diagnostic messages for move location counter errors.
Previously LLD would error out just "ld.lld: error: unable to move location counter backward"
What does not really reveal the place of issue,
Patch adds location to the output.
Differential revision: https://reviews.llvm.org/D30187
llvm-svn: 295720
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 53b39f2b1ba..be42bec9f41 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -91,13 +91,15 @@ static bool isUnderSysroot(StringRef Path) { return false; } -template <class ELFT> void LinkerScript<ELFT>::setDot(Expr E, bool InSec) { +template <class ELFT> +void LinkerScript<ELFT>::setDot(Expr E, const Twine &Loc, bool InSec) { uintX_t Val = E(Dot); if (Val < Dot) { if (InSec) - error("unable to move location counter backward for: " + CurOutSec->Name); + error(Loc + ": unable to move location counter backward for: " + + CurOutSec->Name); else - error("unable to move location counter backward"); + error(Loc + ": unable to move location counter backward"); } Dot = Val; // Update to location counter means update to section size. @@ -111,7 +113,7 @@ template <class ELFT> void LinkerScript<ELFT>::setDot(Expr E, bool InSec) { template <class ELFT> void LinkerScript<ELFT>::assignSymbol(SymbolAssignment *Cmd, bool InSec) { if (Cmd->Name == ".") { - setDot(Cmd->Expression, InSec); + setDot(Cmd->Expression, Cmd->Location, InSec); return; } @@ -567,7 +569,7 @@ void LinkerScript<ELFT>::assignOffsets(OutputSectionCommand *Cmd) { return; if (Cmd->AddrExpr && Sec->Flags & SHF_ALLOC) - setDot(Cmd->AddrExpr); + setDot(Cmd->AddrExpr, Cmd->Location); // Handle align (e.g. ".foo : ALIGN(16) { ... }"). if (Cmd->AlignExpr) @@ -1622,7 +1624,7 @@ SymbolAssignment *ScriptParser::readAssignment(StringRef Name) { return getSymbolValue(Loc, Name, Dot) + E(Dot); }; } - return new SymbolAssignment(Name, E); + return new SymbolAssignment(Name, E, getCurrentLocation()); } // This is an operator-precedence parser to parse a linker |

