Hello,

there seems to be still a problem with 'pragma Linker_Section':

package test is
   eeprom : constant String := "12345678901234567"; -- 17 byte
   pragma Linker_Section (Entity  => eeprom,
                          Section => ".eeprom");


   type Eeprom_String is new String;
   pragma Linker_Section (Entity  => Eeprom_String,
                          Section => ".eeprom");

   Data_1 : constant Eeprom_String := "12345678901234567"; -- 17 byte


   Data_2 : constant String := "1234567890123456"; -- 16 byte
   pragma Linker_Section (Entity  => Data_2,
                          Section => ".eeprom");
end;

$ gcc -c test.ads

$ readelf -a test.o
[..]

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 000034 000000 00  AX  0   0  4
  [ 2] .data             PROGBITS        00000000 000034 000022 00  WA  0   0  4
  [ 3] .bss              NOBITS          00000000 000058 000000 00  WA  0   0  4
  [ 4] .eeprom           PROGBITS        00000000 000058 000011 00  WA  0   0  1
[..]

Symbol table '.symtab' contains 12 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
[..]
     9: 00000000    17 OBJECT  GLOBAL DEFAULT    4 test__eeprom
    10: 00000001    17 OBJECT  GLOBAL DEFAULT    2 test__data_1
    11: 00000012    16 OBJECT  GLOBAL DEFAULT    2 test__data_2



The problems I can see are:

1. The minimum usable length is 17 byte!
2. gcc ignors 'pragma Linker_Section' for types.



gcc version 4.0.0 20041123 (experimental)

-- 
           Summary: pragma Linker_Section problems
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: berndtrog at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-gnu-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18680

Reply via email to