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]

modification section attributes in .elf


Hi,

We have defined a section called .boot_identifier in our .elf file
that contains some boot information. Using objdump, we get the
following.

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .boot_identifier 00000018  00000000  00000000  00005bc8  2**0
                  CONTENTS, READONLY
  1 .text         00005608  40000000  40000000  00000074  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .rodata       00000454  40005608  40005608  0000567c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .data         000000f8  40007000  40005a5c  00005ad0  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  4 .bss          00001bfc  400070f8  40005b54  00005bc8  2**2
                  ALLOC
  5 .sbss         0000001c  40008cf4  40007750  00005bc8  2**2
                  ALLOC

As the .boot_identifier section does have the correct attributes, it
doesn't get loaded nor is it able to objcopy out to a binary file
either. I believe the "standard" way is to use objcopy modify the
section attribute as in

tchin@xxxxqueen3:~/src$ powerpc-linux-objcopy --set-section-flags
.boot_identifier=contents,readonly,alloc,data,load FINAL.elf
FINAL_mod.elf
BFD: FINAL_mod.elf: warning: allocated section `.boot_identifier' not in segment
tchin@xxxxqueen3:~/src$ powerpc-linux-objdump -h FINAL_mod.elf

FINAL_mod.elf:     file format elf32-powerpc

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .boot_identifier 00000018  00000000  00000000  00005bc8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .text         00005608  40000000  40000000  00000074  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .rodata       00000454  40005608  40005608  0000567c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .data         000000f8  40007000  40005a5c  00005ad0  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  4 .bss          00001bfc  400070f8  40005b54  00005bc8  2**2
                  ALLOC
  5 .sbss         0000001c  40008cf4  40007750  00005bc8  2**2
                  ALLOC

Now that .boot_identifier has the correct attributes, .boot_identifier
gets loaded into the target and is able to be objcopy into a binary
file.

Is there another way of changing the section attribute either via gcc,
gas or ld so that I don't have modify the attribute using objcopy?

Many thanks,


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