Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - relocation R_MIPS_26 against 'fpadd' : recompile with -fPIC: (4 Items)
   
relocation R_MIPS_26 against 'fpadd' : recompile with -fPIC  
Hello all,

I am trying to compile a library in QNX 6.4.1. This library was previous built in QNX 6.2.1 and QNX 6.3. From what I see
, the all the files in the library are being compiled to create their *.o files. An error appears when the *.o files are
 being used to created the library's *.so file. Here is the compilation error:

***********************************************************
C:\QNX641\host\win32\x86\usr\bin\ntomips-ld: FP32.o: relocation R_MIPS_26 against `fpadd' can not be used when making a 
shared object; recompile with -fPIC
FP32.o: could not read symbols: Bad value
***********************************************************

The FP32.o is the object file created for a 32 bit floating point library file FP32.s. The compiler says "recompile with
 -fPIC". So I added -fPIC options to CCFLAGS of my project. However this did not help.

I also searched the internet for a solution and in most places the solutions asked me to add the -fPIC option (which I 
already tried).

I really would appreciate it if anybody can provide a solution to my problem.

THanks
Sunil
Re: relocation R_MIPS_26 against 'fpadd' : recompile with -fPIC  
Sunil Keshava wrote:
> Hello all,
> 
> I am trying to compile a library in QNX 6.4.1. This library was previous built in QNX 6.2.1 and QNX 6.3. From what I 
see, the all the files in the library are being compiled to create their *.o files. An error appears when the *.o files 
are being used to created the library's *.so file. Here is the compilation error:
> 
> ***********************************************************
> C:\QNX641\host\win32\x86\usr\bin\ntomips-ld: FP32.o: relocation R_MIPS_26 against `fpadd' can not be used when making 
a shared object; recompile with -fPIC
> FP32.o: could not read symbols: Bad value
> ***********************************************************
> 
> The FP32.o is the object file created for a 32 bit floating point library file FP32.s. The compiler says "recompile 
with -fPIC". So I added -fPIC options to CCFLAGS of my project. However this did not help.
> 
> I also searched the internet for a solution and in most places the solutions asked me to add the -fPIC option (which I
 already tried).
> 
> I really would appreciate it if anybody can provide a solution to my problem.

If your source file is an assembly file (FP32.s), passing -fPIC to the 
compiler won't do any good because the compiler won't even be invoked. 
If this is the case then your assembly has non-PIC code and will need to 
be manually modified. If you're referring to FP32.s as an intermediate 
file and you are invoking the compiler, please see if -mlong-calls makes 
a difference.

Regards,

Ryan Mansfield
Re: relocation R_MIPS_26 against 'fpadd' : recompile with -fPIC  
Thanks for the info Ryan.

FP32.S is an assembly file and not an intermediate file. When I look at the compilation log, I actually observer that 
FP32.S is being compiled by GCC compiler and this creates the object file for FP32.S. So this should be mean that that 
compiler options that I provide in my makefile should be applied while compiling this assemby file also right? Please 
correct me if I am wrong.

I also tried the -mlong-calls option. This also did not help. I will see how I can modify the assembly code to eliminate
 the issue.

Thanks
Sunil
Re: relocation R_MIPS_26 against 'fpadd' : recompile with -fPIC  
Sunil Keshava wrote:
> Thanks for the info Ryan.
> 
> FP32.S is an assembly file and not an intermediate file. When I look at the compilation log, I actually observer that 
FP32.S is being compiled by GCC compiler and this creates the object file for FP32.S. So this should be mean that that 
compiler options that I provide in my makefile should be applied while compiling this assemby file also right? Please 
correct me if I am wrong.

No, it's only invoking the compiler to use the preprocessor. The 
compiler is not generating any assembly code which is why compiler 
options such as -fPIC and -mlong-calls have no effect.

> I also tried the -mlong-calls option. This also did not help. I will see how I can modify the assembly code to 
eliminate the issue.

The code is likely doing something like:

j fpadd

when it needs to:

la t9,fpadd
jalr t9

You can use ntomips-objdump -r/-R to determine what part of your code is 
generating the relocation.

Regards,

Ryan Mansfield