From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Lance Taylor To: mklein@dis.com Cc: binutils@sourceware.cygnus.com Subject: Re: HPPA/SOM Patch Date: Thu, 01 Jul 1999 00:00:00 -0000 Message-id: <19990605035401.13429.qmail@daffy.airs.com> References: <4.1.19990604110845.00bb5100@garfield.dis.com> <199906041738.KAA23662@dis.dis.com> <199906041738.KAA23662@dis.dis.com> <4.1.19990604110845.00bb5100@garfield.dis.com> <4.1.19990604120444.00bb4210@garfield.dis.com> <4.1.19990604120444.00bb4210@garfield.dis.com> X-SW-Source: 1999-q2/msg00140.html Date: Fri, 04 Jun 1999 13:08:43 -0700 From: Mark Klein >If so, why is hppa_fix_adjustable being called after set_symtab? It is part of my earlier fix. There are certain fixups that don't have a symbol associated with them. In that case, the original code referenced a dummy symbol. I changed that to the symbol_get_bfdsym() call below. *** 2886,2892 **** case R_ENTRY: case R_EXIT: /* There is no symbol associated with these fixups. */ ! relocs[i]->sym_ptr_ptr = &dummy_symbol->bsym; relocs[i]->addend = fixp->fx_offset; break; --- 2893,2900 ---- case R_ENTRY: case R_EXIT: /* There is no symbol associated with these fixups. */ ! relocs[i]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); ! *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol); relocs[i]->addend = fixp->fx_offset; break; That in turn is causing tc_gen_reloc() to be invoked within write_relocs() and voila! I don't quite follow that, actually. I don't see why calling symbol_get_bfdsym is causing tc_gen_reloc to get called. But I'll take your word for it. So, did I make a wrong assumption here, or should set_symtab be delayed until after the bfd_map_over_sections (stdoutput, write_relocs, (char *) 0) ? No, I believe set_symtab must be called before the relocations are written out. One way to avoid it would be to call symbol_get_bfdsym immediately after creating dummy_symbol, to force it to be converted to a real symbol before set_symtab is called. Another way would be not use dummy_symbol for this at all, and instead call bfd_create_empty_symbol directly to get something you can set the reloc sym_ptr_ptr field to point to. Ian