This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
section `.data` can't be allocated in segment 1
- From: John Breitenbach <breiten at lexmark dot com>
- To: binutils at sourceware dot org
- Date: Thu, 17 Sep 2009 15:45:35 -0400
- Subject: section `.data` can't be allocated in segment 1
Hi, I am encountering the "can't be allocated in segment ..." error as
shown below
when attempting to use objcopy to change the address of my .data
section. readelf -e
output is below for the program in question. I've been able to verify
that this version of
binutils has Nathan's patch for issue #2297 where this error message was
coming from the
linker. This had been working with a slightly older version of binutils.
The .data section was linked at 0x00400000, and I'm just trying to move
to just beyond
the test/rodata sections for an upcoming objcopy to make a flat binary
image.
Thanks for any help,
John
host is i386 linux, target is armeabi-elf.
objcopy --version:
GNU objcopy (CodeSourcery 2007q1-10. Marvell 2009q1-18 20090504)
2.18.50.20080215
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later
version.
This program has absolutely no warranty.
readelf -e output:
ELF Header:
Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, big endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0xffe00000
Start of program headers: 52 (bytes into file)
Start of section headers: 267700 (bytes into file)
Flags: 0x4800002, has entry point,
Version4 EABI, BE8
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 3
Size of section headers: 40 (bytes)
Number of section headers: 20
Section header string table index: 17
Section Headers:
[Nr] Name Type Addr Off Size ES Flg
Lk Inf Al
[ 0] NULL 00000000 000000 000000 00
0 0 0
[ 1] .data PROGBITS 00400000 008000 001144 00 WA
0 0 4
[ 2] .bss NOBITS 00401144 009144 056cfc 00 WA
0 0 4
[ 3] SECTDESC PROGBITS ffe00000 010000 000010 00 AX
0 0 1
[ 4] .text PROGBITS ffe00010 010010 00c030 00 AX
0 0 32
[ 5] .rodata PROGBITS ffe0c040 01c040 00153c 00 A
0 0 4
[ 6] .ARM.attributes ARM_ATTRIBUTES 00000000 01d57c 000037 00
0 0 1
[ 7] .debug_abbrev PROGBITS 00000000 01d5b3 003a6d 00
0 0 1
[ 8] .debug_info PROGBITS 00000000 021020 00cd57 00
0 0 1
[ 9] .debug_line PROGBITS 00000000 02dd77 0041f3 00
0 0 1
[10] .debug_frame PROGBITS 00000000 031f6c 001440 00
0 0 4
[11] .debug_loc PROGBITS 00000000 0333ac 0066d9 00
0 0 1
[12] .debug_pubnames PROGBITS 00000000 039a85 001e46 00
0 0 1
[13] .debug_aranges PROGBITS 00000000 03b8cb 000460 00
0 0 1
[14] .debug_ranges PROGBITS 00000000 03bd2b 0009e8 00
0 0 1
[15] .debug_str PROGBITS 00000000 03c713 003f8c 01 MS
0 0 1
[16] .comment PROGBITS 00000000 04069f 000e46 00
0 0 1
[17] .shstrtab STRTAB 00000000 0414e5 0000cc 00
0 0 1
[18] .symtab SYMTAB 00000000 0418d4 002bb0 10
19 463 4
[19] .strtab STRTAB 00000000 044484 0011b0 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x008000 0x00400000 0x00400000 0x01144 0x57e40 RW 0x8000
LOAD 0x010000 0xffe00000 0xffe00000 0x0d57c 0x0d57c R E 0x8000
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4
Section to Segment mapping:
Segment Sections...
00 .data .bss
01 SECTDESC .text .rodata
02
etext=0x`/m/btools/futures/next/builds/wip-7799/ix86-Linux-RHEL4/arm-marvell-linux-gnueabi-hardvfp/bin/arm-marvell-linux-gnueabi-objdump
--syms zkrnl/zkrnl.elf | grep
0000000 _etext" | cut -c1-8`; \
echo "Setting etext to "$etext;
/m/btools/futures/next/builds/wip-7799/ix86-Linux-RHEL4/arm-marvell-linux-gnueabi-hardvfp/bin/arm-marvell-linux-gnueabi-objcop
-change-section-address .data=$etext zkrnl/zkrnl.elf;
Setting etext to 0xffe0d57c
BFD: zkrnl/strXjLWY: section `.data' can't be allocated in segment 1
LOAD: .data
/m/btools/futures/next/builds/wip-7799/ix86-Linux-RHEL4/arm-marvell-linux-gnueabi-hardvfp/bin/arm-marvell-linux-gnueabi-objcopy:zkrnl/strXjLWY[.data]:
Bad value
BFD: zkrnl/strXjLWY: section `.data' can't be allocated in segment 1
LOAD: .data
/m/btools/futures/next/builds/wip-7799/ix86-Linux-RHEL4/arm-marvell-linux-gnueabi-hardvfp/bin/arm-marvell-linux-gnueabi-objcopy:zkrnl/strXjLWY:
Bad value