Index: src/bfd/elf.c =================================================================== RCS file: /cvs/src/src/bfd/elf.c,v --- src/bfd/elf.c 2011/05/23 05:41:00 1.538 +++ src/bfd/elf.c 2011/06/09 10:36:20 @@ -6272,6 +6272,8 @@ || obfd->xvec->flavour != bfd_target_elf_flavour) return TRUE; + BFD_ASSERT (elf_section_data (osec) != NULL); + /* For objcopy and relocatable link, don't copy the output ELF section type from input if the output BFD section flags have been set to something different. For a final link allow some flags @@ -1727,6 +1727,11 @@ if (mips_elf_local_pic_function_p (h)) { + /* PR 12845: If H is in a section that has been garbage + collected it will have its output section set to *ABS*. */ + if (bfd_is_abs_section (h->root.root.u.def.section->output_section)) + return TRUE; + /* H is a function that might need $25 to be valid on entry. If we're creating a non-PIC relocatable object, mark H as being PIC. If we're creating a non-relocatable object with @@ -138,6 +138,11 @@ lang_output_section_statement_type *os; struct hook_stub_info info; + /* PR 12845: If the input section has been garbage collected it will + not have its output section set to *ABS*. */ + if (bfd_is_abs_section (output_section)) + return NULL; + /* Create the stub file, if we haven't already. */ if (stub_file == NULL) {