Hi all,

I'm going to apply the below patch to trunk if there are no objections.

There are no regressions. From our pov, we should be in sync with Linux here.

Also, I'm going to push this one out to 5.x after one week.

Thanks,
Andreas


2015-11-16  Andreas Tobler  <andre...@gcc.gnu.org>

        * config/i386/freebsd.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Bring in the
        commit from r125920 for FreeBSD.

--- gcc/config/i386/freebsd.h.orig      2011-12-31 23:08:26.000000000 -0500
+++ gcc/config/i386/freebsd.h   2011-12-31 23:14:14.000000000 -0500
@@ -114,11 +114,21 @@
 
 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
 #undef  ASM_OUTPUT_MAX_SKIP_ALIGN
-#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)                         
        \
-  if ((LOG) != 0) {                                                            
                                                \
-    if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));   \
-    else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));   \
-  }
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)                   \
+  do {                                                                 \
+    if ((LOG) != 0) {                                                  \
+      if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
+      else {                                                           \
+       fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));     \
+       /* Make sure that we have at least 8 byte alignment if > 8 byte \
+          alignment is preferred.  */                                  \
+       if ((LOG) > 3                                                   \
+           && (1 << (LOG)) > ((MAX_SKIP) + 1)                          \
+           && (MAX_SKIP) >= 7)                                         \
+         fputs ("\t.p2align 3\n", (FILE));                             \
+      }                                                                        
\
+    }                                                                  \
+  } while (0)
 #endif
 
 /* Don't default to pcc-struct-return, we want to retain compatibility with

Reply via email to