On May 8, 2009, at 1:02 PM, Chris Lattner wrote:> This goes against our general direction for llvm libraries: they > should generally all be built pic.After reviewing yet more of the Makefile,rules file, I believe ENABLE_PIC is the right thing to check. Currently ENABLE_PIC has to be set to get shared bits built, if the user wants them. Given that, we can use that to control wether or not -mdynamic-no-pic is added. Because this _must_ be set, it is safe to use the setting of that flag to make the decision on wether to add -mdynamic-no-pic. If that flag isn't set, the resulting objects, in general, can't be used in a shared library.> This is because we don't know how they will be linked in.Currently, the Makefile does know how the object will be used. On darwin, -fno-common is only added when ENABLE_PIC is 1, and objects can't be used in a shared library unless -fno-common is added.
On May 8, 2009, at 1:49 PM, Mike Stump wrote:> On May 8, 2009, at 1:02 PM, Chris Lattner wrote: >> This goes against our general direction for llvm libraries: they >> should generally all be built pic. > > After reviewing yet more of the Makefile,rules file, I believe > ENABLE_PIC is the right thing to check.Index: clang/Makefile.rules ==================================================================--- clang/Makefile.rules (revision 71270) +++ clang/Makefile.rules (working copy) @@ -338,6 +338,11 @@ C.Flags += -fPIC endif endif +else + ifeq ($(OS),Darwin) + CXX.Flags += -mdynamic-no-pic + C.Flags += -mdynamic-no-pic + endif endif CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual is the patch I had in mind. Any objections?
On May 8, 2009, at 2:54 PM, Mike Stump wrote:> On May 8, 2009, at 1:49 PM, Mike Stump wrote: >> On May 8, 2009, at 1:02 PM, Chris Lattner wrote: >>> This goes against our general direction for llvm libraries: they >>> should generally all be built pic. >> >> After reviewing yet more of the Makefile,rules file, I believe >> ENABLE_PIC is the right thing to check.Looks good to me, thanks Mike. -Chris>> > > Index: clang/Makefile.rules > ==================================================================> --- clang/Makefile.rules (revision 71270) > +++ clang/Makefile.rules (working copy) > @@ -338,6 +338,11 @@ > C.Flags += -fPIC > endif > endif > +else > + ifeq ($(OS),Darwin) > + CXX.Flags += -mdynamic-no-pic > + C.Flags += -mdynamic-no-pic > + endif > endif > > CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual > > is the patch I had in mind. Any objections? > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev