From: Ian Lance Taylor Date: Fri, 22 Jul 1994 18:46:28 +0000 (+0000) Subject: * ldlang.c (lang_common): Pass desired alignment to X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=36c6e8c37fc1ebc698b8d260c6ef09fe2d18ea69;p=binutils-gdb.git * 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. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 9f7338ee008..904ea7f1cda 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,10 @@ 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, not just the first one. If there is no name, attach all sections even if the SEC_IS_COMMON flag is set. diff --git a/ld/ldlang.c b/ld/ldlang.c index 2a1340ed2fd..be46cbf0c75 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -2185,7 +2185,7 @@ lang_common () { 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, (PTR) &power); } @@ -2200,49 +2200,24 @@ lang_one_common (h, info) { unsigned int power_of_two; bfd_vma size; - size_t align; asection *section; if (h->type != bfd_link_hash_common) return true; size = h->u.c.size; - switch (size) - { - 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) + power_of_two = h->u.c.alignment_power; + + if (config.sort_common + && power_of_two < *(unsigned int *) info + && *(unsigned int *) info < 4) return true; section = h->u.c.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. */ if (power_of_two > section->alignment_power)