OSDN Git Service

PR gas/12931
authornickc <nickc>
Wed, 29 Jun 2011 16:29:37 +0000 (16:29 +0000)
committernickc <nickc>
Wed, 29 Jun 2011 16:29:37 +0000 (16:29 +0000)
* config/tc-arm.c (mapping_state): When changing to ARM or THUMB
state set the minimum required alignment of the section.

gas/ChangeLog
gas/config/tc-arm.c

index d426507..cea235d 100644 (file)
@@ -1,3 +1,9 @@
+2011-06-29  Dave Martin  <dave.martin@linaro.org>
+
+       PR gas/12931
+       * config/tc-arm.c (mapping_state): When changing to ARM or THUMB
+       state set the minimum required alignment of the section.
+
 2011-06-29  Tristan Gingold  <gingold@adacore.com>
 
        * config/tc-i386.c (i386_mach): Convert to ISO-C.
index 1d964c3..ae70f69 100644 (file)
@@ -2589,7 +2589,24 @@ mapping_state (enum mstate state)
     /* The mapping symbol has already been emitted.
        There is nothing else to do.  */
     return;
-  else if (TRANSITION (MAP_UNDEFINED, MAP_DATA))
+
+  if (state == MAP_ARM || state == MAP_THUMB)
+    /*  PR gas/12931
+       All ARM instructions require 4-byte alignment.
+       (Almost) all Thumb instructions require 2-byte alignment.
+
+       When emitting instructions into any section, mark the section
+       appropriately.
+
+       Some Thumb instructions are alignment-sensitive modulo 4 bytes,
+       but themselves require 2-byte alignment; this applies to some
+       PC- relative forms.  However, these cases will invovle implicit
+       literal pool generation or an explicit .align >=2, both of
+       which will cause the section to me marked with sufficient
+       alignment.  Thus, we don't handle those cases here.  */
+    record_alignment (now_seg, state == MAP_ARM ? 2 : 1);
+
+  if (TRANSITION (MAP_UNDEFINED, MAP_DATA))
     /* This case will be evaluated later in the next else.  */
     return;
   else if (TRANSITION (MAP_UNDEFINED, MAP_ARM)