aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/elf32-nds32.c29
2 files changed, 25 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e3a428a..f2e3ddb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2015-01-26 Kuan-Lin Chen <kuanlinchentw@gmail.com>
+
+ * elf32-nds32.c (nds32_elf_pick_relax): Fix again setting.
+
2015-01-22 DJ Delorie <dj@redhat.com>
* elf32-m32c.c (m32c_apply_reloc_24): New.
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 5c97519..e5fc2a6 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -11815,7 +11815,8 @@ nds32_elf_pick_relax (bfd_boolean init, asection *sec, bfd_boolean *again,
struct elf_nds32_link_hash_table *table,
struct bfd_link_info *link_info)
{
- static asection *final_sec;
+ static asection *final_sec, *first_sec = NULL;
+ static bfd_boolean normal_again = FALSE;
static bfd_boolean set = FALSE;
static bfd_boolean first = TRUE;
int round_table[] = {
@@ -11827,6 +11828,13 @@ nds32_elf_pick_relax (bfd_boolean init, asection *sec, bfd_boolean *again,
static int pass = 0;
static int relax_round;
+ /* The new round. */
+ if (init && first_sec == sec)
+ {
+ set = TRUE;
+ normal_again = FALSE;
+ }
+
if (first)
{
/* Run an empty run to get the final section. */
@@ -11835,27 +11843,29 @@ nds32_elf_pick_relax (bfd_boolean init, asection *sec, bfd_boolean *again,
/* It has to enter relax again because we can
not make sure what the final turn is. */
*again = TRUE;
+
first = FALSE;
+ first_sec = sec;
}
- if (!set && *again)
+ if (!set)
{
- /* It is reentered when again is FALSE. */
+ /* Not reenter yet. */
final_sec = sec;
return relax_round;
}
- /* The second round begins. */
- set = TRUE;
-
relax_round = round_table[pass];
+ if (!init && relax_round == NDS32_RELAX_NORMAL_ROUND && *again)
+ normal_again = TRUE;
+
if (!init && final_sec == sec)
{
switch (relax_round)
{
case NDS32_RELAX_NORMAL_ROUND:
- if (!*again)
+ if (!normal_again)
{
/* Normal relaxation done. */
if (table->target_optimize & NDS32_RELAX_JUMP_IFC_ON)
@@ -12032,7 +12042,10 @@ nds32_elf_relax_section (bfd *abfd, asection *sec,
if (ELF32_R_TYPE (irel->r_info) == R_NDS32_RELAX_ENTRY)
{
if (irel->r_addend & R_NDS32_RELAX_ENTRY_DISABLE_RELAX_FLAG)
- return TRUE;
+ {
+ nds32_elf_pick_relax (FALSE, sec, again, table, link_info);
+ return TRUE;
+ }
if (irel->r_addend & R_NDS32_RELAX_ENTRY_OPTIMIZE_FLAG)
optimize = 1;