mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 22:07:58 +08:00
2007-05-16 H.J. Lu <hongjiu.lu@intel.com>
Alan Modra <amodra@bigpond.net.au> * elflink.c (_bfd_elf_adjust_dynamic_copy): Align dynamic bss section to the minimum alignment.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2007-05-16 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* elflink.c (_bfd_elf_adjust_dynamic_copy): Align dynamic bss
|
||||||
|
section to the minimum alignment.
|
||||||
|
|
||||||
2007-05-15 H.J. Lu <hongjiu.lu@intel.com>
|
2007-05-15 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
Alan Modra <amodra@bigpond.net.au>
|
Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
@ -2616,33 +2616,33 @@ bfd_boolean
|
|||||||
_bfd_elf_adjust_dynamic_copy (struct elf_link_hash_entry *h,
|
_bfd_elf_adjust_dynamic_copy (struct elf_link_hash_entry *h,
|
||||||
asection *dynbss)
|
asection *dynbss)
|
||||||
{
|
{
|
||||||
unsigned int power_of_two, orig_power_of_two;
|
unsigned int power_of_two;
|
||||||
bfd_vma mask;
|
bfd_vma mask;
|
||||||
asection *sec = h->root.u.def.section;
|
asection *sec = h->root.u.def.section;
|
||||||
|
|
||||||
/* The section aligment of definition is the maximum alignment
|
/* The section aligment of definition is the maximum alignment
|
||||||
requirement of symbols defined in the section. */
|
requirement of symbols defined in the section. Since we don't
|
||||||
power_of_two = bfd_get_section_alignment (dynbss->owner, dynbss);
|
know the symbol alignment requirement, we start with the
|
||||||
orig_power_of_two = bfd_get_section_alignment (sec->owner, sec);
|
maximum alignment and check low bits of the symbol address
|
||||||
|
for the minimum alignment. */
|
||||||
if (orig_power_of_two > power_of_two)
|
power_of_two = bfd_get_section_alignment (sec->owner, sec);
|
||||||
{
|
mask = ((bfd_vma) 1 << power_of_two) - 1;
|
||||||
/* Adjust the section alignment if needed. */
|
|
||||||
if (! bfd_set_section_alignment (dynbss->owner, dynbss,
|
|
||||||
orig_power_of_two))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We make sure that the symbol will be aligned properly. Since we
|
|
||||||
don't know its alignment requirement, we start with the maximum
|
|
||||||
alignment and check low bits of the symbol address for the
|
|
||||||
minimum alignment. */
|
|
||||||
mask = ((bfd_vma) 1 << orig_power_of_two) - 1;
|
|
||||||
while ((h->root.u.def.value & mask) != 0)
|
while ((h->root.u.def.value & mask) != 0)
|
||||||
{
|
{
|
||||||
mask >>= 1;
|
mask >>= 1;
|
||||||
--orig_power_of_two;
|
--power_of_two;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (power_of_two > bfd_get_section_alignment (dynbss->owner,
|
||||||
|
dynbss))
|
||||||
|
{
|
||||||
|
/* Adjust the section alignment if needed. */
|
||||||
|
if (! bfd_set_section_alignment (dynbss->owner, dynbss,
|
||||||
|
power_of_two))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We make sure that the symbol will be aligned properly. */
|
||||||
dynbss->size = BFD_ALIGN (dynbss->size, mask + 1);
|
dynbss->size = BFD_ALIGN (dynbss->size, mask + 1);
|
||||||
|
|
||||||
/* Define the symbol as being at this point in DYNBSS. */
|
/* Define the symbol as being at this point in DYNBSS. */
|
||||||
|
Reference in New Issue
Block a user