summaryrefslogtreecommitdiff
path: root/core/nds32/config_core.h
blob: d7a25d27da75965c38a55689ddd02acec2c69033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __CONFIG_CORE_H
#define __CONFIG_CORE_H

/* Linker binary architecture and format */
#define BFD_ARCH nds32
#define BFD_FORMAT "elf32-nds32le"


/*
 * Force the compiler to use a proper relocation when accessing an external
 * variable in a read-only section.
 * TODO(crosbug.com/p/24378): remove me when the nds32 toolchain bug is fixed.
 */
#undef RO
#define RO(var) \
({								\
	typeof(var) *__ptr_val;					\
	asm volatile("la %0, " #var "\n" : "=r"(__ptr_val));	\
	((typeof(var))(*__ptr_val));				\
})

#endif /* __CONFIG_CORE_H */