This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
R_PPC_LOCAL24PC c++ linking problems with current binutils
- To: binutils@sourceware.cygnus.com
- Subject: R_PPC_LOCAL24PC c++ linking problems with current binutils
- From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
- Date: Tue, 20 Jul 1999 00:07:53 +0200
- Cc: drow@false.org,geoffk@ozemail.com.au
Hi,
linking this little program currently fails on Linux/PPC, glibc-2.1:
mmaptest.cc:
#include <string>
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<true, 0>::_S_chunk_alloc(unsigned int, int &)':
mmaptest.o(.__default_alloc_template<true, 0>::gnu.linkonce.t._S_chunk_alloc(unsigned int, int &)+0x234): undefined reference to `__default_alloc_template<true, 0>::_S_chunk_alloc(unsigned int, int &)'
mmaptest.o(.__default_alloc_template<true, 0>::gnu.linkonce.t._S_chunk_alloc(unsigned int, int &)+0x2a8): undefined reference to `__default_alloc_template<true, 0>::_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 <geoffk@ozemail.com.au>
* 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.