bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mips -membedded-pic fails on ref to global func


From: Jeff Long
Subject: mips -membedded-pic fails on ref to global func
Date: Tue, 21 Nov 2000 21:46:46 -0500

Target: mips-linux-elf (cross)
Host: various Linux, Solaris
Version: 2.10

Cannot reference a global function with -membedded-pic.  A bug
in 'as' makes it impossible to do something like:


main.c:

typedef struct _Event {
  int x;
  int (*handler)( int );
} Event;

extern int defaultHandler( int );

int
f( Event *e ) {
  e->handler = defaultHandler; /*** <---- this is the problem ***/
  e->x = 0;
}


Compile line:

> mips-linux-elf-gcc -O2 -membedded-pic -v -c main.c
Reading specs from
/usr/local/mips/lib/gcc-lib/mips-linux-elf/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/local/mips/lib/gcc-lib/mips-linux-elf/2.95.2/cpp -lang-c -v
-D__GNUC__=2 -D__GNUC_MINOR__=95 -Dmips -DMIPSEB -DR3000 -D_mips
-D_MIPSEB -D_R3000 -D__mips__ -D__MIPSEB__ -D__R3000__ -D___mips__
-D_MIPSEB -D_R3000 -D__mips -D__MIPSEB -D__R3000 -D___mips
-D__OPTIMIZE__ -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C
-D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int main.c
/tmp/ccy6HFrE.i
GNU CPP version 2.95.2 19991024 (release) [AL 1.1, MM 40] BSD Mips
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/mips/lib/gcc-lib/mips-linux-elf/2.95.2/include

/usr/local/mips/lib/gcc-lib/mips-linux-elf/2.95.2/../../../../mips-linux-elf/include
End of search list.
The following default directories have been omitted from the search
path:

/usr/local/mips/lib/gcc-lib/mips-linux-elf/2.95.2/../../../../include/g++-3

/usr/local/mips/lib/gcc-lib/mips-linux-elf/2.95.2/../../../../mips-linux-elf/sys-include
End of omitted list.
 /usr/local/mips/lib/gcc-lib/mips-linux-elf/2.95.2/cc1 /tmp/ccy6HFrE.i
-quiet -dumpbase main.c -membedded-pic -O2 -version -o /tmp/ccemdL57.s
GNU C version 2.95.2 19991024 (release) (mips-linux-elf) compiled by GNU
C version 2.96 20000731 (Red Hat Linux 7.0).
 /usr/local/mips/mips-linux-elf/bin/as -O2 -membedded-pic -v -o main.o
/tmp/ccemdL57.s
GNU assembler version 2.10 (mips-linux-elf) using BFD version 2.10
/tmp/ccemdL57.s: Assembler messages:
/tmp/ccemdL57.s:21: Error: Cannot make BFD_RELOC_LO16 relocation PC
relative


Don't know what the real fix would be, but I did notice that
in gas/config/tc-mips.c, tc_gen_reloc( ), near the bottom,
there is no case for BFD_RELOC_LO16.  Adding the following:

        case BFD_RELOC_LO16:
          code = BFD_RELOC_PCREL_LO16;
          break;

to the list, _seemed_ to fix the problem.

JwL.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]