Skip to content

Commit ce8f8c9

Browse files
tejlmandnashif
authored andcommitted
armclang: adding toolchain/armclang.h header
The armclang.h includes the toolchain/llvm.h header. Also it redifines the __GENERIC_SECTION and Z_GENERIC_SECTION so that they includes the `used` attribute which is needed by armlink. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 761eada commit ce8f8c9

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

include/toolchain.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#include <toolchain/xcc.h>
4343
#elif defined(__CCAC__)
4444
#include <toolchain/mwdt.h>
45+
#elif defined(__ARMCOMPILER_VERSION)
46+
#include <toolchain/armclang.h>
4547
#elif defined(__llvm__)
4648
#include <toolchain/llvm.h>
4749
#elif defined(__GNUC__) || (defined(_LINKER) && defined(__GCC_LINKER_CMD__))

include/toolchain/armclang.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_ARMCLANG_H_
8+
#define ZEPHYR_INCLUDE_TOOLCHAIN_ARMCLANG_H_
9+
10+
11+
#include <toolchain/llvm.h>
12+
13+
/*
14+
* To reuse as much as possible from the llvm.h header we only redefine the
15+
* __GENERIC_SECTION and Z_GENERIC_SECTION macros here to include the `used` keyword.
16+
*/
17+
#undef __GENERIC_SECTION
18+
#undef Z_GENERIC_SECTION
19+
20+
#define __GENERIC_SECTION(segment) __attribute__((section(STRINGIFY(segment)), used))
21+
#define Z_GENERIC_SECTION(segment) __GENERIC_SECTION(segment)
22+
23+
#endif /* ZEPHYR_INCLUDE_TOOLCHAIN_ARMCLANG_H_ */

0 commit comments

Comments
 (0)