mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 13:27:26 +08:00
* ldlang.c (lang_common): Pass desired alignment to
lang_one_common as power of two. (lang_one_common): Get common symbol alignment from linker hash table entry. Treat desired alignment as a power of two.
This commit is contained in:
@ -1,5 +1,10 @@
|
|||||||
Fri Jul 22 12:15:36 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
Fri Jul 22 12:15:36 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||||
|
|
||||||
|
* ldlang.c (lang_common): Pass desired alignment to
|
||||||
|
lang_one_common as power of two.
|
||||||
|
(lang_one_common): Get common symbol alignment from linker hash
|
||||||
|
table entry. Treat desired alignment as a power of two.
|
||||||
|
|
||||||
* ldlang.c (wild_section): Attach all section with the given name,
|
* ldlang.c (wild_section): Attach all section with the given name,
|
||||||
not just the first one. If there is no name, attach all sections
|
not just the first one. If there is no name, attach all sections
|
||||||
even if the SEC_IS_COMMON flag is set.
|
even if the SEC_IS_COMMON flag is set.
|
||||||
|
39
ld/ldlang.c
39
ld/ldlang.c
@ -2185,7 +2185,7 @@ lang_common ()
|
|||||||
{
|
{
|
||||||
unsigned int power;
|
unsigned int power;
|
||||||
|
|
||||||
for (power = 1; power <= 16; power <<= 1)
|
for (power = 1; power < 4; power++)
|
||||||
bfd_link_hash_traverse (link_info.hash, lang_one_common,
|
bfd_link_hash_traverse (link_info.hash, lang_one_common,
|
||||||
(PTR) &power);
|
(PTR) &power);
|
||||||
}
|
}
|
||||||
@ -2200,49 +2200,24 @@ lang_one_common (h, info)
|
|||||||
{
|
{
|
||||||
unsigned int power_of_two;
|
unsigned int power_of_two;
|
||||||
bfd_vma size;
|
bfd_vma size;
|
||||||
size_t align;
|
|
||||||
asection *section;
|
asection *section;
|
||||||
|
|
||||||
if (h->type != bfd_link_hash_common)
|
if (h->type != bfd_link_hash_common)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
size = h->u.c.size;
|
size = h->u.c.size;
|
||||||
switch (size)
|
power_of_two = h->u.c.alignment_power;
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
power_of_two = 0;
|
|
||||||
align = 1;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
power_of_two = 1;
|
|
||||||
align = 2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
power_of_two = 2;
|
|
||||||
align = 4;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
case 7:
|
|
||||||
case 8:
|
|
||||||
power_of_two = 3;
|
|
||||||
align = 8;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
power_of_two = 4;
|
|
||||||
align = 16;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.sort_common && align != *(unsigned int *) info)
|
if (config.sort_common
|
||||||
|
&& power_of_two < *(unsigned int *) info
|
||||||
|
&& *(unsigned int *) info < 4)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
section = h->u.c.section;
|
section = h->u.c.section;
|
||||||
|
|
||||||
/* Increase the size of the section. */
|
/* Increase the size of the section. */
|
||||||
section->_raw_size = ALIGN_N (section->_raw_size, align);
|
section->_raw_size = ALIGN_N (section->_raw_size,
|
||||||
|
(bfd_size_type) (1 << power_of_two));
|
||||||
|
|
||||||
/* Adjust the alignment if necessary. */
|
/* Adjust the alignment if necessary. */
|
||||||
if (power_of_two > section->alignment_power)
|
if (power_of_two > section->alignment_power)
|
||||||
|
Reference in New Issue
Block a user