<div dir="ltr">Sorry, wrong link.<div>This one <a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/624/steps/check-lld%20ubsan/logs/stdio">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/624/steps/check-lld%20ubsan/logs/stdio</a></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 15, 2016 at 12:03 PM Vitaly Buka <<a href="mailto:vitalybuka@google.com">vitalybuka@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Existing <a href="http://google.github.io/sanitizers/show_bots.html" class="gmail_msg" target="_blank">http://google.github.io/sanitizers/show_bots.html</a><br class="gmail_msg"></div><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Tue, Nov 15, 2016 at 6:00 AM Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com" class="gmail_msg" target="_blank">rafael.espindola@gmail.com</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This was found by an existing test with ubsan or should we add<br class="gmail_msg">
something to lld/test/ELF?<br class="gmail_msg">
<br class="gmail_msg">
Thanks,<br class="gmail_msg">
Rafael<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
On 15 November 2016 at 02:32, Vitaly Buka via llvm-commits<br class="gmail_msg">
<<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br class="gmail_msg">
> Author: vitalybuka<br class="gmail_msg">
> Date: Tue Nov 15 01:32:51 2016<br class="gmail_msg">
> New Revision: 286937<br class="gmail_msg">
><br class="gmail_msg">
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=286937&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=286937&view=rev</a><br class="gmail_msg">
> Log:<br class="gmail_msg">
> Avoid creating reference from nullptr.<br class="gmail_msg">
><br class="gmail_msg">
> Summary:<br class="gmail_msg">
> getFile() can return nullptr. This usually happens when Rels is empty so<br class="gmail_msg">
> the reference is never used. Still UBSAN complains.<br class="gmail_msg">
><br class="gmail_msg">
> Reviewers: rafael<br class="gmail_msg">
><br class="gmail_msg">
> Subscribers: llvm-commits<br class="gmail_msg">
><br class="gmail_msg">
> Differential Revision: <a href="https://reviews.llvm.org/D26662" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D26662</a><br class="gmail_msg">
><br class="gmail_msg">
> Modified:<br class="gmail_msg">
> lld/trunk/ELF/Relocations.cpp<br class="gmail_msg">
><br class="gmail_msg">
> Modified: lld/trunk/ELF/Relocations.cpp<br class="gmail_msg">
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=286937&r1=286936&r2=286937&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=286937&r1=286936&r2=286937&view=diff</a><br class="gmail_msg">
> ==============================================================================<br class="gmail_msg">
> --- lld/trunk/ELF/Relocations.cpp (original)<br class="gmail_msg">
> +++ lld/trunk/ELF/Relocations.cpp Tue Nov 15 01:32:51 2016<br class="gmail_msg">
> @@ -615,7 +615,7 @@ static void scanRelocs(InputSectionBase<<br class="gmail_msg">
> Out<ELFT>::RelaDyn->addReloc(Reloc);<br class="gmail_msg">
> };<br class="gmail_msg">
><br class="gmail_msg">
> - const elf::ObjectFile<ELFT> &File = *C.getFile();<br class="gmail_msg">
> + const elf::ObjectFile<ELFT> *File = C.getFile();<br class="gmail_msg">
> ArrayRef<uint8_t> SectionData = C.Data;<br class="gmail_msg">
> const uint8_t *Buf = SectionData.begin();<br class="gmail_msg">
><br class="gmail_msg">
> @@ -628,7 +628,7 @@ static void scanRelocs(InputSectionBase<<br class="gmail_msg">
><br class="gmail_msg">
> for (auto I = Rels.begin(), E = Rels.end(); I != E; ++I) {<br class="gmail_msg">
> const RelTy &RI = *I;<br class="gmail_msg">
> - SymbolBody &Body = File.getRelocTargetSym(RI);<br class="gmail_msg">
> + SymbolBody &Body = File->getRelocTargetSym(RI);<br class="gmail_msg">
> uint32_t Type = RI.getType(Config->Mips64EL);<br class="gmail_msg">
><br class="gmail_msg">
> if (Config->MipsN32Abi) {<br class="gmail_msg">
> @@ -645,7 +645,7 @@ static void scanRelocs(InputSectionBase<<br class="gmail_msg">
><br class="gmail_msg">
> RelExpr Expr = Target->getRelExpr(Type, Body);<br class="gmail_msg">
> bool Preemptible = isPreemptible(Body, Type);<br class="gmail_msg">
> - Expr = adjustExpr(File, Body, IsWrite, Expr, Type, Buf + RI.r_offset);<br class="gmail_msg">
> + Expr = adjustExpr(*File, Body, IsWrite, Expr, Type, Buf + RI.r_offset);<br class="gmail_msg">
> if (HasError)<br class="gmail_msg">
> continue;<br class="gmail_msg">
><br class="gmail_msg">
> @@ -673,7 +673,7 @@ static void scanRelocs(InputSectionBase<<br class="gmail_msg">
> Expr == R_GOTREL || Expr == R_GOTREL_FROM_END || Expr == R_PPC_TOC)<br class="gmail_msg">
> In<ELFT>::Got->HasGotOffRel = true;<br class="gmail_msg">
><br class="gmail_msg">
> - uintX_t Addend = computeAddend(File, Buf, E, RI, Expr, Body);<br class="gmail_msg">
> + uintX_t Addend = computeAddend(*File, Buf, E, RI, Expr, Body);<br class="gmail_msg">
><br class="gmail_msg">
> if (unsigned Processed =<br class="gmail_msg">
> handleTlsRelocation<ELFT>(Type, Body, C, Offset, Addend, Expr)) {<br class="gmail_msg">
> @@ -796,14 +796,14 @@ template <class ELFT> void scanRelocatio<br class="gmail_msg">
><br class="gmail_msg">
> template <class ELFT, class RelTy><br class="gmail_msg">
> static void createThunks(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) {<br class="gmail_msg">
> - const elf::ObjectFile<ELFT> &File = *C.getFile();<br class="gmail_msg">
> + const elf::ObjectFile<ELFT> *File = C.getFile();<br class="gmail_msg">
> for (const RelTy &Rel : Rels) {<br class="gmail_msg">
> - SymbolBody &Body = File.getRelocTargetSym(Rel);<br class="gmail_msg">
> + SymbolBody &Body = File->getRelocTargetSym(Rel);<br class="gmail_msg">
> uint32_t Type = Rel.getType(Config->Mips64EL);<br class="gmail_msg">
> RelExpr Expr = Target->getRelExpr(Type, Body);<br class="gmail_msg">
> if (!isPreemptible(Body, Type) && needsPlt(Expr))<br class="gmail_msg">
> Expr = fromPlt(Expr);<br class="gmail_msg">
> - Expr = Target->getThunkExpr(Expr, Type, File, Body);<br class="gmail_msg">
> + Expr = Target->getThunkExpr(Expr, Type, *File, Body);<br class="gmail_msg">
> // Some targets might require creation of thunks for relocations.<br class="gmail_msg">
> // Now we support only MIPS which requires LA25 thunk to call PIC<br class="gmail_msg">
> // code from non-PIC one, and ARM which requires interworking.<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> _______________________________________________<br class="gmail_msg">
> llvm-commits mailing list<br class="gmail_msg">
> <a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div></blockquote></div>