This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: ld errors -- wrong output section for SDAREL target
- To: velco at fadata dot bg, meissner at cygnus dot com
- Subject: Re: ld errors -- wrong output section for SDAREL target
- From: Ian Lance Taylor <ian at zembu dot com>
- Date: 20 Mar 2000 19:37:19 -0800
- CC: binutils at sourceware dot cygnus dot com
- References: <38D3F4E3.6BF5826@fadata.bg> <38D545EB.C4F792B4@fadata.bg>
Date: Sun, 19 Mar 2000 23:26:03 +0200
From: Momchil Velikov <velco@fadata.bg>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Momchil Velikov wrote:
> All the objects were compiled with the -msdata option. The relevant
> portion of the
> ld script is:
>
> . = ALIGN(0x1000);
> .data :
> { *(.data)
> *(.gnu.linkonce.d*)
> _SDA_BASE_ = . + 32768;
> PROVIDE(__ctors_start = .);
> *(.ctors)
> PROVIDE(__ctors_end = .);
> *(.sdata)
> }
>
> _edata = .;
> PROVIDE (edata = .);
>
> .bss : { *(.sbss) *(.bss) *(COMMON) }
> _end = . ;
> PROVIDE (end = .);
>
> Yep, it's somewhat unusual. The reason is the bogus bootloader (Apple OF
> 1.0.5)
> -- it initializes only .text, .data and .bss sections.
>
> Does anybody have an idea how to cope with this situation ?
> Is is possible for the linker to relocate against the value of
> _SDA_BASE_ ?
Well, looking closer, the linker DOES relocate against the value of
_SDA_BASE_ and not against the beginning of .sdata.
Ian Lance Taylor wrote:
> BFD appears to assume that those relocations are against the start of
> the .sdata/.sbss output section. Assuming that is correct, then you
> must have a .sdata/.sbss output section if you want to use those
> relocation.
Why is the output section restriction ? Why not simply ignore what the
output section is and let the BFD report relocation overflow if
the symbol is too far away from _SDA_BASE_ ?
I don't know. Michael, I think you wrote this code. The code in
question is in ppc_elf_relocate_section and a couple of other places.
It explicitly checks whether the output section of a R_PPC_SDAREL16
relocation is in the .sdata or .sbss section. Do you remember why it
does this?
Ian