Fix for compiling on Solaris
Bill Rushmore
bill.rushmore at oracle.com
Fri Feb 27 15:22:41 PST 2015
Thanks for the suggestion. Here's an updated version that's a bit cleaner.
Bill
On 2/27/2015 2:25 PM, Eric Christopher wrote:
> I think you want:
>
> @@ -638,10 +641,13 @@
> ifeq ($(HOST_OS),Darwin)
> LD.Flags += -Wl,-dead_strip
> else
> - ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
> + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW SunOS))
> LD.Flags += -Wl,--gc-sections
> endif
> endif
> + ifeq ($(HOST_OS),SunOS)
> + LD.Flags += -Wl,-z -Wl,discard-unused=sections
> + endif
>
> to have and else ifeq under darwin and then else ifneq for the Cygwin
> bits.
>
> At any rate the SunOS bit should be hoisted.
>
> -eric
>
> On Fri, Feb 27, 2015 at 1:36 PM Bill Rushmore
> <bill.rushmore at oracle.com <mailto:bill.rushmore at oracle.com>> wrote:
>
> Here's the updated patch with the new flags for Solaris.
>
>
> Bill
>
>
> On 2/27/2015 11:15 AM, Eric Christopher wrote:
>> Thanks!
>>
>> -eric
>>
>> On Fri, Feb 27, 2015 at 11:11 AM Bill Rushmore
>> <bill.rushmore at oracle.com <mailto:bill.rushmore at oracle.com>> wrote:
>>
>> Eric,
>>
>> The Solaris linker's equivalent is (sorry I didn't realize
>> this earlier):
>>
>> -Wl,-z -Wl,discard-unused=sections
>>
>> We can use -ffunction-section/-fdata-sections with Solaris'
>> GCC. We also need to pass -falign-functions=8.
>>
>> I will rework the patch with these changes, test it, and then
>> resend.
>>
>> Bill
>>
>>
>> On 2/27/2015 10:27 AM, Eric Christopher wrote:
>>> Hi Bill,
>>>
>>> Will the sun linker gc the sections itself then? or do we
>>> need to avoid using -ffunction-section/-fdata-sections as well?
>>>
>>> -eric
>>>
>>> On Fri, Feb 27, 2015 at 10:09 AM bill rushmore
>>> <bill.rushmore at oracle.com <mailto:bill.rushmore at oracle.com>>
>>> wrote:
>>>
>>> I have a very simple patch for Makefile.rules that
>>> solves the problem of
>>> trying to build on Solaris. The issue is that Solaris'
>>> gcc uses the
>>> Solaris linker and that linker doesn't have the
>>> --gc-sections flag.
>>> This patch fixes Bug 18517.
>>>
>>> Bill Rushmore
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150227/529c20c9/attachment.html>
-------------- next part --------------
Index: Makefile.rules
===================================================================
--- Makefile.rules (revision 230804)
+++ Makefile.rules (working copy)
@@ -631,6 +631,9 @@
ifneq ($(HOST_OS),Darwin)
ifneq ($(HOST_ARCH),Mips)
CXX.Flags += -ffunction-sections -fdata-sections
+ ifeq ($(HOST_OS),SunOS)
+ CXX.Flags += -falign-functions=8
+ endif
endif
endif
endif
@@ -638,10 +641,14 @@
ifeq ($(HOST_OS),Darwin)
LD.Flags += -Wl,-dead_strip
else
- ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
- LD.Flags += -Wl,--gc-sections
+ ifeq ($(HOST_OS),SunOS)
+ LD.Flags += -Wl,-z -Wl,discard-unused=sections
+ else
+ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ LD.Flags += -Wl,--gc-sections
+ endif
endif
- endif
+ endif
endif
# Adjust linker flags for building an executable
More information about the llvm-commits
mailing list