This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: initializing eh



> > > The problem is:
> > > unresolved symbol _GLOBAL_OFFSET_TABLE_ 
> > 
> > I think this should be provided by the linker.  It is used to set the PIC
> > register.
> > 
> 
> libgcc.a is compiled with -fPIC. But you don't need it for kernel.
> If it is too hard to workaround, you can recompile libgcc.a without
> -fPIC.
For the kernel module I use:

gcc -I. -I./config -DIN_GCC [...] -Dinhibit_libc -DL_eh -c libgcc2.c -o _eh.o
gcc -I. -I./config -DIN_GCC [...] -Dinhibit_libc -DL_pure -c libgcc2.c -o _pure.o

to get the eh function (and pure virtual) symbols. g++ build some symbols for
lockup by libgcc2 for c++ specific features.

ar cru libkc++.a kmemory.o \	; memory allocator for linux kernel space
	kabort.o \		; abort() for kernel space
	new_op.o new_opnt.o new_opv.o new_opvnt.o \ ; new ops
	del_op.o del_opnt.o del_opv.o del_opvnt.o \ ; delete ops
	new_handler.o \		; new handler
	frame.o \		; I guess frame info for eh
	exception.o		; exception classes
	tinfo.o tinfo2.o 		; rtti
	_eh.o 			; eh from libgcc2.c
	_pure.o			; __pure_virtual from libgcc2.x

This ist the libkc++ support for linux kernel module for eh (later maybe with
streams, vector etc.)

Imo the secret is related to __register/__deregister_frameinfo and the
__xx_LIST__ and __xx_END__ Symbols. All symbols are matched. If I see the
normal linker process:
/usr/lib/gcc-lib/i386-redhat-linux/2.95.2/collect2 -m elf_i386 -dynamic-linker 
	/lib/ld-linux.so.2 -o a /usr/lib/crt1.o /usr/lib/crti.o
	/usr/lib/gcc-lib/i386-redhat-linux/2.95.2/crtbegin.o
	-L/usr/lib/gcc-lib/i386-redhat-linux/2.95.2 /tmp/cccA5olZ.o -lgcc -lc -lgcc
	/usr/lib/gcc-lib/i386-redhat-linux/2.95.2/crtend.o /usr/lib/crtn.o

crt{i|n} are additional to me. Unfortunally I have no source on it. I've never
found a symbol _init/_fini in the objectfiles produced by the gcc (for elf
sections) - maybee it's predefined by the linker ?

Thanks
Olaf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]