Linker bug in Debian unstable?
GNU ld version 2.14.90.0.7 20031029 Debian GNU/Linux
Here's the snippet of code (from libgnome-2.6.1-5):
GnomeProgram *gnome_program_init (const char *app_id, const char *app_version,
const GnomeModuleInfo *module_info, int argc, char **argv,
const char *first_property_name, ...)
{
GnomeProgram *program;
va_list args;
g_type_init ();
va_start(args, first_property_name);
program = gnome_program_initv (GNOME_TYPE_PROGRAM,
app_id, app_version, module_info,
argc, argv, first_property_name, args);
va_end(args);
return program;
}objdump -dr gnome-program.o gives:
ac40: 1c 00 94 1c 98 11 [MFB] st8 [r14]=r37
ac42: PCREL21B g_type_init
ac46: 00 00 00 02 00 00 nop.f 0x0
ac4c: 08 00 00 50 br.call.sptk.many b0¬40 <gnome_program_init+0x90>
But objdump -dr .libs/libgnome-2.so.0.601.0:
25750: 1c 00 94 1c 98 11 [MFB] st8 [r14]=r37 25756: 00 00 00 02 00 00 nop.f 0x0 2575c: 08 00 00 50 br.call.sptk.many b0%750 <
gnome_program_init+0x90>
The reloc has gone, but presumably it should still be there as g_type_init() is part of glib-2.0.
NB: This problem currently prevents mozilla from running. Probably other gnome apps too ...
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain
Quoted 38 lines · Matthew Wilcox
GNU ld version 2.14.90.0.7 20031029 Debian GNU/Linux
Here's the snippet of code (from libgnome-2.6.1-5):
GnomeProgram *
gnome_program_init(const char*app_id, const char*app_version,
const GnomeModuleInfo*module_info, int argc, char **argv,
const char*first_property_name, ...){ GnomeProgram *program; va_list args; g_type_init (); va_start(args, first_property_name); program = gnome_program_initv (GNOME_TYPE_PROGRAM, app_id, app_version, module_info, argc, argv, first_property_name, args); va_end(args); return program; }objdump -dr gnome-program.o gives:
ac40: 1c 00 94 1c 98 11 [MFB] st8 [r14]=r37 ac42: PCREL21B g_type_init ac46: 00 00 00 02 00 00 nop.f 0x0 ac4c: 08 00 00 50 br.call.sptk.many b0¬40 <g
nome_program_init+0x90>But objdump -dr .libs/libgnome-2.so.0.601.0:
25750: 1c 00 94 1c 98 11 [MFB] st8 [r14]=r37 25756: 00 00 00 02 00 00 nop.f 0x0 2575c: 08 00 00 50 br.call.sptk.many b0%750 <
Quoted 8 lines
gnome_program_init+0x90>The reloc has gone, but presumably it should still be there as
g_type_init()is part of glib-2.0.NB: This problem currently prevents mozilla from running. Probably other gnome apps too ...
Are you talking about
http://sources.redhat.com/ml/binutils/2004-06/msg00295.html
H.J.
Quoted 3 lines · H. J. Lu
Are you talking about
Looks like the same problem. Could you split out the patch so it can be applied to the Debian binutils?
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain
Quoted 8 lines · Matthew Wilcox
Quoted 3 lines · H. J. Lu
Are you talking about
Looks like the same problem. Could you split out the patch so it can be applied to the Debian binutils?
That is the one I checked into CVS. I don't know if it will work for the binutils.
H.J.
bfd/
2004-03-15 H.J. Lu <[email protected]>
* elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Report error if unresolved symbols in objects aren't allowed.
* elf-hppa.h (elf_hppa_relocate_section): Properly handle unresolved symbols. (elf_hppa_remark_useless_dynamic_symbols): Likewise. (elf_hppa_unmark_useless_dynamic_symbols):
* elf32-frv.c (elf32_frv_relocate_section): Likewise.
* elf32-hppa.c (elf32_hppa_size_stubs): Likewise. (elf32_hppa_relocate_section): Likewise.
* elf32-i370.c (i370_elf_relocate_section): Likewise.
* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
* elf32-sh.c (sh_elf_relocate_section): Likewise.
* elf64-sh64.c (sh_elf64_relocate_section): Likewise.
* elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
* elf-m10200.c (mn10200_elf_relocate_section): Use RELOC_FOR_GLOBAL_SYMBOL.
* elf32-avr.c (elf32_avr_relocate_section): Likewise.
* elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
* elf32-fr30.c (fr30_elf_relocate_section): Likewise.
* elf32-h8300.c (elf32_h8_relocate_section): Likewise.
* elf32-i860.c (elf32_i860_relocate_section): Likewise.
* elf32-m68hc1x.c (m68hc11_get_relocation_value): Likewise.
* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
* elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
* elf32-v850.c (v850_elf_relocate_section): Likewise.
* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
* elf64-mmix.c (mmix_elf_relocate_section): Likewise.
include/
2004-03-15 H.J. Lu <[email protected]>
* bfdlink.h (bfd_link_info): Correct comments for the unresolved_syms_in_objects field.
ld/
2004-03-15 H.J. Lu <[email protected]>
* lexsup.c (parse_args): Don't set unresolved_syms_in_objects or unresolved_syms_in_shared_libs for -Bdynamic and -Bstatic.
bfd/elf-bfd.h renamed from bfd/elf-bfd.h.defs +2 -4
@@ -1757,8 +1757,7 @@ extern bfd_boolean _sh_elf_set_mach_from } \else if (h->root.type == bfd_link_hash_undefweak) \ ; \ -else if (!info->executable \ - && info->unresolved_syms_in_objects ==RM_IGNORE \ +else if (info->unresolved_syms_in_objects ==RM_IGNORE \ &&ELF_ST_VISIBILITY (h->other) ==STV_DEFAULT ) \ ; \else \
@@ -1766,8 +1765,7 @@ extern bfd_boolean _sh_elf_set_mach_fromif (! info->callbacks->undefined_symbol \ (info, h->root.root.string, input_bfd, \ input_section, rel->r_offset, \ - ((info->shared && info->unresolved_syms_in_shared_libs ==RM_GENERATE_ERROR ) \ - || (!info->shared && info->unresolved_syms_in_objects ==RM_GENERATE_ERROR ) \ + (info->unresolved_syms_in_objects ==RM_GENERATE_ERROR \ ||ELF_ST_VISIBILITY (h->other)) \ )) \return FALSE; \
bfd/elf-hppa.h renamed from bfd/elf-hppa.h.defs +6 -13
@@ -1096,8 +1096,7 @@ elf_hppa_unmark_useless_dynamic_symbolsUltimately we should have better controls over the generic ELF BFD linker code. */ if (! info->relocatable - && ! (info->shared - && info->unresolved_syms_in_shared_libs ==RM_IGNORE ) + && info->unresolved_syms_in_shared_libs !=RM_IGNORE && h->root.type == bfd_link_hash_undefined && (h->elf_link_hash_flags &ELF_LINK_HASH_REF_DYNAMIC ) !=0 && (h->elf_link_hash_flags &ELF_LINK_HASH_REF_REGULAR ) ==0 )
@@ -1131,8 +1130,7 @@ elf_hppa_remark_useless_dynamic_symbolsUltimately we should have better controls over the generic ELF BFD linker code. */ if (! info->relocatable - && ! (info->shared - && info->unresolved_syms_in_shared_libs ==RM_IGNORE ) + && info->unresolved_syms_in_shared_libs !=RM_IGNORE && h->root.type == bfd_link_hash_undefined && (h->elf_link_hash_flags &ELF_LINK_HASH_REF_DYNAMIC ) ==0 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
@@ -1398,16 +1396,9 @@ elf_hppa_relocate_section (bfd *output_belse relocation =0 ; } -/* Allow undefined symbols in shared libraries. */ -else if (info->shared - && info->unresolved_syms_in_shared_libs ==RM_IGNORE +else if (info->unresolved_syms_in_objects ==RM_IGNORE &&ELF_ST_VISIBILITY (h->other) ==STV_DEFAULT ) { -if (info->symbolic) - (*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, FALSE); -/* If this symbol has an entry in the PA64 dynamic hash table, then get it. */ dyn_name = get_dyn_name (input_bfd, h, rel,
@@ -1449,7 +1440,9 @@ elf_hppa_relocate_section (bfd *output_b {if (!((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) + input_section, rel->r_offset, + (info->unresolved_syms_in_objects ==RM_GENERATE_ERROR + ||ELF_ST_VISIBILITY (h->other)))))return FALSE;break ; }
bfd/elf-m10200.c renamed from bfd/elf-m10200.c.defs +5 -22
@@ -377,28 +377,11 @@ mn10200_elf_relocate_section (output_bfd }else { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; -while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; -if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } -else if (h->root.type == bfd_link_hash_undefweak) - relocation =0 ; -else - { -if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; - relocation =0 ; - } +bfd_boolean unresolved_reloc, warned; + +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, warned); } r = mn10200_elf_final_link_relocate (howto, input_bfd, output_bfd,
bfd/elf32-avr.c renamed from bfd/elf32-avr.c.defs +4 -27
@@ -758,34 +758,11 @@ elf32_avr_relocate_section (output_bfd, }else { - h = sym_hashes [r_symndx - symtab_hdr->sh_info]; +bfd_boolean unresolved_reloc, warned; -while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - name = h->root.root.string; - -if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } -else if (h->root.type == bfd_link_hash_undefweak) - { - relocation =0 ; - } -else - { -if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; - relocation =0 ; - } +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, warned); } r = avr_final_link_relocate (howto, input_bfd, input_section,
bfd/elf32-d10v.c renamed from bfd/elf32-d10v.c.defs +5 -22
@@ -517,28 +517,11 @@ elf32_d10v_relocate_section (output_bfd, }else { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; -while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; -if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } -else if (h->root.type == bfd_link_hash_undefweak) - relocation =0 ; -else - { -if (!((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; - relocation =0 ; - } +bfd_boolean unresolved_reloc, warned; + +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, warned); }if (h !=NULL )
bfd/elf32-fr30.c renamed from bfd/elf32-fr30.c.defs +4 -40
51 lines not on this page · raw message
bfd/elf32-frv.c renamed from bfd/elf32-frv.c.defs +4 -4
@@ -1958,16 +1958,16 @@ elf32_frv_relocate_section (output_bfd, { relocation =0 ; } - else if ( ! info->executable - && ! info->symbolic - && info->unresolved_syms_in_objects == RM_IGNORE + else if (info->unresolved_syms_in_objects == RM_IGNORE && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation =0 ; else {if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) + input_section, rel->r_offset, + (info->unresolved_syms_in_objects ==RM_GENERATE_ERROR + ||ELF_ST_VISIBILITY (h->other)))))return FALSE; relocation =0 ; }
bfd/elf32-h8300.c renamed from bfd/elf32-h8300.c.defs +5 -22
@@ -439,28 +439,11 @@ elf32_h8_relocate_section (bfd *output_b }else { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; -while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; -if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } -else if (h->root.type == bfd_link_hash_undefweak) - relocation =0 ; -else - { -if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; - relocation =0 ; - } +bfd_boolean unresolved_reloc, warned; + +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, warned); } r = elf32_h8_final_link_relocate (r_type, input_bfd, output_bfd,
bfd/elf32-hppa.c renamed from bfd/elf32-hppa.c.defs +3 -7
@@ -2792,8 +2792,7 @@ elf32_hppa_size_stubs }else if (hash->elf.root.type == bfd_link_hash_undefined) { -if (! (info->shared - && info->unresolved_syms_in_objects ==RM_IGNORE +if (! (info->unresolved_syms_in_objects ==RM_IGNORE && (ELF_ST_VISIBILITY (hash->elf.other) ==STV_DEFAULT ) && hash->elf.type !=STT_PARISC_MILLI ))
@@ -3440,16 +3439,13 @@ elf32_hppa_relocate_section (bfd *output && hh->root.type != bfd_link_hash_defweak && hh->root.type != bfd_link_hash_undefweak) { -if (!info->executable - && info->unresolved_syms_in_objects ==RM_IGNORE +if (info->unresolved_syms_in_objects ==RM_IGNORE &&ELF_ST_VISIBILITY (hh->other) ==STV_DEFAULT && hh->type ==STT_PARISC_MILLI ) {if (! info->callbacks->undefined_symbol (info, hh->root.root.string, input_bfd, - input_section, rel->r_offset, - ((info->shared && info->unresolved_syms_in_shared_libs ==RM_GENERATE_ERROR ) - || (!info->shared && info->unresolved_syms_in_objects ==RM_GENERATE_ERROR )))) + input_section, rel->r_offset, FALSE))return FALSE; warned_undef = TRUE; }
bfd/elf32-i370.c renamed from bfd/elf32-i370.c.defs +11 -9
@@ -1246,19 +1246,21 @@ i370_elf_relocate_section (output_bfd, i }else if (h->root.type == bfd_link_hash_undefweak) relocation =0 ; -else if (info->shared +else if (info->unresolved_syms_in_objects ==RM_IGNORE &&ELF_ST_VISIBILITY (h->other) ==STV_DEFAULT ) relocation =0 ;else { - (*info->callbacks->undefined_symbol) (info, - h->root.root.string, - input_bfd, - input_section, - rel->r_offset, - TRUE); - ret = FALSE; -continue ; +if ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, + (info->unresolved_syms_in_objects ==RM_GENERATE_ERROR + ||ELF_ST_VISIBILITY (h->other)))) + { + ret = FALSE; +continue ; + } + relocation =0 ; } }
bfd/elf32-i860.c renamed from bfd/elf32-i860.c.defs +4 -27
@@ -1112,34 +1112,11 @@ elf32_i860_relocate_section (bfd *output }else { - h = sym_hashes [r_symndx - symtab_hdr->sh_info]; +bfd_boolean unresolved_reloc, warned; -while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - name = h->root.root.string; - -if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } -else if (h->root.type == bfd_link_hash_undefweak) - { - relocation =0 ; - } -else - { -if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; - relocation =0 ; - } +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, warned); } switch (r_type)
bfd/elf32-m32r.c renamed from bfd/elf32-m32r.c.defs +2 -3
@@ -2773,8 +2773,7 @@ m32r_elf_relocate_section (output_bfd, i }else if (h->root.type == bfd_link_hash_undefweak) relocation =0 ; -else if (info->shared - && (!info->symbolic) +else if (info->unresolved_syms_in_objects ==RM_IGNORE &&ELF_ST_VISIBILITY (h->other) ==STV_DEFAULT ) relocation =0 ;else
@@ -2782,7 +2781,7 @@ m32r_elf_relocate_section (output_bfd, iif (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, offset, - (!info->shared + (info->unresolved_syms_in_objects ==RM_GENERATE_ERROR ||ELF_ST_VISIBILITY (h->other)))))return FALSE; relocation =0 ;
bfd/elf32-m68hc1x.c renamed from bfd/elf32-m68hc1x.c.defs +14 -39
93 lines not on this page · raw message
bfd/elf32-mcore.c renamed from bfd/elf32-mcore.c.defs +4 -23
@@ -472,30 +472,11 @@ mcore_elf_relocate_section (output_bfd, }else { - h = sym_hashes [r_symndx - symtab_hdr->sh_info]; -if ( h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } -else if (h->root.type == bfd_link_hash_undefweak) - relocation =0 ; -else if (info->shared - &&ELF_ST_VISIBILITY (h->other) ==STV_DEFAULT ) - relocation =0 ; -else - { -if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; +bfd_boolean unresolved_reloc, warned; - ret = FALSE; -continue ; - } +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, warned); } switch (r_type)
bfd/elf32-msp430.c renamed from bfd/elf32-msp430.c.defs +4 -26
@@ -457,33 +457,11 @@ elf32_msp430_relocate_section (output_bf }else { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; +bfd_boolean unresolved_reloc, warned; -while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - name = h->root.root.string; - -if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma + sec->output_offset); - } -else if (h->root.type == bfd_link_hash_undefweak) - { - relocation =0 ; - } -else - { -if (!((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; - relocation =0 ; - } +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, warned); } r = msp430_final_link_relocate (howto, input_bfd, input_section,
bfd/elf32-openrisc.c renamed from bfd/elf32-openrisc.c.defs +4 -25
@@ -383,33 +383,12 @@ openrisc_elf_relocate_section (output_bf }else { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; +bfd_boolean unresolved_reloc, warned; -while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, warned); - name = h->root.root.string; - -if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma + sec->output_offset); - } -else if (h->root.type == bfd_link_hash_undefweak) - { - relocation =0 ; - } -else - { -if (!((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; - relocation =0 ; - } } r = openrisc_final_link_relocate (howto, input_bfd, input_section,
bfd/elf32-sh.c renamed from bfd/elf32-sh.c.defs +2 -4
@@ -4938,8 +4938,7 @@ sh_elf_relocate_section (bfd *output_bfd }else if (h->root.type == bfd_link_hash_undefweak) relocation =0 ; -else if (! info->executable - && info->unresolved_syms_in_objects ==RM_IGNORE +else if (info->unresolved_syms_in_objects ==RM_IGNORE &&ELF_ST_VISIBILITY (h->other) ==STV_DEFAULT ) relocation =0 ;else
@@ -4947,8 +4946,7 @@ sh_elf_relocate_section (bfd *output_bfdif (! info->callbacks->undefined_symbol (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - ((info->shared && info->unresolved_syms_in_shared_libs ==RM_GENERATE_ERROR ) - || (!info->shared && info->unresolved_syms_in_objects ==RM_GENERATE_ERROR ) + (info->unresolved_syms_in_objects ==RM_GENERATE_ERROR ||ELF_ST_VISIBILITY (h->other))))return FALSE; relocation =0 ;
bfd/elf32-v850.c renamed from bfd/elf32-v850.c.defs +4 -36
@@ -1696,43 +1696,11 @@ v850_elf_relocate_section (output_bfd, i }else { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; +bfd_boolean unresolved_reloc, warned; -while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - -if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); -#if 0 -fprintf (stderr,"defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n" , - sec->name, h->root.root.string, h->root.u.def.value, sec->output_section->vma, sec->output_offset, relocation); -#endif - } -else if (h->root.type == bfd_link_hash_undefweak) - { -#if 0 -fprintf (stderr,"undefined: sec: %s, name: %s\n" , - sec->name, h->root.root.string); -#endif - relocation =0 ; - } -else - { -if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; -#if 0 -fprintf (stderr,"unknown: name: %s\n" , h->root.root.string); -#endif - relocation =0 ; - } +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, warned); }/* FIXME: We should use the addend, but the COFF relocations don't. */
bfd/elf32-xstormy16.c renamed from bfd/elf32-xstormy16.c.defs +4 -27
@@ -853,34 +853,11 @@ xstormy16_elf_relocate_section (output_b }else { - h = sym_hashes [r_symndx - symtab_hdr->sh_info]; +bfd_boolean unresolved_reloc, warned; -while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - name = h->root.root.string; - -if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } -else if (h->root.type == bfd_link_hash_undefweak) - { - relocation =0 ; - } -else - { -if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; - relocation =0 ; - } +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, warned); } switch (ELF32_R_TYPE (rel->r_info))
bfd/elf64-mmix.c renamed from bfd/elf64-mmix.c.defs +4 -32
@@ -1480,39 +1480,11 @@ mmix_elf_relocate_section (output_bfd, i }else { - h = sym_hashes [r_symndx - symtab_hdr->sh_info]; +bfd_boolean unresolved_reloc; -while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - name = h->root.root.string; - -if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } -else if (h->root.type == bfd_link_hash_undefweak) - relocation =0 ; -else if (info->shared - &&ELF_ST_VISIBILITY (h->other) ==STV_DEFAULT ) - relocation =0 ; -else - { -/* The test on undefined_signalled is redundant at the -moment, but kept for symmetry. */ -if (! undefined_signalled - && ! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) -return FALSE; - undefined_signalled = TRUE; - relocation =0 ; - } +RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, symtab_hdr, + relocation, sec, unresolved_reloc, + info, undefined_signalled); } r = mmix_final_link_relocate (howto, input_section,
bfd/elf64-sh64.c renamed from bfd/elf64-sh64.c.defs +5 -4
@@ -1703,15 +1703,16 @@ sh_elf64_relocate_section (bfd *output_b }else if (h->root.type == bfd_link_hash_undefweak) relocation =0 ; -else if (info->shared - && !info->symbolic - && info->unresolved_syms_in_objects ==RM_IGNORE ) +else if (info->unresolved_syms_in_objects ==RM_IGNORE + &&ELF_ST_VISIBILITY (h->other) ==STV_DEFAULT ) relocation =0 ;else {if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) + input_section, rel->r_offset, + (info->unresolved_syms_in_objects ==RM_GENERATE_ERROR + ||ELF_ST_VISIBILITY (h->other)))))return FALSE; relocation =0 ; }
bfd/elfxx-mips.c renamed from bfd/elfxx-mips.c.defs +3 -5
@@ -3156,8 +3156,7 @@ mips_elf_calculate_relocation (bfd *abfdand check to see if they exist by looking at their addresses. */ symbol =0 ; - else if (info->shared - && info->unresolved_syms_in_objects == RM_IGNORE + else if (info->unresolved_syms_in_objects == RM_IGNORE && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT) symbol =0 ; else if (strcmp (*namep, "_DYNAMIC_LINK") == 0 ||
@@ -3178,9 +3177,8 @@ mips_elf_calculate_relocation (bfd *abfdif (! ((*info->callbacks->undefined_symbol) (info, h->root.root.root.string, input_bfd, input_section, relocation->r_offset, - ((info->shared && info->unresolved_syms_in_shared_libs ==RM_GENERATE_ERROR ) - || (!info->shared && info->unresolved_syms_in_objects ==RM_GENERATE_ERROR ) - ||ELF_ST_VISIBILITY (h->root.other))))) + (info->unresolved_syms_in_objects ==RM_GENERATE_ERROR ) + ||ELF_ST_VISIBILITY (h->root.other))))return bfd_reloc_undefined; symbol =0 ; }
include/bfdlink.h renamed from include/bfdlink.h.defs +3 -3
@@ -303,9 +303,9 @@ struct bfd_link_info unsigned int noexecstack: 1;/* What to do with unresolved symbols in an object file. -When producing static binaries the default is GENERATE_ERROR. -When producing dynamic binaries the default is IGNORE. The -assumption with dynamic binaries is that the reference will be +When producing executables the default is GENERATE_ERROR. +When producing shared libraries the default is IGNORE. The +assumption with shared libraries is that the reference will be resolved at load/execution time. */ enum report_method unresolved_syms_in_objects;
ld/lexsup.c renamed from ld/lexsup.c.defs +0 -18
@@ -638,27 +638,9 @@ parse_args (unsigned argc, char **argv)break ;case OPTION_CALL_SHARED : config.dynamic_link = TRUE; -/* When linking against shared libraries, the default behaviour is -to report any unresolved references. Although strictly speaking -it is not a failure to encounter unresolved symbols at link time -- the symbol *might* be available at load time - it is a strong -indication that the resulting executable will not work. Plus it -is necessary for the correct execution of the autoconf package, -which needs to be able to detect functions that are not provided -by the host OS. */ -if (link_info.unresolved_syms_in_objects ==RM_NOT_YET_SET ) - link_info.unresolved_syms_in_objects = how_to_report_unresolved_symbols; -if (link_info.unresolved_syms_in_shared_libs ==RM_NOT_YET_SET ) - link_info.unresolved_syms_in_shared_libs = how_to_report_unresolved_symbols;break ;case OPTION_NON_SHARED : config.dynamic_link = FALSE; -/* When linking against static libraries, the default -behaviour is to report any unresolved references. */ -if (link_info.unresolved_syms_in_objects ==RM_NOT_YET_SET ) - link_info.unresolved_syms_in_objects = how_to_report_unresolved_symbols; -if (link_info.unresolved_syms_in_shared_libs ==RM_NOT_YET_SET ) - link_info.unresolved_syms_in_shared_libs = how_to_report_unresolved_symbols;break ;case OPTION_CREF : command_line.cref = TRUE;
Quoted 2 lines · H. J. Lu
That is the one I checked into CVS. I don't know if it will work for the binutils.
Thanks for that. Unfortunately, it seems to not be enough; when I apply it to Debian's binutils (and fix up some rejects, no big deal), I get:
cc -shared .libs/libgnometypebuiltins.o .libs/gnome-config.o .libs/gnome-sound
.o .libs/gnome-triggers.o .libs/gnome-program.o .libs/gnome-help.o .libs/gnome-e xec.o .libs/gnome-gconf.o .libs/gnome-i18n.o .libs/gnome-url.o .libs/gnome-util.
o .libs/gnome-score.o .libs/gnome-init.o -L/usr/lib -pthread /usr/lib/libgnomev fs-2.so /usr/lib/libbonobo-2.so /usr/lib/libbonobo-activation.so /usr/lib/libgco nf-2.so /usr/lib/libORBit-2.so /usr/lib/libgmodule-2.0.so -ldl /usr/lib/libgthre ad-2.0.so /usr/lib/libglib-2.0.so /usr/lib/libesd.so /usr/lib/libaudiofile.so -l m /usr/lib/libpopt.so -Wl,-z -Wl,defs -Wl,-O1 -Wl,--export-dynamic -Wl,-soname -Wl,libgnome-2.so.0 -Wl,-version-script -Wl,.libs/libgnome-2.ver -o .libs/libgno me-2.so.0.601.0
.libs/libgnometypebuiltins.o(.text+0x52): In function `gnome_trigger_type_get_ty pe':/home/willy/debian/gnmoe/libgnome-2.6.1/libgnome/libgnometypebuiltins.c:24: unde fined reference to `g_enum_register_static'
(millions more undefined references follow)
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain
Quoted 6 lines · Matthew Wilcox
The reloc has gone, but presumably it should still be there as
g_type_init()is part of glib-2.0.NB: This problem currently prevents mozilla from running. Probably other gnome apps too ...
fyi, see debian bug #256955 & the stuff I added today to #252550. I've started running a deb I built w/ the latest binutils so I can more easily detect these issues.
debian/sid/gnome seems to be running fine for me again.
Signature · 5 lines
--------------------------- dann frazier Hewlett-Packard Linux and Open Source Lab [email protected]
Quoted 7 lines · Matthew Wilcox
Quoted 2 lines · H. J. Lu
That is the one I checked into CVS. I don't know if it will work for the binutils.
Thanks for that. Unfortunately, it seems to not be enough; when I apply it to Debian's binutils (and fix up some rejects, no big deal), I get:
Quoted 16 lines
cc -shared
.libs/libgnometypebuiltins.o.libs/gnome-config.o.libs/gnome-sound
.o.libs/gnome-triggers.o.libs/gnome-program.o.libs/gnome-help.o.libs/gnome-e xec.o.libs/gnome-gconf.o.libs/gnome-i18n.o.libs/gnome-url.o.libs/gnome-util.
o.libs/gnome-score.o.libs/gnome-init.o-L/usr/lib -pthread/usr/lib/libgnomevfs-2.so/usr/lib/libbonobo-2.so/usr/lib/libbonobo-activation.so/usr/lib/libgconf-2.so/usr/lib/libORBit-2.so/usr/lib/libgmodule-2.0.so-ldl/usr/lib/libgthread-2.0.so/usr/lib/libglib-2.0.so/usr/lib/libesd.so/usr/lib/libaudiofile.so-l m/usr/lib/libpopt.so-Wl,-z -Wl,defs -Wl,-O1 -Wl,--export-dynamic -Wl,-soname -Wl,libgnome-2.so.0 -Wl,-version-script -Wl,.libs/libgnome-2.ver -o .libs/libgno me-2.so.0.601.0
.libs/libgnometypebuiltins.o(.text+0x52): In function `gnome_trigger_type_get_ty pe':/home/willy/debian/gnmoe/libgnome-2.6.1/libgnome/libgnometypebuiltins.c:24: unde fined reference to `g_enum_register_static'
(millions more undefined references follow)
That is what this patch is supposed to do. When you pass "-z defs" to the linker, you'd better to make sure there are no undefined references. The old linker just generated bad binaries with "-z defs".
H.J.