gcc: introduce `--posixly` command line option to ease the compilation of POSIX software
This commit is contained in:
parent
e0420eb690
commit
545076c6df
|
@ -2,7 +2,7 @@ diff --git a/src/gcc/gcc/config.gcc b/src/gcc/gcc/config.gcc
|
||||||
index ddd3b8f..702aa59 100644
|
index ddd3b8f..702aa59 100644
|
||||||
--- a/src/gcc/gcc/config.gcc
|
--- a/src/gcc/gcc/config.gcc
|
||||||
+++ b/src/gcc/gcc/config.gcc
|
+++ b/src/gcc/gcc/config.gcc
|
||||||
@@ -947,6 +947,16 @@ case ${target} in
|
@@ -947,6 +947,18 @@ case ${target} in
|
||||||
tmake_file="$tmake_file vms/t-vmsnative"
|
tmake_file="$tmake_file vms/t-vmsnative"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -10,6 +10,7 @@ index ddd3b8f..702aa59 100644
|
||||||
+ gas=yes
|
+ gas=yes
|
||||||
+ gnu_ld=yes
|
+ gnu_ld=yes
|
||||||
+ default_use_cxa_atexit=yes
|
+ default_use_cxa_atexit=yes
|
||||||
|
+ extra_options="$extra_options jehanne.opt"
|
||||||
+ case $target in
|
+ case $target in
|
||||||
+ x86_64-*)
|
+ x86_64-*)
|
||||||
+ native_system_header_dir="/arch/amd64/include"
|
+ native_system_header_dir="/arch/amd64/include"
|
||||||
|
@ -19,7 +20,7 @@ index ddd3b8f..702aa59 100644
|
||||||
*-*-vxworks*)
|
*-*-vxworks*)
|
||||||
tmake_file=t-vxworks
|
tmake_file=t-vxworks
|
||||||
xm_defines=POSIX
|
xm_defines=POSIX
|
||||||
@@ -1635,6 +1647,9 @@ i[34567]86-*-elfiamcu)
|
@@ -1635,6 +1648,9 @@ i[34567]86-*-elfiamcu)
|
||||||
i[34567]86-*-elf*)
|
i[34567]86-*-elf*)
|
||||||
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
|
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -18,16 +18,30 @@
|
||||||
|
|
||||||
#undef TARGET_JEHANNE
|
#undef TARGET_JEHANNE
|
||||||
#define TARGET_JEHANNE 1
|
#define TARGET_JEHANNE 1
|
||||||
|
/*
|
||||||
|
#undef DRIVER_SELF_SPECS
|
||||||
|
#define DRIVER_SELF_SPECS "%{-posixly}"
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* GCC on Jehanne includes and link libraries from /sys and /arch.
|
||||||
|
* To ease the port of POSIX applications, we include a --posixly option
|
||||||
|
* to the GCC driver that will be substituted with proper options
|
||||||
|
*/
|
||||||
|
#undef CPP_SPEC
|
||||||
|
#define CPP_SPEC "%{-posixly:-isystem/posix/include}"
|
||||||
|
|
||||||
|
#undef LINK_SPEC
|
||||||
|
#define LINK_SPEC "%{-posixly:-L/posix/lib}"
|
||||||
|
|
||||||
/* Default arguments you want when running x86_64-jehanne-gcc */
|
|
||||||
#undef LIB_SPEC
|
#undef LIB_SPEC
|
||||||
#define LIB_SPEC "-ljehanne"
|
#define LIB_SPEC "%{-posixly:%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}} -ljehanne"
|
||||||
|
|
||||||
|
|
||||||
#undef STANDARD_STARTFILE_PREFIX
|
#undef STANDARD_STARTFILE_PREFIX
|
||||||
#define STANDARD_STARTFILE_PREFIX "/arch/amd64/lib/"
|
#define STANDARD_STARTFILE_PREFIX "/arch/amd64/lib/"
|
||||||
|
|
||||||
#undef MD_STARTFILE_PREFIX
|
/* GCC include paths definition START
|
||||||
#define MD_STARTFILE_PREFIX "/arch/amd64/lib/"
|
*/
|
||||||
|
|
||||||
/* Architecture specific header (u.h) goes here (from config.gcc) */
|
/* Architecture specific header (u.h) goes here (from config.gcc) */
|
||||||
#define ARCH_INCLUDE_DIR NATIVE_SYSTEM_HEADER_DIR
|
#define ARCH_INCLUDE_DIR NATIVE_SYSTEM_HEADER_DIR
|
||||||
|
@ -35,14 +49,65 @@
|
||||||
/* The default include dir is /sys/include */
|
/* The default include dir is /sys/include */
|
||||||
#define PORTABLE_INCLUDE_DIR "/sys/include"
|
#define PORTABLE_INCLUDE_DIR "/sys/include"
|
||||||
|
|
||||||
|
#ifdef GPLUSPLUS_INCLUDE_DIR
|
||||||
|
/* Pick up GNU C++ generic include files. */
|
||||||
|
# define ID_GPLUSPLUS { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
|
||||||
|
#else
|
||||||
|
# define ID_GPLUSPLUS
|
||||||
|
#endif
|
||||||
|
#ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
|
||||||
|
/* Pick up GNU C++ target-dependent include files. */
|
||||||
|
# define ID_GPLUSPLUS_TOOL { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
|
||||||
|
#else
|
||||||
|
# define ID_GPLUSPLUS_TOOL
|
||||||
|
#endif
|
||||||
|
#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
|
||||||
|
/* Pick up GNU C++ backward and deprecated include files. */
|
||||||
|
# define ID_GPLUSPLUS_BACKWARD { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
|
||||||
|
#else
|
||||||
|
# define ID_GPLUSPLUS_BACKWARD
|
||||||
|
#endif
|
||||||
|
#ifdef GCC_INCLUDE_DIR
|
||||||
|
/* This is the dir for gcc's private headers. */
|
||||||
|
# define ID_GCC { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
|
||||||
|
#else
|
||||||
|
# define ID_GCC
|
||||||
|
#endif
|
||||||
|
#ifdef PREFIX_INCLUDE_DIR
|
||||||
|
# define ID_PREFIX { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
|
||||||
|
#else
|
||||||
|
# define ID_PREFIX
|
||||||
|
#endif
|
||||||
|
#if defined (CROSS_INCLUDE_DIR) && defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
|
||||||
|
# define ID_CROSS { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
|
||||||
|
#else
|
||||||
|
# define ID_CROSS
|
||||||
|
#endif
|
||||||
|
#ifdef TOOL_INCLUDE_DIR
|
||||||
|
/* Another place the target system's headers might be. */
|
||||||
|
# define ID_TOOL { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
|
||||||
|
#else
|
||||||
|
# define ID_TOOL
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef INCLUDE_DEFAULTS
|
#undef INCLUDE_DEFAULTS
|
||||||
#define INCLUDE_DEFAULTS \
|
#define INCLUDE_DEFAULTS \
|
||||||
{ \
|
{ \
|
||||||
|
ID_GPLUSPLUS \
|
||||||
|
ID_GPLUSPLUS_TOOL \
|
||||||
|
ID_GPLUSPLUS_BACKWARD \
|
||||||
|
ID_GCC \
|
||||||
|
ID_PREFIX \
|
||||||
|
ID_CROSS \
|
||||||
|
ID_TOOL \
|
||||||
{ PORTABLE_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
|
{ PORTABLE_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
|
||||||
{ ARCH_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
|
{ ARCH_INCLUDE_DIR, 0, 0, 0, 1, 0 }, \
|
||||||
{ 0, 0, 0, 0, 0, 0 } \
|
{ 0, 0, 0, 0, 0, 0 } \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* GCC include paths definition END
|
||||||
|
*/
|
||||||
|
|
||||||
/* Files that are linked before user code.
|
/* Files that are linked before user code.
|
||||||
The %s tells gcc to look for these files in the library directory. */
|
The %s tells gcc to look for these files in the library directory. */
|
||||||
#undef STARTFILE_SPEC
|
#undef STARTFILE_SPEC
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
; Jehanne options.
|
||||||
|
|
||||||
|
; This file is part of Jehanne.
|
||||||
|
;
|
||||||
|
; Copyright (C) 2016-2020 Giacomo Tesio <giacomo@tesio.it>
|
||||||
|
;
|
||||||
|
; Jehanne is free software: you can redistribute it and/or modify
|
||||||
|
; it under the terms of the GNU General Public License as published by
|
||||||
|
; the Free Software Foundation, version 2 of the License.
|
||||||
|
;
|
||||||
|
; Jehanne is distributed in the hope that it will be useful,
|
||||||
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
; GNU General Public License for more details.
|
||||||
|
;
|
||||||
|
; You should have received a copy of the GNU General Public License
|
||||||
|
; along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
; Please try to keep this file in ASCII collating order.
|
||||||
|
|
||||||
|
-posixly
|
||||||
|
C ObjC C++ ObjC++ Driver RejectNegative
|
||||||
|
Lookup for POSIX includes and libraries in /posix
|
||||||
|
|
||||||
|
; This comment is to ensure we retain the blank line above.
|
Loading…
Reference in New Issue