Oleg Verych wrote on 20/01/08 10:13 MET:
> @2008-01-19, Friedrich Lobenstock:
> []
>> Let us now put the puzzle together and change our program in the following
>> way when declaring the .vectors section:
>>   ; Interrupt Vector Table
>>   .section .vectors, "a"
>>
>> Note the added "Alloc" flag.
> 
> Is it possible to do with `objcopy`? I've used this for some flash section:
> 
> objcopy --set-section-flags .flashsection="alloc,code,readonly" -O elf32-avr 
> a.out out.elf
> 
> when i did AVR stuff.

Yes it is, thanks for the hint.

# readelf -S testprogram
There are 6 section headers, starting at offset 0xbc:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg  ~
  [ 0]                   NULL            00000000 000000 000000 00      ~
  [ 1] .text             PROGBITS        0000fc00 000054 00001c 00  AX  ~
  [ 2] .vectors          PROGBITS        0000ffe0 000070 000020 00      ~
  [ 3] .shstrtab         STRTAB          00000000 000090 00002a 00      ~
  [ 4] .symtab           SYMTAB          00000000 0001ac 000130 10      ~
  [ 5] .strtab           STRTAB          00000000 0002dc 000089 00      ~
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)


# msp430-objcopy --set-section-flags .vectors="alloc,readonly" testprogram
BFD: stXnFAhC: warning: allocated section `.vectors' not in segment


# readelf -S testprogram
There are 6 section headers, starting at offset 0xbc:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg  ~
  [ 0]                   NULL            00000000 000000 000000 00      ~
  [ 1] .text             PROGBITS        0000fc00 000054 00001c 00  AX  ~
  [ 2] .vectors          PROGBITS        0000ffe0 000070 000020 00   A  ~
  [ 3] .shstrtab         STRTAB          00000000 000090 00002a 00      ~
  [ 4] .symtab           SYMTAB          00000000 0001ac 000130 10      ~
  [ 5] .strtab           STRTAB          00000000 0002dc 000089 00      ~
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)


-- 
MfG / Regards
Friedrich Lobenstock

Reply via email to