[LLVMdev] Problem with Linux PPC64 assembly output.
Richard Pennington
rich at pennware.com
Sat Sep 17 14:20:26 PDT 2011
The latest binutils (2.21.2) assembler for the PPC64 complains about the .size
directive emitted by LLVM as not containing an absolute expression.
An example:
__umodsi3:
.quad .L.__umodsi3,.TOC. at tocbase
.previous
.L.__umodsi3:
mflr 0
[snip]
mtlr 0
blr
.Ltmp0:
.size __umodsi3, .Ltmp0-__umodsi3
The correct size expression should be .Ltmp0-.L.__umodsi3
The code which does this is in AsmPrinter.cpp:
// If the target wants a .size directive for the size of the function, emit
// it.
if (MAI->hasDotTypeDotSizeDirective()) {
// Create a symbol for the end of function, so we can get the size as
// difference between the function label and the temp label.
MCSymbol *FnEndLabel = OutContext.CreateTempSymbol();
OutStreamer.EmitLabel(FnEndLabel);
const MCExpr *SizeExp =
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(FnEndLabel, OutContext),
MCSymbolRefExpr::Create(CurrentFnSym,
OutContext),
OutContext);
OutStreamer.EmitELFSize(CurrentFnSym, SizeExp);
}
I've filed a bug for this: http://llvm.org/bugs/show_bug.cgi?id=10951
This looks a little tricky to fix since there is no easy hook that I can find to
override how the .size directive is output.
Anyone have any suggestions, or have I missed something?
-Rich
More information about the llvm-dev
mailing list