- /* If it's not loaded, we don't need to relocate it this way. */
- if (!(s->output_section->flags & SEC_LOAD))
- continue;
+ /* If the section is not going to be output, then ignore it. */
+ if (s->output_section == NULL)
+ {
+ /* PR 29998: LTO processing can elminate whole code sections,
+ but it sets the output section to NULL rather than *ABS*.
+ Fix that here, then ignore the section. */
+ s->output_section = bfd_abs_section_ptr;
+ continue;
+ }