This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: REGINFO program header is lost with --gc-sections on mipsel
- From: Ian Lance Taylor <iant at google dot com>
- To: KertÃsz Csaba <csaba dot kertesz at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 03 Nov 2010 08:22:50 -0700
- Subject: Re: REGINFO program header is lost with --gc-sections on mipsel
- References: <AANLkTi=8BQsG8j9-xNQkTn1crubWRtUP+UvJFMbhY5d1@mail.gmail.com>
KertÃsz Csaba <csaba.kertesz@gmail.com> writes:
> I have binutils-2.17+gcc 4.1.2, generating static binaries for mipsel.
> If I compile my sources with -fdata-sections and -ffunction-sections,
> after the final linking stage:
>
> - without --gc-sections, I have two program headers in the binary: one
> REGINFO {.reginfo} and one LOAD {.reginfo, .init, .text, ... }
> - with --gc-sections, I have only LOAD {.reginfo, .init, .text, ... }
> and REGINFO is missing
>
> My platform complains if the final binary does not contain these two
> program headers.
>
> Can anybody advice something, how to have the REGINFO program header
> while using --gc-sections or manually inject into the binary somehow?
>
> Upgrading gcc or binutils is not an option.
If you can't fix your copy of the binutils, then you will need to use a
linker script which uses KEEP. You can get the default linker script
using ld --verbose. Look for the .reginfo line, and edit it to use
KEEP (*(.reginfo) ) or something similar. Then always use that linker
script when linking with --gc-sections.
Ian