This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


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

Help needed with linking


Hi,

I've run into a problem that I just can't get past. In digging into
it I managed to get myself more befuddled than I was before I started.
I spare you all those questions and will be happy to get my setup working
correctly. Hopefully I've provided all the info some kind soul needs
to figure this out.

I'm using gcc-2.8.1 and binutils-2.8.1 on a SunOS 4.1.3 system. I get
the same problem with gcc-2.8.1 and binutils-2.9.1 on Solaris 5.6

When I compile this program

    int x;
    int *y = &x;

    int
    main()
    {
	return(1);
    }

using

    mips64orion-elf-gcc -G 8 -I../include -c -mcpu=r4600 -mips3 vb.c
    mips64orion-elf-ld -G 8 -T./user.gnu -L . -o vb.elf vb.o -lwmiu

I get the following error.

    mips64orion-elf-ld: address 0xa80 of vb.elf section .data is not within
	region user

As best as I can tell it has to do with the statement, int *y = &x;
i.e. The linker bombs anytime I try to resolve a reference to another
variable at link time rather than at run time.

Here is my link script. Do I need to modify this or is my problem
somewhere else? The linker map has a reference to .rel.dyn but adding
this to the script only makes things worse.

OUTPUT_FORMAT("elf32-bigmips")
OUTPUT_ARCH(mips)
ENTRY(_main);
MEMORY {
	user : ORIGIN = 0x00001000, LENGTH = 0x7FFFE000
					/* 0 - 0xfff defined invalid by kernel */
}

SECTIONS {

	.text 0x1000 : {
		startShared = .;
		*(.rodata)
		*(.text)
		endShared = .;
	} >user

	.data ALIGN(0x1000) : {		/* must be page aligned so doesn't get shared with text */
		*(.reginfo)
		*(.data)
		*(.rdata)
		_gp = . + 0x8000;
		*(.lit4)
		. = ALIGN(8);
		*(.lit8)
		*(.sdata)
	} >user

	.bss ALIGN(8) (NOLOAD) : {	/* uninitialized data */
		_start_bss = . ;
		*(.scommon)
		*(.sbss)		/* keep sbss and bss together for zeroing */
		*(.bss)
		*(COMMON)
		_end_bss = . - 4;	/* _end_bss address of last word to be zeroed */
		_start_stack = .;	/* start of stack - change this value to change size of stack*/
		. += 0x400000 ;		/* space for stack */
		_end_stack = . - 8*5;	/* end of stack (last word of stack) */
		__lc_bh = . ;		/* start of heap */
		. += 0x400000 ;		/* space for heap - change this value to change size of heap */
		__lc_eh = .;		/* end of heap (1st word after heap) */
	} >user

	__startDynamic = ALIGN (0x1000);	/* start of unallocated address space available to shm mapping */
	__stopDynamic = 0x80000000;		/* end of unallocated address space available to shm mapping */


}

Thanks for your help.

 - Joel
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.

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