Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 1 | /* linker-tool-gcc.h - GCC toolchain linker defs */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 2013-2014, Wind River Systems, Inc. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are met: |
| 8 | * |
| 9 | * 1) Redistributions of source code must retain the above copyright notice, |
| 10 | * this list of conditions and the following disclaimer. |
| 11 | * |
| 12 | * 2) Redistributions in binary form must reproduce the above copyright notice, |
| 13 | * this list of conditions and the following disclaimer in the documentation |
| 14 | * and/or other materials provided with the distribution. |
| 15 | * |
| 16 | * 3) Neither the name of Wind River Systems nor the names of its contributors |
| 17 | * may be used to endorse or promote products derived from this software without |
| 18 | * specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | */ |
| 32 | |
| 33 | /* |
| 34 | DESCRIPTION |
| 35 | This header file defines the necessary macros used by the linker script for |
| 36 | use with the GCC linker. |
| 37 | */ |
| 38 | |
| 39 | #ifndef __LINKER_TOOL_GCC_H |
| 40 | #define __LINKER_TOOL_GCC_H |
| 41 | |
| 42 | #if defined(CONFIG_CPU_CORTEXM) |
| 43 | OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 44 | #elif defined(CONFIG_ARC) |
| 45 | OUTPUT_FORMAT("elf32-littlearc", "elf32-bigarc", "elf32-littlearc") |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 46 | #else |
| 47 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") |
| 48 | OUTPUT_ARCH(i386) |
Inaky Perez-Gonzalez | 8ddf82c | 2015-04-10 16:44:37 -0700 | [diff] [blame] | 49 | #endif |
| 50 | |
| 51 | /* |
| 52 | * The GROUP_START() and GROUP_END() macros are used to define a group |
| 53 | * of sections located in one memory area, such as RAM, ROM, etc. |
| 54 | * The <where> parameter is the name of the memory area. |
| 55 | */ |
| 56 | #define GROUP_START(where) |
| 57 | #define GROUP_END(where) |
| 58 | |
| 59 | /* |
| 60 | * The GROUP_LINK_IN() macro is located at the end of the section |
| 61 | * description and tells the linker that this section is located in |
| 62 | * the memory area specified by <where> argument. |
| 63 | */ |
| 64 | #define GROUP_LINK_IN(where) > where |
| 65 | |
| 66 | /* |
| 67 | * The GROUP_FOLLOWS_AT() macro is located at the end of the section |
| 68 | * and indicates that the section does not specify an address at which |
| 69 | * it is to be loaded, but that it follows a section which did specify |
| 70 | * such an address |
| 71 | */ |
| 72 | #define GROUP_FOLLOWS_AT(where) AT > where |
| 73 | |
| 74 | /* |
| 75 | * The SECTION_PROLOGUE() macro is used to define the beginning of a section. |
| 76 | * The <name> parameter is the name of the section, and the <option> parameter |
| 77 | * is to include any special options such as (NOLOAD). Page alignment has its |
| 78 | * own parameter since it needs abstraction across the different toolchains. |
| 79 | * If not required, the <options> and <align> parameters should be left blank. |
| 80 | */ |
| 81 | |
| 82 | #define SECTION_PROLOGUE(name, options, align) name options : align |
| 83 | |
| 84 | /* |
| 85 | * The SECTION_AT_PROLOGUE() macro is similar to SECTION_PROLOGUE() except |
| 86 | * that, in addition, the address at which the section is to be loaded is |
| 87 | * specified. |
| 88 | */ |
| 89 | |
| 90 | #define SECTION_AT_PROLOGUE(name, options, align, addr) \ |
| 91 | name options : align AT(addr) |
| 92 | |
| 93 | /* Diab-isms */ |
| 94 | #define SORT_BY_NAME(x) SORT(x) |
| 95 | #define OPTIONAL |
| 96 | |
| 97 | /* see linker-tool-diab.h for description */ |
| 98 | #define PGALIGN_ALIGN(x) ALIGN(x) |
| 99 | |
| 100 | #define COMMON_SYMBOLS *(COMMON) |
| 101 | |
| 102 | #endif /* !__LINKER_TOOL_GCC_H */ |