<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div>I have been investigating this failure for the past couple of days. There is something wrong with the linker on the test machine. If i take the generated asm file (.s) and assemble and link on my own machine it works fine. If i assemble on the test machine and link on my machine it works fine, but if I link on the test machine the ELF format becomes corrupted somehow. This shows up e.g. with readelf -a, where the object file is okay, but the binary does not list the symbol table (it is there and can be listed with readelf -s) The patch should be good otherwise, the object file is smaller with the patch than without.<br><br>- Jan<br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br><div style="font-family: Courier New,monaco,monospace,sans-serif; font-size:
10pt;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Duncan Sands <baldrick@free.fr><br><b><span style="font-weight: bold;">To:</span></b> llvm-commits@cs.uiuc.edu<br><b><span style="font-weight: bold;">Sent:</span></b> Sat, March 12, 2011 8:07:37 AM<br><b><span style="font-weight: bold;">Subject:</span></b> [llvm-commits] [llvm] r127540 - in /llvm/trunk: include/llvm/MC/MCSection.h include/llvm/MC/MCSectionELF.h lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<br></font><br>
Author: baldrick<br>Date: Sat Mar 12 07:07:37 2011<br>New Revision: 127540<br><br><span>URL: <a target="_blank" href="http://llvm.org/viewvc/llvm-project?rev=127540&view=rev">http://llvm.org/viewvc/llvm-project?rev=127540&view=rev</a></span><br>Log:<br>Speculatively revert commit 127478 (jsjodin) in an attempt to fix the<br>llvm-gcc-i386-linux-selfhost and llvm-x86_64-linux-checks buildbots.<br>The original log entry:<br>Remove optimization emitting a reference insted of label difference, since<br>it can create more relocations. Removed isBaseAddressKnownZero method,<br>because it is no longer used.<br><br>Modified:<br> llvm/trunk/include/llvm/MC/MCSection.h<br> llvm/trunk/include/llvm/MC/MCSectionELF.h<br> llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<br><br>Modified: llvm/trunk/include/llvm/MC/MCSection.h<br><span>URL: <a target="_blank"
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSection.h?rev=127540&r1=127539&r2=127540&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSection.h?rev=127540&r1=127539&r2=127540&view=diff</a></span><br>==============================================================================<br>--- llvm/trunk/include/llvm/MC/MCSection.h (original)<br>+++ llvm/trunk/include/llvm/MC/MCSection.h Sat Mar 12 07:07:37 2011<br>@@ -52,6 +52,14 @@<br> virtual void PrintSwitchToSection(const MCAsmInfo &MAI,<br> raw_ostream &OS) const = 0;<br> <br>+ /// isBaseAddressKnownZero - Return true if we know that this section will<br>+ /// get a base address of zero. In cases where we know that this is true we<br>+
/// can emit section offsets as direct references to avoid a subtraction<br>+ /// from the base of the section, saving a relocation.<br>+ virtual bool isBaseAddressKnownZero() const {<br>+ return false;<br>+ }<br>+<br> // UseCodeAlign - Return true if a .align directive should use<br> // "optimized nops" to fill instead of 0s.<br> virtual bool UseCodeAlign() const = 0;<br><br>Modified: llvm/trunk/include/llvm/MC/MCSectionELF.h<br><span>URL: <a target="_blank" href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionELF.h?rev=127540&r1=127539&r2=127540&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionELF.h?rev=127540&r1=127539&r2=127540&view=diff</a></span><br>==============================================================================<br>---
llvm/trunk/include/llvm/MC/MCSectionELF.h (original)<br>+++ llvm/trunk/include/llvm/MC/MCSectionELF.h Sat Mar 12 07:07:37 2011<br>@@ -66,6 +66,12 @@<br> virtual bool UseCodeAlign() const;<br> virtual bool isVirtualSection() const;<br> <br>+ /// isBaseAddressKnownZero - We know that non-allocatable sections (like<br>+ /// debug info) have a base of zero.<br>+ virtual bool isBaseAddressKnownZero() const {<br>+ return (getFlags() & ELF::SHF_ALLOC) == 0;<br>+ }<br>+<br> static bool classof(const MCSection *S) {<br> return S->getVariant() == SV_ELF;<br> }<br><br>Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<br><span>URL: <a target="_blank"
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=127540&r1=127539&r2=127540&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=127540&r1=127539&r2=127540&view=diff</a></span><br>==============================================================================<br>--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)<br>+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Sat Mar 12 07:07:37 2011<br>@@ -191,6 +191,13 @@<br> assert((!Label->isInSection() || &Label->getSection() == &Section) &&<br> "Section offset using wrong section base for label");<br> <br>+ // If the section in question will end up with an address of 0 anyway, we can<br>+ // just emit an absolute reference to save a relocation.<br>+ if
(Section.isBaseAddressKnownZero()) {<br>+ OutStreamer.EmitSymbolValue(Label, 4, 0/*AddrSpace*/);<br>+ return;<br>+ }<br>+ <br> // Otherwise, emit it as a label difference from the start of the section.<br> EmitLabelDifference(Label, SectionLabel, 4);<br> }<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a ymailto="mailto:llvm-commits@cs.uiuc.edu" href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><span><a target="_blank" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></span><br></div></div>
</div></body></html>