+ /* If this is not a relocatable link, all we need is the
+ size, which we can get from the input BFD. */
+ if (p->elements->section->owner != NULL)
+ howto = bfd_reloc_type_lookup (p->elements->section->owner,
+ p->reloc);
+ if (howto == NULL)
+ {
+ /* See PR 20911 for a reproducer. */
+ if (p->elements->section->owner == NULL)
+ einfo (_("%X%P: special section %s does not support reloc %s for set %s\n"),
+ bfd_section_name (p->elements->section),
+ bfd_get_reloc_code_name (p->reloc),
+ p->h->root.string);
+ else
+ einfo (_("%X%P: %s does not support reloc %s for set %s\n"),
+ bfd_get_target (p->elements->section->owner),
+ bfd_get_reloc_code_name (p->reloc),
+ p->h->root.string);
+ continue;
+ }
+ }
+
+ reloc_size = bfd_get_reloc_size (howto);
+ switch (reloc_size)
+ {
+ case 1: size = BYTE; break;
+ case 2: size = SHORT; break;
+ case 4: size = LONG; break;
+ case 8:
+ if (howto->complain_on_overflow == complain_overflow_signed)
+ size = SQUAD;
+ else
+ size = QUAD;
+ break;
+ default:
+ einfo (_("%X%P: unsupported size %d for set %s\n"),
+ bfd_get_reloc_size (howto), p->h->root.string);
+ size = LONG;
+ break;
+ }
+
+ lang_add_assignment (exp_assign (".",
+ exp_unop (ALIGN_K,
+ exp_intop (reloc_size)),
+ FALSE));
+ lang_add_assignment (exp_assign (p->h->root.string,
+ exp_nameop (NAME, "."),
+ FALSE));
+ lang_add_data (size, exp_intop (p->count));