Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / config / c6x / uclinux-elf.h
1 /* Definitions for TI C6X running ucLinux using ELF
2    Copyright (C) 2010-2013 Free Software Foundation, Inc.
3    Contributed by Andrew Jenner <andrew@codesourcery.com>
4    Contributed by Bernd Schmidt <bernds@codesourcery.com>
5
6    This file is part of GCC.
7
8    GCC is free software; you can redistribute it and/or modify it
9    under the terms of the GNU General Public License as published
10    by the Free Software Foundation; either version 3, or (at your
11    option) any later version.
12
13    GCC is distributed in the hope that it will be useful, but WITHOUT
14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16    License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with GCC; see the file COPYING3.  If not see
20    <http://www.gnu.org/licenses/>.  */
21
22 #undef TARGET_OS_CPP_BUILTINS
23 #define TARGET_OS_CPP_BUILTINS()                \
24   do                                            \
25     {                                           \
26       builtin_define ("__uClinux__");           \
27       builtin_define_std ("linux");             \
28       builtin_define_std ("unix");              \
29       builtin_assert ("system=linux");          \
30       builtin_assert ("system=unix");           \
31       builtin_assert ("system=posix");          \
32     }                                           \
33   while (false)
34
35 #undef  STARTFILE_SPEC
36 #define STARTFILE_SPEC \
37   "%{!shared:crt1%O%s} crti%O%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
38
39 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
40
41 #undef LINK_SPEC
42 #define LINK_SPEC ENDIAN_LINK_SPEC \
43   "%{shared} %{fpie|fPIE:-pie} \
44   %{!shared: %{!static: \
45    %{rdynamic:-export-dynamic} \
46    %{!dynamic-linker:-dynamic-linker " UCLIBC_DYNAMIC_LINKER "}} \
47    %{static}}"
48
49 #undef DRIVER_SELF_SPECS
50 #define DRIVER_SELF_SPECS "%{!mno-dsbt:-mdsbt}"
51
52 /* Clear the instruction cache from `beg' to `end'.  This makes an
53    inline system call to SYS_cacheflush.  */
54 #undef CLEAR_INSN_CACHE
55 #define CLEAR_INSN_CACHE(BEG, END)                                      \
56 {                                                                       \
57   register unsigned long _beg __asm ("A4") = (unsigned long) (BEG);     \
58   register unsigned long _end __asm ("B4") = (unsigned long) (END);     \
59   register unsigned long _scno __asm ("B0") = 244;                      \
60   __asm __volatile ("swe                ; sys_cache_sync"               \
61                     : "=a" (_beg)                                       \
62                     : "0" (_beg), "b" (_end), "b" (_scno));     \
63 }
64