Skip to content

Commit c3a198b

Browse files
dcpleungstephanosio
authored andcommitted
Add support to build for x86_64-zephyr-elf
This adds the necessary bits to build for x86_64-zephyr-elf with multilib support (m32 and m64), following the x86_64-*-linux* footsteps. Signed-off-by: Kumar Gala <kumar.gala@linaro.org> Signed-off-by: Daniel Leung <daniel.leung@intel.com> Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
1 parent 6bbae89 commit c3a198b

File tree

27 files changed

+171
-51
lines changed

27 files changed

+171
-51
lines changed

config/dfp.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;;
2121
[
2222
case $1 in
2323
powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
24+
x86_64-zephyr-* | \
2425
i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \
2526
i?86*-*-mingw* | x86_64*-*-mingw* | \
2627
i?86*-*-cygwin* | x86_64*-*-cygwin*)

gcc/acinclude.m4

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,18 @@ AC_DEFUN([gcc_GAS_FLAGS],
460460
dnl Override the default, which may be incompatible.
461461
gcc_cv_as_flags=--64
462462
;;
463+
i[[34567]]86-zephyr*)
464+
dnl Override the default, which may be incompatible.
465+
gcc_cv_as_flags=--32
466+
;;
467+
x86_64-zephyr-elfx32)
468+
dnl Override the default, which may be incompatible.
469+
gcc_cv_as_flags=--x32
470+
;;
471+
x86_64-zephyr*)
472+
dnl Override the default, which may be incompatible.
473+
gcc_cv_as_flags=--64
474+
;;
463475
powerpc*-*-darwin*)
464476
dnl Always pass -arch ppc to assembler.
465477
gcc_cv_as_flags="-arch ppc"

gcc/config.gcc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,11 @@ i[34567]86-*-elfiamcu)
18981898
i[34567]86-*-elf*)
18991899
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
19001900
;;
1901+
x86_64-zephyr-elf*)
1902+
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
1903+
tm_file="${tm_file} i386/zephyr64.h"
1904+
tmake_file="${tmake_file} i386/t-zephyr64"
1905+
;;
19011906
x86_64-*-elf*)
19021907
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
19031908
;;

gcc/config/i386/t-zephyr64

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
2+
#
3+
# This file is part of GCC.
4+
#
5+
# GCC is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 3, or (at your option)
8+
# any later version.
9+
#
10+
# GCC is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with GCC; see the file COPYING3. If not see
17+
# <http://www.gnu.org/licenses/>.
18+
19+
# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
20+
# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
21+
# /lib and /usr/lib, while other distributions install libraries into /lib64
22+
# and /usr/lib64. The LSB does not enforce the use of /lib64 and /usr/lib64,
23+
# it doesn't tell anything about the 32bit libraries on those systems. Set
24+
# MULTILIB_OSDIRNAMES according to what is found on the target.
25+
26+
# To support i386, x86-64 and x32 libraries, the directory structrue
27+
# should be:
28+
#
29+
# /lib has i386 libraries.
30+
# /lib64 has x86-64 libraries.
31+
# /libx32 has x32 libraries.
32+
#
33+
MULTILIB_OPTIONS = m64/m32 msoft-float
34+
MULTILIB_DIRNAMES = 64 32 soft-float
35+
MULTILIB_REQUIRED = m64 m32 m32/msoft-float
36+
MULTILIB_EXCEPTIONS = msoft-float
37+
MULTILIB_OSDIRNAMES = m64=!64 m32=!32 m32/msoft-float=!32/soft-float
38+
MULTILIB_MATCHES = msoft-float=mno-80387

gcc/config/i386/zephyr64.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* Definitions for x86-64 for Zephyr 64-bit toolchain.
2+
Copyright (C) 2001-2019 Free Software Foundation, Inc.
3+
Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h.
4+
Based on gnu-user64.h.
5+
6+
This file is part of GCC.
7+
8+
GCC is free software; you can redistribute it and/or modify
9+
it under the terms of the GNU General Public License as published by
10+
the Free Software Foundation; either version 3, or (at your option)
11+
any later version.
12+
13+
GCC is distributed in the hope that it will be useful,
14+
but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
GNU General Public License for more details.
17+
18+
Under Section 7 of GPL version 3, you are granted additional
19+
permissions described in the GCC Runtime Library Exception, version
20+
3.1, as published by the Free Software Foundation.
21+
22+
You should have received a copy of the GNU General Public License and
23+
a copy of the GCC Runtime Library Exception along with this program;
24+
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25+
<http://www.gnu.org/licenses/>. */
26+
27+
#undef ENDFILE_SPEC
28+
#define ENDFILE_SPEC "crtend.o%s"
29+
30+
#undef STARTFILE_SPEC
31+
#define STARTFILE_SPEC "crtbegin.o%s"
32+
33+
#undef LINK_SPEC
34+
#define LINK_SPEC \
35+
"%{m32:-m elf_i386} \
36+
%{m64:-m elf_x86_64} \
37+
%{mx32:-m elf32_x86_64}"
38+
39+
#define MULTILIB_DEFAULTS { "m64" }

gcc/configure

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7897,6 +7897,7 @@ else
78977897

78987898
case $target in
78997899
powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
7900+
x86_64*-zephyr-* | \
79007901
i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \
79017902
i?86*-*-mingw* | x86_64*-*-mingw* | \
79027903
i?86*-*-cygwin* | x86_64*-*-cygwin*)
@@ -15431,7 +15432,7 @@ ia64-*-hpux*)
1543115432
rm -rf conftest*
1543215433
;;
1543315434

15434-
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
15435+
x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
1543515436
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
1543615437
# Find out which ABI we are using.
1543715438
echo 'int i;' > conftest.$ac_ext
@@ -15446,7 +15447,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
1544615447
x86_64-*kfreebsd*-gnu)
1544715448
LD="${LD-ld} -m elf_i386_fbsd"
1544815449
;;
15449-
x86_64-*linux*)
15450+
x86_64-*linux*|x86_64-zephyr-*)
1545015451
case `/usr/bin/file conftest.o` in
1545115452
*x86-64*)
1545215453
LD="${LD-ld} -m elf32_x86_64"
@@ -15475,7 +15476,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
1547515476
x86_64-*kfreebsd*-gnu)
1547615477
LD="${LD-ld} -m elf_x86_64_fbsd"
1547715478
;;
15478-
x86_64-*linux*)
15479+
x86_64-*linux*|x86_64-zephyr-*)
1547915480
LD="${LD-ld} -m elf_x86_64"
1548015481
;;
1548115482
powerpcle-*linux*)
@@ -23724,6 +23725,15 @@ else
2372423725
x86_64-*-linux*)
2372523726
gcc_cv_as_flags=--64
2372623727
;;
23728+
i[34567]86-zephyr*)
23729+
gcc_cv_as_flags=--32
23730+
;;
23731+
x86_64-zephyr-elfx32)
23732+
gcc_cv_as_flags=--x32
23733+
;;
23734+
x86_64-zephyr*)
23735+
gcc_cv_as_flags=--64
23736+
;;
2372723737
powerpc*-*-darwin*)
2372823738
gcc_cv_as_flags="-arch ppc"
2372923739
;;

libatomic/configure

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6872,7 +6872,7 @@ ia64-*-hpux*)
68726872
rm -rf conftest*
68736873
;;
68746874

6875-
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
6875+
x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
68766876
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
68776877
# Find out which ABI we are using.
68786878
echo 'int i;' > conftest.$ac_ext
@@ -6887,7 +6887,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
68876887
x86_64-*kfreebsd*-gnu)
68886888
LD="${LD-ld} -m elf_i386_fbsd"
68896889
;;
6890-
x86_64-*linux*)
6890+
x86_64-*linux*|x86_64-zephyr-*)
68916891
case `/usr/bin/file conftest.o` in
68926892
*x86-64*)
68936893
LD="${LD-ld} -m elf32_x86_64"
@@ -6916,7 +6916,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
69166916
x86_64-*kfreebsd*-gnu)
69176917
LD="${LD-ld} -m elf_x86_64_fbsd"
69186918
;;
6919-
x86_64-*linux*)
6919+
x86_64-*linux*|x86_64-zephyr-*)
69206920
LD="${LD-ld} -m elf_x86_64"
69216921
;;
69226922
powerpcle-*linux*)

libbacktrace/configure

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7268,7 +7268,7 @@ ia64-*-hpux*)
72687268
rm -rf conftest*
72697269
;;
72707270
7271-
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
7271+
x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
72727272
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
72737273
# Find out which ABI we are using.
72747274
echo 'int i;' > conftest.$ac_ext
@@ -7283,7 +7283,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
72837283
x86_64-*kfreebsd*-gnu)
72847284
LD="${LD-ld} -m elf_i386_fbsd"
72857285
;;
7286-
x86_64-*linux*)
7286+
x86_64-*linux*|x86_64-zephyr-*)
72877287
case `/usr/bin/file conftest.o` in
72887288
*x86-64*)
72897289
LD="${LD-ld} -m elf32_x86_64"
@@ -7312,7 +7312,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
73127312
x86_64-*kfreebsd*-gnu)
73137313
LD="${LD-ld} -m elf_x86_64_fbsd"
73147314
;;
7315-
x86_64-*linux*)
7315+
x86_64-*linux*|x86_64-zephyr-*)
73167316
LD="${LD-ld} -m elf_x86_64"
73177317
;;
73187318
powerpcle-*linux*)

libcc1/configure

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6535,7 +6535,7 @@ ia64-*-hpux*)
65356535
rm -rf conftest*
65366536
;;
65376537

6538-
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
6538+
x86_64-*kfreebsd*-gnu|x86_64-*linux*|x86_64-zephyr-*|powerpc*-*linux*| \
65396539
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
65406540
# Find out which ABI we are using.
65416541
echo 'int i;' > conftest.$ac_ext
@@ -6550,7 +6550,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
65506550
x86_64-*kfreebsd*-gnu)
65516551
LD="${LD-ld} -m elf_i386_fbsd"
65526552
;;
6553-
x86_64-*linux*)
6553+
x86_64-*linux*|x86_64-zephyr-*)
65546554
case `/usr/bin/file conftest.o` in
65556555
*x86-64*)
65566556
LD="${LD-ld} -m elf32_x86_64"
@@ -6579,7 +6579,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
65796579
x86_64-*kfreebsd*-gnu)
65806580
LD="${LD-ld} -m elf_x86_64_fbsd"
65816581
;;
6582-
x86_64-*linux*)
6582+
x86_64-*linux*|x86_64-zephyr-*)
65836583
LD="${LD-ld} -m elf_x86_64"
65846584
;;
65856585
powerpcle-*linux*)

libdecnumber/configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4904,6 +4904,7 @@ else
49044904
49054905
case $target in
49064906
powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
4907+
x86_64-zephyr-* | \
49074908
i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \
49084909
i?86*-*-mingw* | x86_64*-*-mingw* | \
49094910
i?86*-*-cygwin* | x86_64*-*-cygwin*)

0 commit comments

Comments
 (0)