[llvm-commits] llvm on ppc/linux

Eric Christopher echristo at apple.com
Mon Nov 12 14:56:30 PST 2007


On Nov 10, 2007, at 7:48 PM, Nick Lewycky wrote:

> This patch to llvm-gcc 4.0 allows it to compile on PPC/Linux. This  
> is a combination of patchs from myself, Dale Johannesen, and the  
> fact that a GTY can't be declared in an #ifdef from Andrew Pinski.
>
> I'd appreciate some testing. More importantly to make sure that this  
> doesn't break Darwin on PPC, but also anyone else who's interested  
> in running LLVM on their PPC Linux boxes.
>
> The second attachment is the result of a nightly test on PPC/Linux,  
> after applying this patch.

Index: gcc/config/rs6000/linux.h
===================================================================
--- gcc/config/rs6000/linux.h	(revision 43975)
+++ gcc/config/rs6000/linux.h	(working copy)
@@ -110,3 +110,13 @@
  #define TARGET_HAS_F_SETLKW

  #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
+
+#undef ADJUST_FIELD_ALIGN
+#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED, FIRST_FIELD_P)	\
+  (TARGET_ALIGN_NATURAL ? (COMPUTED) :				\
+   (((COMPUTED) == RS6000_VECTOR_ALIGNMENT)			\
+    ? RS6000_VECTOR_ALIGNMENT					\
+    : (MIN ((COMPUTED), 					\
+    	    (TARGET_ALIGN_MAC68K ? 16 				\
+    	    			 : ((FIRST_FIELD_P) ? (COMPUTED) \
+    	    			 		    : 32))))))

I don't think this part can possibly be correct, there's no mac68k  
alignment for ppc linux. The proper version of ADJUST_FIELD_ALIGN is  
in 4.2 and is:

/* An expression for the alignment of a structure field FIELD if the
    alignment computed in the usual way is COMPUTED.  */
#define ADJUST_FIELD_ALIGN(FIELD,  
COMPUTED)                                   \
         ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) ==  
VECTOR_TYPE)     \
          ? 128 : COMPUTED)

(note that there's a different one for ppc64-linux)

-eric



More information about the llvm-commits mailing list