linux-mips
[Top] [All Lists]

Re: BFD: Warning: Writing section `.text' to huge (ie negative) file off

To: zhuzhenhua <zzh.hust@gmail.com>
Subject: Re: BFD: Warning: Writing section `.text' to huge (ie negative) file offset 0xa1ffff10
From: Nigel Stephens <nigel@mips.com>
Date: Fri, 02 Jun 2006 12:00:41 +0100
Cc: Thiemo Seufer <ths@networkno.de>, linux-mips <linux-mips@linux-mips.org>
In-reply-to: <50c9a2250606011749r7f89fbben2c61edd43c7ec0a6@mail.gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <50c9a2250605312319v7480f2el36d9c0a052c85d5f@mail.gmail.com> <20060601092413.GL1717@networkno.de> <50c9a2250606010356s63f6d6e7j255c77660d6f472a@mail.gmail.com> <447EE274.7060207@mips.com> <50c9a2250606011749r7f89fbben2c61edd43c7ec0a6@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 1.5.0.2 (Windows/20060308)


zhuzhenhua wrote:


I think the problem is not with the linker, but in your use of objcopy
to convert your ELF file to a raw binary file.

1) What arguments are you giving to mipsel-linux-objcopy?
i use objcopy as follow(the brec_flash is elf file)
    mipsel-linux-objcopy -O binary brec_flash brec_flash.bin

2) What is the output from mipsel-linux-objdump -h run on your
intermediate ELF object file?
i use mipsel-linux-objdump -h brec_flash and get messages as follow


brec_flash:     file format elf32-tradlittlemips

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
 0 .text         0000b140  72000000  72000000  00010000  2**4
                 CONTENTS, ALLOC, LOAD, READONLY, CODE
 1 .data         00001080  7200b140  7200b140  0001b140  2**4
                 CONTENTS, ALLOC, LOAD, DATA
 2 .sbss         00000010  7200c1c0  7200c1c0  0001c1c0  2**2
                 ALLOC
 3 .bss          000008a0  7200c1d0  7200c1d0  0001c1c0  2**4
                 ALLOC
 4 .reginfo      00000018  7200ca70  7200ca70  0001ca70  2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA, LINK_ONCE_SAME_SIZE
 5 .pdr          000011a0  00000000  00000000  0001ca88  2**2
                 CONTENTS, READONLY
 6 .mdebug.abi32 00000000  00000000  00000000  0001dc28  2**0
                 CONTENTS, READONLY
 7 .comment      000000ea  00000000  00000000  0001dc28  2**0
                 CONTENTS, READONLY
 8 .rodata       00000190  000000f0  000000f0  000000f0  2**4
                 CONTENTS, ALLOC, LOAD, READONLY, DATA
 9 .rodata.str1.4 000005fe  00000280  00000280  00000280  2**2
                 CONTENTS, ALLOC, LOAD, READONLY, DATA

OK. I think that the final .rodata.str1.4 section is causing your problem because the offset between its load address and the other section is huge, causing "objcopy -O binary" to generate a huge file. This is a new section generated by gcc 3.x and above to hold mergeable constant data. Try changing the line in your linker script which (I'm guessing here) probably looks like this:

   *(.rodata)

to:

    *(.rodata) *(.rodata.*)

Nigel


<Prev in Thread] Current Thread [Next in Thread>