This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: How to create a library which contains absolute addresses of exported functions?

It can't work on some gcc.

int main()
	printf("This is function main!\n");

.globl printf

printf = 0x80001600 


	.text 0x80051000 : 	
	.data :

	.sbss : 
 	.bss :

sde-gcc  -W  -mips32r2 -EL -c -mno-abicalls -fno-pic -G0 -o 1.o 1.c 
1.c:5:2: warning: no newline at end of file
sde-gcc  -W  -mips32r2 -EL -c -mno-abicalls -fno-pic -G0 -o 2.o 2.S 
sde-ld  -T link.xn -EL 1.o 2.o -o a.out
1.o: In function `main':
1.c:(.text+0x18): relocation truncated to fit: R_MIPS_26 against `printf'

The gcc core is
Reading specs from /usr/local/sde-mips/bin/../lib/gcc/sde/3.4.4/specs
Configured with: /cygdrive/c/releasetool.tmp/bank-20070207-1902/B-i386-cygwin/toolchain/mipssde-6.06.00/configure --target=sde --prefix=/usr/local/sde6 --enable-languages=c,c++ --without-newlib --disable-shared --disable-nls --disable-tui --disable-multilib
Thread model: mipssde
gcc version 3.4.4 mipssde-6.06.00-20070207

And it works on another gcc whose core is 
Reading specs from /usr/local/lib/gcc/mips-elf/3.4.0-macraigor1/specs
Configured with: /rel/share/gnu/src/gcc-3.4.0-macraigor1/configure --host=i686-pc-cygwin --target=mips-elf --disable-nls --with-stabs --disable-install-libiberty --disable-install-libbfd --disable-dependency-tracking --enable-64-bit-bfd --enable-languages=c,c++ --with-gnu-as --with-gnu-ld
Thread model: single
gcc version 3.4.0-macraigor1

>You can create a .S file that has entries like this:
>        .global strcpy
>strcpy   = 0x80001600
>        .global vsprintf
>vsprintf = 0x80002290
>        .global memmove
>memmove  = 0x80001e50
>If you assemble that and put it in your library, it will do the same
>thing, without the linker script or .c file.
>You could do one symbol per .S file if you wanted to.

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