+2019-08-28 Jim Wilson <jimw@sifive.com>
+
+ * elfnn-riscv.c (_bfd_riscv_relax_lui): Add check to exclude abs
+ section when setting max_alignment. Update comment.
+ (_bfd_riscv_relax_pc): Likewise.
+
2019-08-29 Alan Modra <amodra@gmail.com>
PR 24891
if (gp)
{
- /* If gp and the symbol are in the same output section, then
- consider only that section's alignment. */
+ /* If gp and the symbol are in the same output section, which is not the
+ abs section, then consider only that output section's alignment. */
struct bfd_link_hash_entry *h =
bfd_link_hash_lookup (link_info->hash, RISCV_GP_SYMBOL, FALSE, FALSE,
TRUE);
- if (h->u.def.section->output_section == sym_sec->output_section)
+ if (h->u.def.section->output_section == sym_sec->output_section
+ && sym_sec->output_section != bfd_abs_section_ptr)
max_alignment = (bfd_vma) 1 << sym_sec->output_section->alignment_power;
}
if (gp)
{
- /* If gp and the symbol are in the same output section, then
- consider only that section's alignment. */
+ /* If gp and the symbol are in the same output section, which is not the
+ abs section, then consider only that output section's alignment. */
struct bfd_link_hash_entry *h =
- bfd_link_hash_lookup (link_info->hash, RISCV_GP_SYMBOL, FALSE, FALSE, TRUE);
- if (h->u.def.section->output_section == sym_sec->output_section)
+ bfd_link_hash_lookup (link_info->hash, RISCV_GP_SYMBOL, FALSE, FALSE,
+ TRUE);
+ if (h->u.def.section->output_section == sym_sec->output_section
+ && sym_sec->output_section != bfd_abs_section_ptr)
max_alignment = (bfd_vma) 1 << sym_sec->output_section->alignment_power;
}