From mboxrd@z Thu Jan 1 00:00:00 1970 From: Franz Sirl To: binutils@sourceware.cygnus.com Cc: drow@false.org, geoffk@ozemail.com.au Subject: R_PPC_LOCAL24PC c++ linking problems with current binutils Date: Mon, 19 Jul 1999 15:21:00 -0000 Message-id: <99072000221900.00843@ns1102.munich.netsurf.de> X-SW-Source: 1999-q3/msg00266.html Hi, linking this little program currently fails on Linux/PPC, glibc-2.1: mmaptest.cc: #include class FileFd { public: int iFd; unsigned long Flags; string FileName; FileFd(int Fd,bool) : iFd(Fd), Flags(0) {}; virtual ~FileFd(); }; Compiling with c++ -o mmaptest.so -fPIC -shared mmaptest.cc gives: mmaptest.o: In function `__default_alloc_template::_S_chunk_alloc(unsigned int, int &)': mmaptest.o(.__default_alloc_template::gnu.linkonce.t._S_chunk_alloc(unsigned int, int &)+0x234): undefined reference to `__default_alloc_template::_S_chunk_alloc(unsigned int, int &)' mmaptest.o(.__default_alloc_template::gnu.linkonce.t._S_chunk_alloc(unsigned int, int &)+0x2a8): undefined reference to `__default_alloc_template::_S_chunk_alloc(unsigned int, int &)' collect2: ld returned 1 exit status The relevant code in elf32-ppc.c looks like: /* Relocations that need no special processing. */ case (int)R_PPC_LOCAL24PC: /* It makes no sense to point a local relocation at a symbol not in this object. */ if (h != NULL && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && sec->output_section == NULL) { if (! (*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset)) return false; continue; } break; We enter here with h->root.type == bfd_link_hash_defined and sec->output_section == NULL for the symbols in question. This didn't happen older binutils (2.9.1) and it maybe related to the following patch: Tue Jun 2 13:51:00 1998 Geoff Keating * elf32-ppc.c (ppc_elf_relocate_section): The target of an R_PPC_LOCAL24PC relocation should be local; if not, print an error message instead of crashing. I'm lost here for the moment. If I can test anything else, please let me know. Franz.