* ldgram.y: Add support for REGION_ALIAS operator.
[platform/upstream/binutils.git] / ld / testsuite / ld-scripts / memory.t
1 MEMORY
2 {
3   R_TEXTMEM (ARX) : ORIGIN = 0x100, LENGTH = 32K
4   R_DATAMEM (AW)  : org = 0x1000, l = (64 * 1024)
5 }
6
7 REGION_ALIAS ("A_TEXTMEM", R_TEXTMEM);
8 REGION_ALIAS ("A_DATAMEM", R_DATAMEM);
9
10 REGION_ALIAS ("TEXTMEM", A_TEXTMEM);
11 REGION_ALIAS ("DATAMEM", A_DATAMEM);
12
13 SECTIONS
14 {
15   . = 0;
16   .text :
17   {
18     /* The value returned by the ORIGIN operator is a constant.
19        However it is being assigned to a symbol declared within
20        a section.  Therefore the symbol is section-relative and
21        its value will include the offset of that section from
22        the start of memory.  ie the declaration:
23           text_start = ORIGIN (TEXTMEM);
24        here will result in text_start having a value of 0x200.
25        Hence we need to subtract the absolute value of the
26        location counter at this point in order to give text_start
27        a value that is truely absolute, and which coincidentally
28        will allow the tests in script.exp to work.  */
29         
30     text_start = ORIGIN(TEXTMEM) - ABSOLUTE (.);
31     *(.text)
32     *(.pr)
33     text_end = .;
34   } > TEXTMEM
35   
36   data_start = ORIGIN (DATAMEM);
37   .data :
38   {
39     *(.data)
40     *(.rw)
41     data_end = .;
42   } >DATAMEM
43
44   fred = ORIGIN(DATAMEM) + LENGTH(DATAMEM);  
45 }