On Wed, 2009-07-15 at 10:37 -0700, Devang Patel wrote:> On Wed, Jul 15, 2009 at 9:32 AM, sanjiv gupta<sanjiv.gupta at microchip.com> wrote: > > Consider the example command line below > > > > $ llvm-ld -disable-opt hello.bc -l std -o hello.out > > > > Why does -disable-opt links in all the bitcode from the libstd.so into > > hello.out? > > ... because it just disables optimization passed. It does not disable linking. > ? > - > Devang > ______I think I did not explain the question really well. -disable-opt links the whole lib into the final program while not using -disable-opt links in only the required symbols. Why ? - Sanjiv> _________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Wed, Jul 15, 2009 at 7:29 PM, sanjiv gupta<sanjiv.gupta at microchip.com> wrote:> On Wed, 2009-07-15 at 10:37 -0700, Devang Patel wrote: >> On Wed, Jul 15, 2009 at 9:32 AM, sanjiv gupta<sanjiv.gupta at microchip.com> wrote: >> > Consider the example command line below >> > >> > $ llvm-ld -disable-opt hello.bc -l std -o hello.out >> > >> > Why does -disable-opt links in all the bitcode from the libstd.so into >> > hello.out? >> >> ... because it just disables optimization passed. It does not disable linking. >> ? >> - >> Devang >> ______ > I think I did not explain the question really well. > > -disable-opt links the whole lib into the final program while not using > -disable-opt links in only the required symbols. Why ?I think you are confusing the order. Probably what is happening is whole lib is getting linked in, then optimization is throwing away a bunch of stuff. Linking works on modules at a time, so if hello.bc uses some symbol X, it will pull in the entire module inside the library which contains a definition of X. - Daniel> - Sanjiv > >> _________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Hello Sanjiv, Wouldn't that be considered a dead-code elimination optimization? If so, then that feature would be disabled by the -disable-opt option. --Sam ----- Original Message ----> From: sanjiv gupta <sanjiv.gupta at microchip.com> > To: LLVM Developers Mailing List <llvmdev at cs.uiuc.edu> > Sent: Wednesday, July 15, 2009 9:29:55 PM > Subject: Re: [LLVMdev] llvm-ld -disable-opt behavior. > > -disable-opt links the whole lib into the final program while not using > -disable-opt links in only the required symbols. Why ? > > - Sanjiv >
On Wed, 2009-07-15 at 20:17 -0700, Daniel Dunbar wrote:> On Wed, Jul 15, 2009 at 7:29 PM, sanjiv gupta<sanjiv.gupta at microchip.com> wrote: > > On Wed, 2009-07-15 at 10:37 -0700, Devang Patel wrote: > >> On Wed, Jul 15, 2009 at 9:32 AM, sanjiv gupta<sanjiv.gupta at microchip.com> wrote: > >> > Consider the example command line below > >> > > >> > $ llvm-ld -disable-opt hello.bc -l std -o hello.out > >> > > >> > Why does -disable-opt links in all the bitcode from the libstd.so into > >> > hello.out? > >> > >> ... because it just disables optimization passed. It does not disable linking. > >> ? > >> - > >> Devang > >> ______ > > I think I did not explain the question really well. > > > > -disable-opt links the whole lib into the final program while not using > > -disable-opt links in only the required symbols. Why ? > > I think you are confusing the order. Probably what is happening is > whole lib is getting linked in, then optimization is throwing away a > bunch of stuff. > > Linking works on modules at a time, so if hello.bc uses some symbol X, > it will pull in the entire module inside the library which contains a > definition of X. > > - Daniel >Ok. so when you $ llvm-ld -link-as-library a.bc b.bc c.bc -o stdlib.so The generated file stdlib.so becomes a single module. Right ? - Sanjiv> > - Sanjiv > > > >> _________________________________________ > >> LLVM Developers mailing list > >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev