aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@mips.com>2018-02-19 18:38:41 +0000
committerMaciej W. Rozycki <macro@mips.com>2018-02-19 18:38:41 +0000
commit8772de117d8366988bc60c9f9c571e262ef75932 (patch)
tree2ecb85a275d6db8cc6936f7070fa40ba11238bc8 /ld/ldlang.c
parent4f7fd351a727ffc44d3dd4e00ddf5222cd2063c5 (diff)
downloadgdb-8772de117d8366988bc60c9f9c571e262ef75932.zip
gdb-8772de117d8366988bc60c9f9c571e262ef75932.tar.gz
gdb-8772de117d8366988bc60c9f9c571e262ef75932.tar.bz2
LD: Support fixed-size sections some psABIs may require
Define a SEC_FIXED_SIZE section flag for target backends to use for output sections whose size has been fixed in the psABI. The size of such sections will not be changed anyhow by the generic linker and it is up to the target backend to get their size right. bfd/ * section.c (SEC_FIXED_SIZE): New macro. * bfd-in2.h: Regenerate. ld/ * ldlang.c (insert_pad): Do not change output section's size if SEC_FIXED_SIZE is set in the flags. (size_input_section): Likewise. (lang_size_sections_1): Likewise. (lang_reset_memory_regions): Likewise.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 1a6f2cf..5401982 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -4675,8 +4675,9 @@ insert_pad (lang_statement_union_type **ptr,
}
pad->padding_statement.output_offset = dot - output_section->vma;
pad->padding_statement.size = alignment_needed;
- output_section->size = TO_SIZE (dot + TO_ADDR (alignment_needed)
- - output_section->vma);
+ if (!(output_section->flags & SEC_FIXED_SIZE))
+ output_section->size = TO_SIZE (dot + TO_ADDR (alignment_needed)
+ - output_section->vma);
}
/* Work out how much this section will move the dot point. */
@@ -4725,7 +4726,8 @@ size_input_section
/* Mark how big the output section must be to contain this now. */
dot += TO_ADDR (i->size);
- o->size = TO_SIZE (dot - o->vma);
+ if (!(o->flags & SEC_FIXED_SIZE))
+ o->size = TO_SIZE (dot - o->vma);
}
return dot;
@@ -5079,7 +5081,8 @@ lang_size_sections_1
bfd_set_section_vma (os->bfd_section->owner,
os->bfd_section,
bfd_section_vma (input->owner, input));
- os->bfd_section->size = input->size;
+ if (!(os->bfd_section->flags & SEC_FIXED_SIZE))
+ os->bfd_section->size = input->size;
break;
}
@@ -5194,7 +5197,9 @@ lang_size_sections_1
+ os->block_value - 1)
& - (bfd_vma) os->block_value);
- os->bfd_section->size = TO_SIZE (after - os->bfd_section->vma);
+ if (!(os->bfd_section->flags & SEC_FIXED_SIZE))
+ os->bfd_section->size = TO_SIZE (after
+ - os->bfd_section->vma);
}
/* Set section lma. */
@@ -5379,8 +5384,10 @@ lang_size_sections_1
if (size < TO_SIZE ((unsigned) 1))
size = TO_SIZE ((unsigned) 1);
dot += TO_ADDR (size);
- output_section_statement->bfd_section->size
- = TO_SIZE (dot - output_section_statement->bfd_section->vma);
+ if (!(output_section_statement->bfd_section->flags
+ & SEC_FIXED_SIZE))
+ output_section_statement->bfd_section->size
+ = TO_SIZE (dot - output_section_statement->bfd_section->vma);
}
break;
@@ -5395,8 +5402,10 @@ lang_size_sections_1
output_section_statement->bfd_section;
size = bfd_get_reloc_size (s->reloc_statement.howto);
dot += TO_ADDR (size);
- output_section_statement->bfd_section->size
- = TO_SIZE (dot - output_section_statement->bfd_section->vma);
+ if (!(output_section_statement->bfd_section->flags
+ & SEC_FIXED_SIZE))
+ output_section_statement->bfd_section->size
+ = TO_SIZE (dot - output_section_statement->bfd_section->vma);
}
break;
@@ -6764,7 +6773,8 @@ lang_reset_memory_regions (void)
{
/* Save the last size for possible use by bfd_relax_section. */
o->rawsize = o->size;
- o->size = 0;
+ if (!(o->flags & SEC_FIXED_SIZE))
+ o->size = 0;
}
}