This is the mail archive of the binutils@sourceware.org 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: How to limit the size of the gap between sections using objcopy?


Hi Pan,

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.


You can either modify objcopy to add this functionality, or else you could write a shell script which runs objdump or readelf, extracts the section start addresses and sizes and then computes whether the resulting converted binary will be too big.

Cheers
  Nick



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