From: Erwin Authried (eauth@softsys.co.at)
Date: Wed Jan 24 2001 - 06:38:31 EST
Tom Walsh[SMTP:tom@cyberiansoftware.com] wrote: > <<Datei: mount32.tar.gz>> > Hello Erwin, > > I have had this potential problem with the m68k-pic32-coff-gcc brought > to my attention, it works this way: > > 1. go into the uClinux romdisk sources. > > 2. edit the makefile for the mount sources and copy over the inherited > stuff from the main Makefile: sucah as the cross utility defines, and > merge the CFLAGS. > > 3. add the -fPIC option to the CFLAGS and compile. > > The linker will complain about truncating glibc.a to fit a DISP16. > > Do we need to recompile glibc in order to use the pic32 compiler? I > thought that I had asked this once before and it was not believed that > we had to do that... I am attaching my hacked mount sources to save you > some time trying to figure out what it is that I attempted to compile. > :-) > > Regards, > > TomW > Hi Tom, that's the error that you are talking about, right? /usr/local/m68k-pic-coff/lib/libc.a(rpc_dtablesize.o)(.text+0xc):rpc_dtablesize.c: relocation truncated to fit: DISP16 getdtablesize make: *** [mount] Error 1 It seems that something is broken with -fPIC since the same package compiles fine without -fPIC. However, that's not the case. In the library function _rpc_dtablesize(), file rpc_dtablesize.c, a function getdtablesize() is called. This function is defined in the application (in mount.c), and not inside libc. Thus, we have a reference from the library to the application. In other words, _rpc_dtablesize should be compiled with -fPIC. I here you ask: "But why did it compile with -fpic"? The answer is simple: The code -fPIC is slightly larger, thus the distance between _rpc_dtablesize() and getdtablesize() is >0x8000 with -fPIC, and <0x8000 with -fpic. The second choice to solve this problem: Leave the libc function as it is, and move the function getdtablesize() towards the end of your object list. Without doubt, it is better if all library modules with references to external functions that are not defined inside libc are compiled with -fPIC. This will save a lot of headaches. P.S.: I have sent a cc: to uclinux-dev Regards, Erwin This message resent by the uclinux-dev@uclinux.org list server http://www.uClinux.org/
This archive was generated by hypermail 2.1.4 : Thu Sep 19 2002 - 13:19:27 EDT