blob: 609cedc355217c1714457b82a3319c757a39dc6a [file] [log] [blame]
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -07001/*
2 * Copyright (c) 2013-2014, Wind River Systems, Inc.
3 *
Javier B Perez Hernandezf7fffae2015-10-06 11:00:37 -05004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -07007 *
Javier B Perez Hernandezf7fffae2015-10-06 11:00:37 -05008 * http://www.apache.org/licenses/LICENSE-2.0
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -07009 *
Javier B Perez Hernandezf7fffae2015-10-06 11:00:37 -050010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -070015 */
16
Anas Nashif275ca602015-12-04 10:09:39 -050017/**
18 * @file
19 * @brief GCC toolchain linker defs
20 *
Dan Kalowskyda67b292015-10-20 09:42:33 -070021 * This header file defines the necessary macros used by the linker script for
22 * use with the GCC linker.
Anas Nashifea0d0b22015-07-01 17:22:39 -040023 */
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -070024
25#ifndef __LINKER_TOOL_GCC_H
26#define __LINKER_TOOL_GCC_H
27
Peter Mitsis25fd37d2015-06-17 11:16:57 -040028#if defined(CONFIG_CPU_CORTEX_M)
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -070029OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -070030#elif defined(CONFIG_ARC)
31OUTPUT_FORMAT("elf32-littlearc", "elf32-bigarc", "elf32-littlearc")
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -070032#else
Anas Nashif9aeb0822015-06-19 23:37:23 -040033#if defined(__IAMCU)
34OUTPUT_FORMAT("elf32-iamcu")
35OUTPUT_ARCH(iamcu:intel)
36#else
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -070037OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
38OUTPUT_ARCH(i386)
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -070039#endif
Anas Nashif9aeb0822015-06-19 23:37:23 -040040#endif
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -070041
42/*
43 * The GROUP_START() and GROUP_END() macros are used to define a group
44 * of sections located in one memory area, such as RAM, ROM, etc.
45 * The <where> parameter is the name of the memory area.
46 */
47#define GROUP_START(where)
48#define GROUP_END(where)
49
50/*
51 * The GROUP_LINK_IN() macro is located at the end of the section
52 * description and tells the linker that this section is located in
53 * the memory area specified by <where> argument.
54 */
55#define GROUP_LINK_IN(where) > where
56
57/*
58 * The GROUP_FOLLOWS_AT() macro is located at the end of the section
59 * and indicates that the section does not specify an address at which
60 * it is to be loaded, but that it follows a section which did specify
61 * such an address
62 */
63#define GROUP_FOLLOWS_AT(where) AT > where
64
65/*
66 * The SECTION_PROLOGUE() macro is used to define the beginning of a section.
67 * The <name> parameter is the name of the section, and the <option> parameter
68 * is to include any special options such as (NOLOAD). Page alignment has its
69 * own parameter since it needs abstraction across the different toolchains.
70 * If not required, the <options> and <align> parameters should be left blank.
71 */
72
73#define SECTION_PROLOGUE(name, options, align) name options : align
74
75/*
76 * The SECTION_AT_PROLOGUE() macro is similar to SECTION_PROLOGUE() except
77 * that, in addition, the address at which the section is to be loaded is
78 * specified.
79 */
80
81#define SECTION_AT_PROLOGUE(name, options, align, addr) \
82 name options : align AT(addr)
83
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -070084#define SORT_BY_NAME(x) SORT(x)
85#define OPTIONAL
86
Inaky Perez-Gonzalez8ddf82c2015-04-10 16:44:37 -070087#define COMMON_SYMBOLS *(COMMON)
88
89#endif /* !__LINKER_TOOL_GCC_H */