zephyr/include/toolchain/common.h
Peter Mitsis c2929b4f38 toolchain/arch: Remove section garbage collection ifdef guards
Section garbage collection is to be always enabled.

Note that this does not have any impact on performance measurements of any
existing sample project as they all use the default section garbage collection
value (enabled).

Change-Id: I57baa55dd52d45b633d8ca319e799ef483a5246b
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:13:48 -05:00

128 lines
3.8 KiB
C

/* toolchain/common.h - common toolchain abstraction */
/*
* Copyright (c) 2010-2014 Wind River Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3) Neither the name of Wind River Systems nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
DESCRIPTION
Macros to abstract compiler capabilities (common to all toolchains).
\NOMANUAL
*/
/*
* Generate a reference to an external symbol.
* The reference indicates to the linker that the symbol is required
* by the module containing the reference and should be included
* in the image if the module is in the image.
*
* The assembler directive ".set" is used to define a local symbol.
* No memory is allocated, and the local symbol does not appear in
* the symbol table.
*/
#ifdef _ASMLANGUAGE
#define REQUIRES(sym) .set sym ## _Requires, sym
#else
#define REQUIRES(sym) __asm__ (".set " # sym "_Requires, " # sym "\n\t");
#endif
#ifdef _ASMLANGUAGE
#define SECTION .section
#endif
/*
* The following definitions are used for symbol name compatibility.
*
* When #if 1, sources are assembled assuming the compiler
* you are using does not generate global symbols prefixed by "_".
* (e.g. elf/dwarf)
*
* When #if 0, sources are assembled assuming the compiler
* you are using generates global symbols prefixed by "_".
* (e.g. coff/stabs)
*/
#ifdef _ASMLANGUAGE
#ifndef TOOL_PREPENDS_UNDERSCORE
#define FUNC(sym) sym
#else
#define FUNC(sym) _##sym
#endif
#endif
/*
* If the project is being built for speed (i.e. not for minimum size) then
* align functions and branches in executable sections to improve performance.
*/
#ifdef _ASMLANGUAGE
#ifdef VXMICRO_ARCH_x86
#ifdef PERF_OPT
#define PERFOPT_ALIGN .balign 16
#else
#define PERFOPT_ALIGN .balign 1
#endif
#elif defined(VXMICRO_ARCH_arm)
#ifdef CONFIG_ISA_THUMB
#define PERFOPT_ALIGN .balign 2
#else
#define PERFOPT_ALIGN .balign 4
#endif
#elif defined(VXMICRO_ARCH_arc)
#define PERFOPT_ALIGN .balign 4
#endif
#define GC_SECTION(sym) SECTION .text.FUNC(sym), "ax"
#define BRANCH_LABEL(sym) FUNC(sym):
#define VAR(sym) FUNC(sym)
#endif /* _ASMLANGUAGE */
/* force inlining a function */
#if !defined(_ASMLANGUAGE)
#define ALWAYS_INLINE inline __attribute__((always_inline))
#endif
#ifdef CONFIG_UNALIGNED_WRITE_UNSUPPORTED
extern void _Unaligned32Write (unsigned int *ptr, unsigned int val);
extern unsigned _Unaligned32Read (unsigned int *ptr);
#endif /* CONFIG_UNALIGNED_WRITE_UNSUPPORTED */