From 49c62a3353799da5cdd3d87d35a944026b88fcee Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 29 Jun 2011 16:29:38 +0000 Subject: [PATCH] PR gas/12931 * config/tc-arm.c (mapping_state): When changing to ARM or THUMB state set the minimum required alignment of the section. --- gas/ChangeLog | 6 ++++++ gas/config/tc-arm.c | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index d426507b4e8..cea235dbbd0 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2011-06-29 Dave Martin + + 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 * config/tc-i386.c (i386_mach): Convert to ISO-C. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 1d964c372cd..ae70f69501d 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -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) -- 2.30.2