[llvm-dev] Got stuck with PC-rel branching

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 26 10:04:31 PST 2017

On 1/26/2017 9:00 AM, Peter Bel wrote:
> Sorry for putting this topic up, but can I ask for your advice once 
> again?
> I'm getting some very strange errors and I can't really understand 
> why. In my applyFixup() I have fixup value adjustment, and for fixup 
> PCREL24 I have the following simple code:
> case Epiphany::fixup_Epiphany_PCREL24
>   Value = Value << 7;
>   break;
> When I'm trying to compile a sample binary (any, even without this 
> fixup type), it "might fail" on 
> MC/ELFObjectWriter.cpp::executePostLayoutBinding():392, which is 
> called from MCAssembler.cpp::layout(). If fails on the following line:
> const auto &Alias = cast<MCSymbolELF>(A);
> "Might fail" - because it doesn't fail every time. I can change some 
> other completely unrelated piece of code - and suddenly it'll fail. If 
> I'll change it to smth else, e.g. Value = Value, it won't fail, but it 
> still "might fail" after some other change. Sometimes it can fail on 
> different lines, sometimes it can even pass through on the first run 
> and fail on the second.
> I've checked that it fails because MCSymbol &A has A.Kind different 
> from 2 (SymbolKindELF), usually it's 1 or 0 (COFF or Unknown).

This sounds like memory corruption of some sort... have you tried asan 
and/or valgrind?


Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170126/6b7c4d70/attachment-0001.html>

More information about the llvm-dev mailing list