This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: How to limit the size of the gap between sections using objcopy?
On Wed, 26 Nov 2008, Nick Clifton wrote:
> > I need to create raw binary files from ELFs in my project. If the
> > linker script of some ELF is like
> >
> > SECTIONS {
> > .syslibc 0x80001000: { ... }
> > .text 0xa0004000: { ... }
> > }
> >
> > There will be a big gap between the section .syslibc and .text. And I
> > run objcopy, objcopy will try to fill the gap, which is not really
> > what I want. I want in the case objcopy will stop and report an error
> > so that I can check and fix the linker scripts.
>
> Ok, I understand now. Unfortunately the answer is "no". Objcopy does not
> have any facilities to abort its operation if the output file is going to be
> too big, or to have to huge gaps inside it.
An option to refuse writing a file larger than, say, N
bytes, where --max-output-size=N would be useful, IMHO, for
both the linker and objcopy. I don't think addressing the
"too-large-gap" problem by a specific option is worthwhile.
Port-specific linker scripts sometimes rot compared to gcc and
binutils or the rest of the code (missing some sections), and
you'd write a multi-GiB-file where a few MeB were expected, when
objcopy:ing the file. It's happened for me with Linux.
brgds, H-P