Fix for compiling on Solaris

Eric Christopher echristo at gmail.com
Fri Feb 27 14:25:29 PST 2015


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>
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>
> 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>
>> 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
>>> 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/e4caeafd/attachment.html>


More information about the llvm-commits mailing list