[PATCH] fix a small leak in MC/MCAsmStreamer.cpp

Kostya Serebryany kcc at google.com
Thu Apr 24 08:14:40 PDT 2014


On Thu, Apr 24, 2014 at 7:12 PM, David Blaikie <dblaikie at gmail.com> wrote:

> On Thu, Apr 24, 2014 at 8:03 AM, Kostya Serebryany <kcc at google.com> wrote:
> >
> >
> >
> > On Thu, Apr 24, 2014 at 6:55 PM, David Blaikie <dblaikie at gmail.com>
> wrote:
> >>
> >> On Thu, Apr 24, 2014 at 7:48 AM, Kostya Serebryany <kcc at google.com>
> wrote:
> >> > Hmm...
> >> > Now I am getting
> >> > opt: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version
> `GLIBCXX_3.4.18'
> >> > not
> >> > found
> >> >
> >> > Could your CL be the reason?
> >>
> >> /maybe/... but I'd be surprised if my cl was the culprit there.
> >
> > It is:
> >
> > % svn up -r 207117
> > % ninja llvm-mc && bin/llvm-mc < /dev/null
> > [3/3] Linking CXX executable bin/llvm-mc
> >         .text
> >
> > % svn up -r 207118
> > % ninja llvm-mc && bin/llvm-mc < /dev/null
> > [3/3] Linking CXX executable bin/llvm-mc
> > bin/llvm-mc: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version
> > `GLIBCXX_3.4.18' not found (required by bin/llvm-mc)
> >
> >
> >
> >>
> >> I
> >> think this has shown up when you've got a locally installed newer-gcc
> >> than your system GCC, and you built a binary with that (or with a
> >> clang that found libstdc++ from that install) and you don't have an
> >> updated LD_LIBRARY_PATH to point to the shared libraries to match/find
> >> them during execution.
> >
> >
> > Correct, LD_LIBRARY_PATH=/usr/local/gcc-4.8.2/lib64/ helps in my case.
> > But before your patch this was not required :(
>
> Huh, I guess it's a backcompat thing (if old programs run against
> newer libstdc++ are to work, then newer programs that don't use any
> new library features are, incidentally, backwards compatible with
> older libstdc++). I hadn't realized.
>
> > Our bots on Ubuntu 12.04 are down :(
>
> I was rather happy that I hadn't seen any public buildbot fallout with
> that change... :/
>
> > Well, I guess we need to fix them...
>
> Indeed - but we could rollback my patch in the interim if that's going
> to be helpful.
>

nah, please keep it. Our most precious bots are public and on 13.10 or
14.04.

--kcc



>
> - David
>
> >
> > --kcc
> >
> >>
> >>
> >> - David
> >>
> >> >
> >> >
> >> > On Thu, Apr 24, 2014 at 6:41 PM, David Blaikie <dblaikie at gmail.com>
> >> > wrote:
> >> >>
> >> >> Thanks for tracking down the bug, Kostya - I've applied a different
> >> >> fix for this in r207118. Do let me know if this still shows up/is
> >> >> insufficient/problematic in any way.
> >> >>
> >> >> (Yay value semantics! \o/)
> >> >>
> >> >> On Thu, Apr 24, 2014 at 6:43 AM, Kostya Serebryany <kcc at google.com>
> >> >> wrote:
> >> >> > Hi,
> >> >> > Here is a small patch that fixes (mostly innocent) leak in
> >> >> > lib/MC/MCAsmStreamer.cpp,
> >> >> > please review.
> >> >> > See also http://llvm.org/bugs/show_bug.cgi?id=19521
> >> >> >
> >> >> > Index: lib/MC/MCAsmStreamer.cpp
> >> >> > ===================================================================
> >> >> > --- lib/MC/MCAsmStreamer.cpp    (revision 207084)
> >> >> > +++ lib/MC/MCAsmStreamer.cpp    (working copy)
> >> >> > @@ -9,6 +9,7 @@
> >> >> >
> >> >> >  #include "llvm/MC/MCStreamer.h"
> >> >> >  #include "llvm/ADT/SmallString.h"
> >> >> > +#include "llvm/ADT/STLExtras.h"
> >> >> >  #include "llvm/ADT/StringExtras.h"
> >> >> >  #include "llvm/ADT/Twine.h"
> >> >> >  #include "llvm/MC/MCAsmBackend.h"
> >> >> > @@ -76,7 +77,9 @@
> >> >> >      if (InstPrinter && IsVerboseAsm)
> >> >> >        InstPrinter->setCommentStream(CommentStream);
> >> >> >    }
> >> >> > -  ~MCAsmStreamer() {}
> >> >> > +  ~MCAsmStreamer() {
> >> >> > +    DeleteContainerSeconds(SymbolMap);
> >> >> > +  }
> >> >> >
> >> >> >    inline void EmitEOL() {
> >> >> >      // If we don't have any comments, just emit a \n.
> >> >> >
> >> >> >
> >> >> > =================================
> >> >> > Leak report:
> >> >> > Direct leak of 80 byte(s) in 1 object(s) allocated from:
> >> >> >     #0 0x65d4b0 in operator new(unsigned long)
> >> >> > llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
> >> >> >     #1 0x20d9f9e in (anonymous
> >> >> > namespace)::MCAsmStreamer::getOrCreateSymbolData(llvm::MCSymbol
> >> >> > const*)
> >> >> > llvm/lib/MC/MCAsmStreamer.cpp:1476
> >> >> >     #2 0xd4a029 in (anonymous
> >> >> > namespace)::ARMAsmParser::onLabelParsed(llvm::MCSymbol*)
> >> >> > llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp:8328
> >> >> >     #3 0x2924e87 in (anonymous
> >> >> > namespace)::AsmParser::parseStatement((anonymous
> >> >> > namespace)::ParseStatementInfo&)
> >> >> > llvm/lib/MC/MCParser/AsmParser.cpp:1306
> >> >> >     #4 0x29123a1 in (anonymous namespace)::AsmParser::Run(bool,
> bool)
> >> >> > llvm/lib/MC/MCParser/AsmParser.cpp:651
> >> >> >     #5 0x18bc27f in
> llvm::AsmPrinter::EmitInlineAsm(llvm::StringRef,
> >> >> > llvm::MDNode const*, llvm::InlineAsm::AsmDialect) const
> >> >> > llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:151
> >> >> >     #6 0x18bfc1e in
> >> >> > llvm::AsmPrinter::EmitInlineAsm(llvm::MachineInstr
> >> >> > const*) const
> llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:487
> >> >> >     #7 0x189aa80 in llvm::AsmPrinter::EmitFunctionBody()
> >> >> > llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:781
> >> >> >     #8 0xa0d144 in runOnMachineFunction
> >> >> > llvm/include/llvm/CodeGen/AsmPrinter.h:193
> >> >> >     #9 0xa0d144 in
> >> >> > llvm::ARMAsmPrinter::runOnMachineFunction(llvm::MachineFunction&)
> >> >> > llvm/lib/Target/ARM/ARMAsmPrinter.cpp:100
> >> >> >     #10 0x1b0566b in
> >> >> > llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
> >> >> > llvm/lib/CodeGen/MachineFunctionPass.cpp:33
> >> >> >     #11 0x2025905 in
> >> >> > llvm::FPPassManager::runOnFunction(llvm::Function&)
> >> >> > llvm/lib/IR/LegacyPassManager.cpp:1540
> >> >> >     #12 0x2025dd5 in
> llvm::FPPassManager::runOnModule(llvm::Module&)
> >> >> > llvm/lib/IR/LegacyPassManager.cpp:1560
> >> >> >     #13 0x2026aac in runOnModule
> >> >> > llvm/lib/IR/LegacyPassManager.cpp:1618
> >> >> >     #14 0x2026aac in
> >> >> > llvm::legacy::PassManagerImpl::run(llvm::Module&)
> >> >> > llvm/lib/IR/LegacyPassManager.cpp:1725
> >> >> >     #15 0x683cf7 in compileModule llvm/tools/llc/llc.cpp:355
> >> >> >     #16 0x683cf7 in main llvm/tools/llc/llc.cpp:201
> >> >> >
> >> >
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140424/c34c9b2b/attachment.html>


More information about the llvm-commits mailing list