Re: [PATCH] Fix DJGPP LTO with debug

2018-07-31 Thread Andris Pavenis

On 07/31/2018 04:04 PM, Richard Biener wrote:

On Sat, 28 Jul 2018, Andris Pavenis wrote:


On 07/27/2018 11:51 PM, DJ Delorie wrote:

Richard Biener  writes:

DJ, did you ever run the testsuite with a configuration that has LTO
enabled?  I don't see any djgpp results posted to gcc-testresults.
Quick googling doesn't yield anything useful with regarding on how to
do actual testing with a cross so I only built a i686-pc-msdosdjgpp
cross cc1/lto1 from x86_64-linux which went fine.

CC's Andris, our current gcc maintainer within DJGPP.  I know he just
built 8.2 binaries for us, I don't know what his testing infrastructure
looks like.


No.

II tried to run part of tests from custom scripts (eg. when trying to
implement DJGPP support for libstdc++fs, not yet submitted to upstream) with
native compiler for DJGPP.

Otherwise no DejaGNU support for DJGPP. So no way to run testsuite with native
compiler.

I should perhaps try to find some way to try to run testsuite using
cross-compiler from Linux. Possibilities:
- trying to execute test programs under DosEmu (no more possible with linux
kernels 4.15+ as DosEmu do not support DPMI for them)
- trying to execute test programs under Dosbox. Question: how to configure
testsuiite to do that? I do not know
- trying to run them through ssh on some Windows 32 bit system (older than
Windows 10 as DPMI support is rather horribly broken in Windows 10 32 bit
since March 2018)

So what about the patch?  Is it OK for trunk and GCC 8 branch?


It is OK for both (actually tested with gcc-8.2.0).

I comments about patch together with results of performed tests can be found in 
Bugzilla

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86651

Andris



Re: [PATCH] Fix DJGPP LTO with debug

2018-07-28 Thread Andris Pavenis

On 07/27/2018 11:51 PM, DJ Delorie wrote:

Richard Biener  writes:

DJ, did you ever run the testsuite with a configuration that has LTO
enabled?  I don't see any djgpp results posted to gcc-testresults.
Quick googling doesn't yield anything useful with regarding on how to
do actual testing with a cross so I only built a i686-pc-msdosdjgpp
cross cc1/lto1 from x86_64-linux which went fine.

CC's Andris, our current gcc maintainer within DJGPP.  I know he just
built 8.2 binaries for us, I don't know what his testing infrastructure
looks like.



No.

II tried to run part of tests from custom scripts (eg. when trying to implement DJGPP support for 
libstdc++fs, not yet submitted to upstream) with native compiler for DJGPP.


Otherwise no DejaGNU support for DJGPP. So no way to run testsuite with native 
compiler.

I should perhaps try to find some way to try to run testsuite using cross-compiler from Linux. 
Possibilities:
- trying to execute test programs under DosEmu (no more possible with linux kernels 4.15+ as DosEmu 
do not support DPMI for them)
- trying to execute test programs under Dosbox. Question: how to configure testsuiite to do that? I 
do not know
- trying to run them through ssh on some Windows 32 bit system (older than Windows 10 as DPMI 
support is rather horribly broken in Windows 10 32 bit since March 2018)


Andris


Re: [libstdc++-v3] Add configure check for S_ISSOCK

2017-11-07 Thread Andris Pavenis

On 11/07/2017 08:28 PM, Jonathan Wakely wrote:

On 07/11/17 19:26 +0200, Andris Pavenis wrote:

src/filesystem/ops-common.c uses S_ISSOCK unconditionally without checking that 
it is available

As result compile fails for DJGPP when S_ISREG is available but S_ISSOCK is not. Included patch 
add configure check for S_ISSOCK


Andris

ChangeLog entry:

2017-11-07  Andris Pavenis

    * acinclude.m4 (GLIBCXX_CHECK_S_ISSOCK): Define
    * configure.ac: Check presence of S_ISSOCK
    * src/filesystem/ops-common.h: Only use S_ISSOCK if defined for target
    * config.h.in: Regenerate
    * configure: Regenerate


Do we need an autoconf check?



I just followed the same style as with S_ISREG/S_IFREG...

Simple #ifdef S_ISSOCK is sufficient in this case.

Andris



[libstdc++-v3] Add configure check for S_ISSOCK

2017-11-07 Thread Andris Pavenis

src/filesystem/ops-common.c uses S_ISSOCK unconditionally without checking that 
it is available

As result compile fails for DJGPP when S_ISREG is available but S_ISSOCK is not. Included patch add 
configure check for S_ISSOCK


Andris

ChangeLog entry:

2017-11-07  Andris Pavenis

    * acinclude.m4 (GLIBCXX_CHECK_S_ISSOCK): Define
    * configure.ac: Check presence of S_ISSOCK
    * src/filesystem/ops-common.h: Only use S_ISSOCK if defined for target
    * config.h.in: Regenerate
    * configure: Regenerate




>From 5ab88b80a8cbbf4eee324510e5fae6fc6a9a1627 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sun, 29 Oct 2017 13:08:24 +0200
Subject: [PATCH] 2017-11-07  Andris Pavenis

	* acinclude.m4 (GLIBCXX_CHECK_S_ISSOCK): Define
	* configure.ac: Check presence of S_ISSOCK
	* src/filesystem/ops-common.h: Only use S_ISSOCK if defined for target
	* config.h.in: Regenerate
	* configure: Regenerate
---
 libstdc++-v3/acinclude.m4| 32 
 libstdc++-v3/config.h.in |  3 ++
 libstdc++-v3/configure   | 84 
 libstdc++-v3/configure.ac|  1 +
 libstdc++-v3/src/filesystem/ops-common.h |  2 +
 5 files changed, 122 insertions(+)

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 599308f587a..71db7cff283 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -410,6 +410,38 @@ AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [
   AC_LANG_RESTORE
 ])
 
+dnl
+dnl Check whether S_ISSOCK (Posix) is available in .
+dnl Define HAVE_S_ISSOCK appropriately.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_S_ISSOCK], [
+
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+  AC_MSG_CHECKING([for S_ISSOCK])
+  AC_CACHE_VAL(glibcxx_cv_S_ISSOCK, [
+GCC_TRY_COMPILE_OR_LINK(
+  [#include ],
+  [struct stat buffer;
+   fstat(0, );
+   S_ISSOCK(buffer.st_mode);],
+  [glibcxx_cv_S_ISSOCK=yes],
+  [glibcxx_cv_S_ISSOCK=no])
+  ])
+  res=no
+  if test $glibcxx_cv_S_ISSOCK = yes; then
+AC_DEFINE(HAVE_S_ISSOCK, 1,
+	  [Define if S_ISSOCK is available in .])
+res=S_ISSOCK
+  fi
+  AC_MSG_RESULT($res)
+
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+])
 
 dnl
 dnl Check whether poll is available in , and define HAVE_POLL.
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index e31e054c024..d2d9bfcf854 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -460,6 +460,9 @@
 /* Define if S_ISREG is available in . */
 #undef HAVE_S_ISREG
 
+/* Define if S_ISSOCK is available in . */
+#undef HAVE_S_ISSOCK
+
 /* Define to 1 if you have the `tanf' function. */
 #undef HAVE_TANF
 
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 836a6d5a8f1..73b61213ed7 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -19606,6 +19606,90 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
+
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for S_ISSOCK" >&5
+$as_echo_n "checking for S_ISSOCK... " >&6; }
+  if test "${glibcxx_cv_S_ISSOCK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+if test x$gcc_no_link = xyes; then
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include 
+int
+main ()
+{
+struct stat buffer;
+   fstat(0, );
+   S_ISSOCK(buffer.st_mode);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  glibcxx_cv_S_ISSOCK=yes
+else
+  glibcxx_cv_S_ISSOCK=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include 
+int
+main ()
+{
+struct stat buffer;
+   fstat(0, );
+   S_ISSOCK(buffer.st_mode);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  glibcxx_cv_S_ISSOCK=yes
+else
+  glibcxx_cv_S_ISSOCK=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+conftest$ac_exeext conftest.$ac_ext
+fi
+
+fi
+
+  res=no
+  if test $glibcxx_cv_S_ISSOCK = yes; then
+
+$as_echo "#define HAVE_S_ISSOCK 1" >>confdefs.h
+
+res=S_ISSOCK
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $res" >&5
+$as_echo "$res" >&6; }
+
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  ac_ext=c
+ac_cpp='

Re: [PATCH] Introduce --with-gcc-major-version-only configure option

2017-01-18 Thread Andris Pavenis

Just one suggestion:

What about configure option like --with-version-convert where one could specify 
actual conversion?

I have used conversion sed -e 's:\.::2g' for DJGPP to leave only the first dot in version for 
complying with MS-DOS file name restrictions. The implementation of that was not in shape I could 
submit. This implementation (for --with-gcc-major-version-only) is better. Adding a possibility to 
to specify something like --with-version-convert='sed -e s:\.::2g' would be easy now.


One can of course also simply use --with-gcc-major-version-only for native DJGPP builds (also that 
would remove need of part of DJGPP related changes not submitted to upstream and which did not work 
always nicely for example for cross-native build from Linux)


Andris




Re: [PING][PATCH 3/4][Ada,DJGPP] Ada support for DJGPP

2016-10-11 Thread Andris Pavenis

On 10/11/2016 11:46 AM, Arnaud Charlet wrote:

I'd like to ping patch

https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00164.html

Additional comments about using ZCX_By_Default := true are in
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00845.html

Well this patch doesn't inspire lots of confidence since the initial
version had the wrong setting and this got unnoticed.

It's OK on principle, but really shows that beyond building the compiler,
this port hasn't been used in practice.


Committed patches (except rejected 1/4)

About value of  ZCX_By_Default: exceptions work for DJGPP for both values true and false. So it is 
not too surprising that wrong setting got unnoticed.


Andris




Re: [PATCH 4/4][Ada,DJGPP] Ada support for DJGPP

2016-10-10 Thread Andris Pavenis

On 10/10/2016 06:22 PM, Arnaud Charlet wrote:



PS. What about last versions of other 2 not yet approved patches (1 and 3)?

There have been many back and forth and many updates, so I do not know where
we are on these. I'm pretty sure I OKed one of the other parts, but best
to resubmit them cleanly (so with latest patches, changelog, etc...).
There are no changes since submitting last versions of patches 1 and 3. So I just pointed to 
messages in mail archives

in separate e-mails.

Andris



[PING][PATCH 3/4][Ada,DJGPP] Ada support for DJGPP

2016-10-10 Thread Andris Pavenis

I'd like to ping patch

https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00164.html

Additional comments about using ZCX_By_Default := true are in

https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00845.html

Andris



[PING][PATCH 1/4][Ada,DJGPP] Ada support for DJGPP

2016-10-10 Thread Andris Pavenis

I'd like to ping this patch.

Last version of the patch together with Changelog entry can be found in mailing 
list archive:

https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01229.html

Andris



Re: [PATCH 4/4][Ada,DJGPP] Ada support for DJGPP

2016-10-10 Thread Andris Pavenis

On 09/25/2016 07:25 PM, Arnaud Charlet wrote:

  int
  __gnat_get_maximum_file_name_length (void)
  {
+#if defined (__DJGPP__)
+  return (_use_lfn(".")) ? -1 : 8;
+#else
return -1;
+#endif
  }

Is the above change really necessary? Would be nice to get rid of this
extra code. The rest looks OK to me.


It is be possible to leave this part out for now.

We could return to this part later separately.

Andris

PS. What about last versions of other 2 not yet approved patches (1 and 3)?

>From bd1698bff232bdc4258c70f49add1869276184db Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Mon, 10 Oct 2016 18:14:52 +0300
Subject: [PATCH 4/4] [DJGPP, Ada] Ada support

* ada/adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
  ISALPHA: include  and define to isalpha for DJGPP when IN_RTS is defined.
  (DIR_SEPARATOR) define to '\\' for DJGPP.
  (__gnat_get_file_names_case_sensitive): return 0 for DJGPP unless
  overriden in environment
  (__gnat_is_absolute_path): Support MS-DOS style absolute paths for DJGPP.
  (__gnat_portable_spawn): Use spewnvp for DJGPP.
  (__gnat_portable_no_block_spawn): Use spawnvp for DJGPP.
  (__gnat_portable_wait): Return 0 for DJGPP.
---
 gcc/ada/adaint.c | 39 ---
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index f317865..17d6f1f 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -112,7 +112,18 @@
 extern "C" {
 #endif
 
-#if defined (__MINGW32__) || defined (__CYGWIN__)
+#if defined (__DJGPP__)
+
+/* For isalpha-like tests in the compiler, we're expected to resort to
+   safe-ctype.h/ISALPHA.  This isn't available for the runtime library
+   build, so we fallback on ctype.h/isalpha there.  */
+
+#ifdef IN_RTS
+#include 
+#define ISALPHA isalpha
+#endif
+
+#elif defined (__MINGW32__) || defined (__CYGWIN__)
 
 #include "mingw32.h"
 
@@ -165,11 +176,16 @@ UINT CurrentCCSEncoding;
 #include 
 #endif
 
-#if defined (_WIN32)
-
+#if defined (__DJGPP__)
 #include 
 #include 
 #include 
+#include 
+#undef DIR_SEPARATOR
+#define DIR_SEPARATOR '\\'
+
+#elif defined (_WIN32)
+
 #include 
 #include 
 #include 
@@ -560,7 +576,7 @@ __gnat_get_file_names_case_sensitive (void)
 	{
 	  /* By default, we suppose filesystems aren't case sensitive on
 	 Windows and Darwin (but they are on arm-darwin).  */
-#if defined (WINNT) \
+#if defined (WINNT) || defined (__DJGPP__) \
   || (defined (__APPLE__) && !(defined (__arm__) || defined (__arm64__)))
 	  file_names_case_sensitive_cache = 0;
 #else
@@ -576,7 +592,7 @@ __gnat_get_file_names_case_sensitive (void)
 int
 __gnat_get_env_vars_case_sensitive (void)
 {
-#if defined (WINNT)
+#if defined (WINNT) || defined (__DJGPP__)
  return 0;
 #else
  return 1;
@@ -1646,7 +1662,7 @@ __gnat_is_absolute_path (char *name, int length)
 #else
   return (length != 0) &&
  (*name == '/' || *name == DIR_SEPARATOR
-#if defined (WINNT)
+#if defined (WINNT) || defined(__DJGPP__)
   || (length > 1 && ISALPHA (name[0]) && name[1] == ':')
 #endif
 	  );
@@ -2234,7 +2250,7 @@ __gnat_portable_spawn (char *args[] ATTRIBUTE_UNUSED)
 #if defined (__vxworks) || defined(__PikeOS__)
   return -1;
 
-#elif defined (_WIN32)
+#elif defined (__DJGPP__) || defined (_WIN32)
   /* args[0] must be quotes as it could contain a full pathname with spaces */
   char *args_0 = args[0];
   args[0] = (char *)xmalloc (strlen (args_0) + 3);
@@ -2606,6 +2622,12 @@ __gnat_portable_no_block_spawn (char *args[] ATTRIBUTE_UNUSED)
   /* Not supported.  */
   return -1;
 
+#elif defined(__DJGPP__)
+  if (spawnvp (P_WAIT, args[0], args) != 0)
+return -1;
+  else
+return 0;
+
 #elif defined (_WIN32)
 
   HANDLE h = NULL;
@@ -2649,6 +2671,9 @@ __gnat_portable_wait (int *process_status)
 
   pid = win32_wait ();
 
+#elif defined (__DJGPP__)
+  /* Child process has already ended in case of DJGPP.
+ No need to do anything. Just return success. */
 #else
 
   pid = waitpid (-1, , 0);
-- 
2.7.4



Re: [PATCH] [PR libcpp/71681] Fix handling header.gcc in subdirectories

2016-10-06 Thread Andris Pavenis

On 09/08/2016 12:09 PM, Thomas Schwinge wrote:

Hi!

A few review comments:

On Wed, 7 Sep 2016 20:19:20 +0300, Andris Pavenis <andris.pave...@iki.fi> wrote:

This patch fixes handling header.gcc in subdirectories when command line option 
-remap has been
used.

(I have not yet looked up what that mechanism actually does.)  ;-)


Current version finds header.gcc in directories from GCC include directory 
search path but
fails to find them in subdirectories due to missing directory separator.

Can you provide some test cases? (Ah, I now see you got some "Test
script to reproduce problem" attached to <https://gcc.gnu.org/PR71681> --
this should be turned into a regression test for the GCC testsuite.)


Separate patch with test-cases is in the attachment.

I added also test for header.gcc directly in directory on GCC includes search path. This case have 
always worked but there is no test-case for it in gcc test-suite yet.
Other test case (pr71681-2.c) fails without initial patch for libcpp/files.c 
(https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00395.html) applied but passes after it is applied.


I would prefer to applied this new patch at first and initial patch after that 
if they are acceptable.

Andris

ChangeLog entry for new patch:

2016-10-06  Andris Pavenis  <andris.pave...@iki.fi> Add test-cases for pr71681

* gcc.dg/cpp/pr71681-1.c: New testcase (-remap, header.gcc in directory on 
includes search path)
* gcc.dg/cpp/pr71681-2.c: New testcase (-remap, header.gcc in subdirectory)
* gcc.dg/cpp/remap/header.gcc: File for added test-cases
* gcc.dg/cpp/remap/a/header.gcc: Likewise
* gcc.dg/cpp/remap/a/t_1.h: Likewise
* gcc.dg/cpp/remap/a/t_2.h: Likewise

>From 2aed23fd806e8140c92f7681935ba0b9724f16e5 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Wed, 5 Oct 2016 21:17:36 +0300
Subject: [PATCH 1/2] Add test-cases for pr71681

* gcc.dg/cpp/pr71681-1.c: New testcase
* gcc.dg/cpp/pr71681-2.c: Likewise
* gcc.dg/cpp/remap/header.gcc: File for added test-cases
* gcc.dg/cpp/remap/a/header.gcc: Likewise
* gcc.dg/cpp/remap/a/t_1.h: Likewise
* gcc.dg/cpp/remap/a/t_2.h: Likewise
---
 gcc/testsuite/gcc.dg/cpp/pr71681-1.c| 5 +
 gcc/testsuite/gcc.dg/cpp/pr71681-2.c| 5 +
 gcc/testsuite/gcc.dg/cpp/remap/a/header.gcc | 1 +
 gcc/testsuite/gcc.dg/cpp/remap/a/t_1.h  | 1 +
 gcc/testsuite/gcc.dg/cpp/remap/a/t_2.h  | 1 +
 gcc/testsuite/gcc.dg/cpp/remap/header.gcc   | 1 +
 6 files changed, 14 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/cpp/pr71681-1.c
 create mode 100644 gcc/testsuite/gcc.dg/cpp/pr71681-2.c
 create mode 100644 gcc/testsuite/gcc.dg/cpp/remap/a/header.gcc
 create mode 100644 gcc/testsuite/gcc.dg/cpp/remap/a/t_1.h
 create mode 100644 gcc/testsuite/gcc.dg/cpp/remap/a/t_2.h
 create mode 100644 gcc/testsuite/gcc.dg/cpp/remap/header.gcc

diff --git a/gcc/testsuite/gcc.dg/cpp/pr71681-1.c b/gcc/testsuite/gcc.dg/cpp/pr71681-1.c
new file mode 100644
index 000..a185351
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr71681-1.c
@@ -0,0 +1,5 @@
+// PR preprocessor/71681
+// { dg-do preprocess }
+// { dg-options "-remap -I$srcdir/gcc.dg/cpp/remap" }
+
+#include "a/t1.h"
diff --git a/gcc/testsuite/gcc.dg/cpp/pr71681-2.c b/gcc/testsuite/gcc.dg/cpp/pr71681-2.c
new file mode 100644
index 000..162e366
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr71681-2.c
@@ -0,0 +1,5 @@
+// PR preprocessor/71681
+// { dg-do preprocess }
+// { dg-options "-remap -I$srcdir/gcc.dg/cpp/remap" }
+
+#include "a/t2.h"
diff --git a/gcc/testsuite/gcc.dg/cpp/remap/a/header.gcc b/gcc/testsuite/gcc.dg/cpp/remap/a/header.gcc
new file mode 100644
index 000..a0e2b7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/remap/a/header.gcc
@@ -0,0 +1 @@
+t2.h t_2.h
diff --git a/gcc/testsuite/gcc.dg/cpp/remap/a/t_1.h b/gcc/testsuite/gcc.dg/cpp/remap/a/t_1.h
new file mode 100644
index 000..600cfce8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/remap/a/t_1.h
@@ -0,0 +1 @@
+/* Test file for cpp option -remap test */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.dg/cpp/remap/a/t_2.h b/gcc/testsuite/gcc.dg/cpp/remap/a/t_2.h
new file mode 100644
index 000..600cfce8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/remap/a/t_2.h
@@ -0,0 +1 @@
+/* Test file for cpp option -remap test */
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.dg/cpp/remap/header.gcc b/gcc/testsuite/gcc.dg/cpp/remap/header.gcc
new file mode 100644
index 000..0331f89
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/remap/header.gcc
@@ -0,0 +1 @@
+a/t1.h a/t_1.h
-- 
2.7.4



Re: [PATCH 4/4][Ada,DJGPP] Ada support for DJGPP

2016-09-25 Thread Andris Pavenis

On 09/25/2016 09:10 PM, Arnaud Charlet wrote:

Is the above change really necessary? Would be nice to get rid of this
extra code. The rest looks OK to me.

It is required for support of environment when LFN support is either
not available or disabled for some reason (for example FreeDOS
without LFN support loaded).

Does it matter for GNAT usage/users in practice?

Arno


It may. I do not actually have information about environments used by poeple using DJGPP build. I'm 
providing compiler packages for them.


There are actually 2 levels of non-LFN support for DJGPP port of CCC:

1) ability to run user compiled programs (the ones which are compatible with required restrictions) 
without LFN support


2) the ability to compile using GCC in such environment

Submitted patches only addresses level 1. I'm not sure I'll ever submit changes for level 2. 
Absence of these changes does not prevent bootstrapping GCC iwhen LFN is available (like in recent 
Windows versions).


Discussed change belongs to level 1 (ability to run compiled programs without 
LFN support available).

Andris




Re: [PATCH 4/4][Ada,DJGPP] Ada support for DJGPP

2016-09-25 Thread Andris Pavenis

On 09/25/2016 07:25 PM, Arnaud Charlet wrote:

  int
  __gnat_get_maximum_file_name_length (void)
  {
+#if defined (__DJGPP__)
+  return (_use_lfn(".")) ? -1 : 8;
+#else
return -1;
+#endif
  }

Is the above change really necessary? Would be nice to get rid of this
extra code. The rest looks OK to me.
It is required for support of environment when LFN support is either not available or disabled for 
some reason (for example FreeDOS without LFN support loaded).


Andris



Re: [PATCH 4/4][Ada,DJGPP] Ada support for DJGPP

2016-09-21 Thread Andris Pavenis

On 09/04/2016 09:52 PM, Arnaud Charlet wrote:

This last patch (4/4) contains DJGPP related changes to adaint.c
(except one which belongs to patch 1/4).

This patch is quite intrusive. Are all these changes really needed?


New version of patch is in attachment.

  char
  __gnat_get_default_identifier_character_set (void)
  {
+#if defined (__DJGPP__)
+  return 'p';
+#else
return '1';
+#endif
  }

Why is this needed?

Removed in updated version of patch

-#elif defined (_WIN32)
+#elif defined (__DJGPP__) || defined (_WIN32)
/* args[0] must be quotes as it could contain a full pathname with spaces
*/
char *args_0 = args[0];
args[0] = (char *)xmalloc (strlen (args_0) + 3);
@@ -2606,6 +2630,12 @@ __gnat_portable_no_block_spawn (char *args[]
ATTRIBUTE_UNUSED)
/* Not supported.  */
return -1;
  
+#elif defined(__DJGPP__)

+  if (spawnvp (P_WAIT, args[0], args) != 0)
+return -1;
+  else
+return 0;
+
  #elif defined (_WIN32)
  
HANDLE h = NULL;

@@ -2649,6 +2679,7 @@ __gnat_portable_wait (int *process_status)
  
pid = win32_wait ();
  
+#elif defined (__DJGPP__)

  #else

You can't add an empty #elif without explaining it with a proper
comment.

Comment with explanation added in attached version of patch

Andris

>From 49015a63e708824dbd80fb90520c33b8e1607c43 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Thu, 15 Sep 2016 19:31:54 +0300
Subject: [PATCH 4/4] [DJGPP, Ada] Ada support

* ada/adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
  ISALPHA: include  and define to isalpha for DJGPP when IN_RTS is defined.
  (DIR_SEPARATOR) define to '\\' for DJGPP.
  (__gnat_get_maximum_file_name_length): decide return value depending on
  availability of LFN for DJGPP
  (__gnat_get_file_names_case_sensitive): return 0 for DJGPP unless
  overriden in environment
  (__gnat_is_absolute_path): Support MS-DOS style absolute paths for DJGPP.
  (__gnat_portable_spawn): Use spewnvp for DJGPP.
  (__gnat_portable_no_block_spawn): Use spawnvp for DJGPP.
  (__gnat_portable_wait): Return 0 for DJGPP.



Signed-off-by: Andris Pavenis <andris.pave...@iki.fi>
---
 gcc/ada/adaint.c | 43 ---
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index f317865..ed49ed7 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -112,7 +112,18 @@
 extern "C" {
 #endif
 
-#if defined (__MINGW32__) || defined (__CYGWIN__)
+#if defined (__DJGPP__)
+
+/* For isalpha-like tests in the compiler, we're expected to resort to
+   safe-ctype.h/ISALPHA.  This isn't available for the runtime library
+   build, so we fallback on ctype.h/isalpha there.  */
+
+#ifdef IN_RTS
+#include 
+#define ISALPHA isalpha
+#endif
+
+#elif defined (__MINGW32__) || defined (__CYGWIN__)
 
 #include "mingw32.h"
 
@@ -165,11 +176,16 @@ UINT CurrentCCSEncoding;
 #include 
 #endif
 
-#if defined (_WIN32)
-
+#if defined (__DJGPP__)
 #include 
 #include 
 #include 
+#include 
+#undef DIR_SEPARATOR
+#define DIR_SEPARATOR '\\'
+
+#elif defined (_WIN32)
+
 #include 
 #include 
 #include 
@@ -538,7 +554,11 @@ __gnat_try_lock (char *dir, char *file)
 int
 __gnat_get_maximum_file_name_length (void)
 {
+#if defined (__DJGPP__)
+  return (_use_lfn(".")) ? -1 : 8;
+#else
   return -1;
+#endif
 }
 
 /* Return nonzero if file names are case sensitive.  */
@@ -560,7 +580,7 @@ __gnat_get_file_names_case_sensitive (void)
 	{
 	  /* By default, we suppose filesystems aren't case sensitive on
 	 Windows and Darwin (but they are on arm-darwin).  */
-#if defined (WINNT) \
+#if defined (WINNT) || defined (__DJGPP__) \
   || (defined (__APPLE__) && !(defined (__arm__) || defined (__arm64__)))
 	  file_names_case_sensitive_cache = 0;
 #else
@@ -576,7 +596,7 @@ __gnat_get_file_names_case_sensitive (void)
 int
 __gnat_get_env_vars_case_sensitive (void)
 {
-#if defined (WINNT)
+#if defined (WINNT) || defined (__DJGPP__)
  return 0;
 #else
  return 1;
@@ -1646,7 +1666,7 @@ __gnat_is_absolute_path (char *name, int length)
 #else
   return (length != 0) &&
  (*name == '/' || *name == DIR_SEPARATOR
-#if defined (WINNT)
+#if defined (WINNT) || defined(__DJGPP__)
   || (length > 1 && ISALPHA (name[0]) && name[1] == ':')
 #endif
 	  );
@@ -2234,7 +2254,7 @@ __gnat_portable_spawn (char *args[] ATTRIBUTE_UNUSED)
 #if defined (__vxworks) || defined(__PikeOS__)
   return -1;
 
-#elif defined (_WIN32)
+#elif defined (__DJGPP__) || defined (_WIN32)
   /* args[0] must be quotes as it could contain a full pathname with spaces */
   char *args_0 = args[0];
   args[0] = (char *)xmalloc (strlen (args_0) + 3);
@@ -2606,6 +2626,12 @@ __gnat_portable_no_block_spawn (char *args[] ATTRIBUTE_UNUSED)
   /* Not supported.  */
   return -1;
 
+#elif defined(__DJGPP__)
+  if (spawnvp (P_WAIT, args[0], args) != 0)
+return -1;
+  else
+return 0;
+
 #elif define

Re: [PATCH 3/4][Ada,DJGPP] Ada support for DJGPP

2016-09-14 Thread Andris Pavenis

On 09/05/2016 08:39 AM, Arnaud Charlet wrote:

GCC Ada compiler itself uses exceptions.

Yes, but the bootstrap doesn't use system-dgjpp.ads, it uses the generic
system.ads which uses front-end (GNAT) SJLJ, hence my question. Your
answer isn't very reassuring.
Tried several test examples which uses exceptions. These examples worked for DJGPP as expected with 
today
build of gcc-7.0.0-20160914. ZCX_By_Default in system-djgpp.ads had value true as in last version 
of patch.


Andris



Re: [PATCH 3/4][Ada,DJGPP] Ada support for DJGPP

2016-09-13 Thread Andris Pavenis

On 09/13/2016 11:39 PM, Eric Botcazou wrote:

Found that the first revision causing this problem (of course with DJGPP
related patches applied) is 239113. Native bootstrap with same DJGPP
related patches applied on top of revision 239112 succeeds without
problems.

[andris@ap gcc]$ git bisect good
4bfa373ed2bfd022628609751ff34b8e51e0c2b9 is the first bad commit
commit 4bfa373ed2bfd022628609751ff34b8e51e0c2b9
Author: kugan 
Date:   Thu Aug 4 04:20:01 2016 +

  gcc/ChangeLog:

  2016-08-04  Kugan Vivekanandarajah

  * tree-vrp.c (set_value_range): Use vrp_equiv_obstack with
  BITMAP_ALLOC.
  (add_equivalence): Likewise.
  (get_value_range): Allocate value range with vrp_value_range_pool.
  (vrp_initialize): Initialize vrp_equiv_obstack for equiv
allocation. (vrp_finalize): Relase vrp_equiv_obstack and
vrp_value_range_pool.

Ugh, this looks like a memory corruption issue.


Thanks for good hint.

Problem solved (fixed stack size for gnat1.exe was insufficient after mentioned change). Increasing 
it causes problem to go away. I'll recheck with full native DJGPP bootstrap. Currently only quick 
test done (by editing stack size of 3rd stage gnat1.exe).


Andris




Re: [PATCH 3/4][Ada,DJGPP] Ada support for DJGPP

2016-09-13 Thread Andris Pavenis

On 09/07/2016 08:59 PM, Andris Pavenis wrote:

On 09/05/2016 09:42 AM, Eric Botcazou wrote:

Attached output is from last test build (r239639 with DJGPP related patches
applied, last version of patches for Ada).

Very strange error, line 28 of gtype-ada.h is supposed to have a guard for
nodes containing the 'common' structure.  Can you post an excerpt of the file?

Verified that contents of gtype-ada.h from DJGPP build is identical with one from my Linux build 
of yesterdays trunk (except of CR LF used for line separator in DJGPP build).


I'll try to find the revision from which the problem appears.


Found that the first revision causing this problem (of course with DJGPP related patches applied) 
is 239113. Native bootstrap with same DJGPP related patches applied on top of revision 239112 
succeeds without problems.


[andris@ap gcc]$ git bisect good
4bfa373ed2bfd022628609751ff34b8e51e0c2b9 is the first bad commit
commit 4bfa373ed2bfd022628609751ff34b8e51e0c2b9
Author: kugan <kugan@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Aug 4 04:20:01 2016 +

gcc/ChangeLog:

2016-08-04  Kugan Vivekanandarajah  <kug...@linaro.org>

* tree-vrp.c (set_value_range): Use vrp_equiv_obstack with
BITMAP_ALLOC.
(add_equivalence): Likewise.
(get_value_range): Allocate value range with vrp_value_range_pool.
(vrp_initialize): Initialize vrp_equiv_obstack for equiv allocation.
(vrp_finalize): Relase vrp_equiv_obstack and vrp_value_range_pool.




git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239113 
138bc75d-0d04-0410-961f-82ee72b054a4

:04 04 ea9efdfd9af7e141b09b184c3762d26aab61a020 feebee01cfdca66d04fd88cf345a693f248e24cd 
M  gcc



Andris



Re: [PATCH] [PR libcpp/71681] Fix handling header.gcc in subdirectories

2016-09-08 Thread Andris Pavenis

On 09/08/2016 12:09 PM, Thomas Schwinge wrote:

Hi!

A few review comments:

On Wed, 7 Sep 2016 20:19:20 +0300, Andris Pavenis <andris.pave...@iki.fi> wrote:

This patch fixes handling header.gcc in subdirectories when command line option 
-remap has been
used.

(I have not yet reviewed the logic of your change itself.)  Wouldn't it
be simpler to just unconditionally add a directory separator here?

Is it OK to assume that a directory separator always is "/"?  (Think DOS,
Windows etc.  But maybe there's some "translation layer" beneath this --
I don't know.)

No.

DJGPP supports both '/' and '\'. '\' is OK except in some cases (special handling of paths 
beginning with /dev/). Blind conversion off all '/' to '\' do not work for DJGPP due to this reason

(had related problems in directory gcc/ada).

Windows targets (WINGW, Cygwin): at least in Ada gcc/ada/s-os_lib.adb converts all '/' to '\' for 
Windows targets and without submitted but not yet committed patch also for DJGPP (that broke 
bootstrapping gcc for DJGPP due to gnatmake not working). I have not done however real testing for 
Windows targets myself.

Can you provide some test cases?  (Ah, I now see you got some "Test
script to reproduce problem" attached to <https://gcc.gnu.org/PR71681> --
this should be turned into a regression test for the GCC testsuite.)

Which could more appropriate place for test-case?
- gcc/testsuite/c-c++-common/cpp
- gcc/testsuite/gcc.dg/cpp

Also should this test be in a separate subdirectory under either of them?

It is good practice to assign a GCC PR to yourself if you're working on
it, and it also helps to post to the PR a comment with a link to the
mailing list archive for patch submissions, etc.

Done

Andris



Re: [PATCH 3/4][Ada,DJGPP] Ada support for DJGPP

2016-09-07 Thread Andris Pavenis

On 09/05/2016 09:42 AM, Eric Botcazou wrote:

Attached output is from last test build (r239639 with DJGPP related patches
applied, last version of patches for Ada).

Very strange error, line 28 of gtype-ada.h is supposed to have a guard for
nodes containing the 'common' structure.  Can you post an excerpt of the file?

Verified that contents of gtype-ada.h from DJGPP build is identical with one from my Linux build of 
yesterdays trunk (except of CR LF used for line separator in DJGPP build).


I'll try to find the revision from which the problem appears.

Andris





[PATCH] [PR libcpp/71681] Fix handling header.gcc in subdirectories

2016-09-07 Thread Andris Pavenis
This patch fixes handling header.gcc in subdirectories when command line option -remap has been 
used. Current version finds header.gcc in directories from GCC include directory search path but 
fails to find them in subdirectories due to missing directory separator.


Andris

2016-09-07 Andris Pavenis  <andris.pave...@iki.fi>

* files.c (remap_filename): Fix handling -remap in subdirectories


>From 77e02ba755fa9ea66e046ecf6dbc61c306bc2a71 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Wed, 7 Sep 2016 18:22:32 +0300
Subject: [PATCH] * files.c (remap_filename): Fix handling -remap in
 subdirectories

---
 libcpp/files.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libcpp/files.c b/libcpp/files.c
index c8bb637..26a7330 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -1672,7 +1672,7 @@ static char *
 remap_filename (cpp_reader *pfile, _cpp_file *file)
 {
   const char *fname, *p;
-  char *new_dir;
+  char *new_dir, *p3;
   cpp_dir *dir;
   size_t index, len;
 
@@ -1701,9 +1701,15 @@ remap_filename (cpp_reader *pfile, _cpp_file *file)
 	return NULL;
 
   len = dir->len + (p - fname + 1);
-  new_dir = XNEWVEC (char, len + 1);
+  new_dir = XNEWVEC (char, len + 2);
+  p3 = new_dir + dir->len;
   memcpy (new_dir, dir->name, dir->len);
-  memcpy (new_dir + dir->len, fname, p - fname + 1);
+  if (dir->len && !IS_DIR_SEPARATOR(dir->name[dir->len - 1]))
+	{
+	  *p3++ = '/';
+	  len++;
+	}
+  memcpy (p3, fname, p - fname + 1);
   new_dir[len] = '\0';
 
   dir = make_cpp_dir (pfile, new_dir, dir->sysp);
-- 
2.7.4



Re: [PATCH 3/4][Ada,DJGPP] Ada support for DJGPP

2016-09-04 Thread Andris Pavenis

On 09/04/2016 09:50 PM, Arnaud Charlet wrote:

On 08/25/2016 12:46 PM, Arnaud Charlet wrote:

Which exception handling mechanism is used by the DJGPP port?
Is it (GCC) SJLJ?

No. Updated to set ZCX_By_Default := true for DJGPP.

Well I'm confused now. How could this work before? In other words, has the
target runtime been tested/used by anyone?
GCC Ada compiler itself uses exceptions. I mentioned bootstrap failure of GCC recent trunk version 
for traget libada. It causes an exception to be raised. That worked in last test build (r239639 
with DJGPP related patches applied, last version of patches for Ada). I also got identical failure 
with 20160831 trunk version where XCZ_By_Default was still false (my old patch set version that was 
maintained for a long time)


Attached output is from last test build (r239639 with DJGPP related patches applied, last version 
of patches for Ada).


Andris




/dev/f/build.gcc/./gcc/xgcc -B/dev/f/build.gcc/./gcc/ 
-B/dev/env/DJDIR/djgpp/bin/ -B/dev/env/DJDIR/djgpp/lib/ -isystem 
/dev/env/DJDIR/djgpp/include -isystem /dev/env/DJDIR/djgpp/sys-include-c -g 
-O2   -W -Wall -gnatpg -nostdinc   a-rttiev.adb -o a-rttiev.o
+===GNAT BUG DETECTED==+
| 7.0.0 20160820 (experimental) (djgpp) GCC error: |
| tree check: expected tree that contains 'common' structure, have |
| 'optimization_node' in gt_ggc_mx_lang_tree_node, at ./gtype-ada.h:28 |
| Error detected around a-cdlili.ads:46:24 |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.|
| Use a subject line meaningful to you and us to track the bug.|
| Include the entire contents of this bug box in the report.   |
| Include the exact command that you entered.  |
| Also include sources listed below.   |
+==+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

system.ads
a-rttiev.adb
a-rttiev.ads
a-reatim.ads
ada.ads
s-taspri.ads
s-taprop.ads
s-parame.ads
s-taskin.ads
a-except.ads
s-stalib.ads
a-unccon.ads
s-traent.ads
s-tasinf.ads
s-soflin.ads
s-stache.ads
s-stoele.ads
s-stausa.ads
s-atacco.ads
interfac.ads
s-multip.ads
s-osinte.ads
a-finali.ads
s-finroo.ads
s-tasuti.ads
s-intman.ads
i-c.ads
s-inmaop.ads
a-contai.ads
a-cdlili.ads
a-iteint.ads
a-conhel.ads
s-atocou.ads
a-stream.ads
s-unstyp.ads
s-exctab.ads
a-tags.ads
s-stopoo.ads
s-stratt.ads
s-secsta.ads
s-finmas.ads
s-stposu.ads
s-tassta.ads
a-retide.ads
a-cdlili.adb
a-uncdea.ads
a-conhel.adb
s-stoele.adb
s-stalib.adb
s-memory.ads


raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:406
../gcc-interface/Makefile:295: recipe for target 'a-rttiev.o' failed
make.exe[5]: *** [a-rttiev.o] Error 1
make.exe[5]: Leaving directory 'f:/build.gcc/gcc/ada/rts'
gcc-interface/Makefile:2862: recipe for target 'gnatlib' failed
make.exe[4]: *** [gnatlib] Error 2
make.exe[4]: Leaving directory 'f:/build.gcc/gcc/ada'
gcc-interface/Makefile:3039: recipe for target 'gnatlib-shared' failed
make.exe[3]: *** [gnatlib-shared] Error 2
make.exe[3]: Leaving directory 'f:/build.gcc/gcc/ada'
Makefile:113: recipe for target 'gnatlib-shared' failed
make.exe[2]: *** [gnatlib-shared] Error 2
make.exe[2]: Leaving directory 'f:/build.gcc/djgpp/libada'
Makefile:19070: recipe for target 'all-target-libada' failed
make.exe[1]: *** [all-target-libada] Error 2
make.exe[1]: Leaving directory 'f:/build.gcc'
Makefile:20224: recipe for target 'bootstrap' failed
make.exe: *** [bootstrap] Error 2


Re: [PATCH 4/4][Ada,DJGPP] Ada support for DJGPP

2016-09-04 Thread Andris Pavenis

On 07/30/2016 08:47 AM, Andris Pavenis wrote:
This last patch (4/4) contains DJGPP related changes to adaint.c (except one which belongs to 
patch 1/4).


ChangeLog entry:

2016-07-30 Andris Pavenis <andris.pave...@iki.fi>

* ada/adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
  (DIR_SEPARATOR) define to '\\' for DJGPP.
  (__gnat_get_maximum_file_name_length): decide return value depending on
  availability of LFN for DJGPP
  (__gnat_get_file_names_case_sensitive): return 0 for DJGPP unless
  overriden in environment
  (__gnat_get_default_identifier_character_set): return '1' for DJGPP
  (__gnat_is_absolute_path): Support MS-DOS style absolute paths for DJGPP.
  (__gnat_portable_spawn): Use spewnvp for DJGPP.
  (__gnat_portable_no_block_spawn): Use spawnvp for DJGPP.
  (__gnat_portable_wait): Return 0 for DJGPP.


New revision of patch is in the attachment.

Only 1 additional change:

include ctype.h and define ISALPHA to isalpha for DJGPP when IN_RTS is defined.

Updated ChangeLog entry is in the attachment.

Andris

>From 7d102a4d4d5d31d8225e69c3e53f3d4a234515ba Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sat, 3 Sep 2016 08:20:14 +0300
Subject: [PATCH 4/4] [DJGPP, Ada] Ada support

* ada/adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
  ISALPHA: include  and define to isalpha for DJGPP when IN_RTS is defined.
  (DIR_SEPARATOR) define to '\\' for DJGPP.
  (__gnat_get_maximum_file_name_length): decide return value depending on
  availability of LFN for DJGPP
  (__gnat_get_file_names_case_sensitive): return 0 for DJGPP unless
  overriden in environment
  (__gnat_get_default_identifier_character_set): return '1' for DJGPP
  (__gnat_is_absolute_path): Support MS-DOS style absolute paths for DJGPP.
  (__gnat_portable_spawn): Use spewnvp for DJGPP.
  (__gnat_portable_no_block_spawn): Use spawnvp for DJGPP.
  (__gnat_portable_wait): Return 0 for DJGPP.



Signed-off-by: Andris Pavenis <andris.pave...@iki.fi>
---
 gcc/ada/adaint.c | 45 ++---
 1 file changed, 38 insertions(+), 7 deletions(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index f317865..23fca5d 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -112,7 +112,18 @@
 extern "C" {
 #endif
 
-#if defined (__MINGW32__) || defined (__CYGWIN__)
+#if defined (__DJGPP__)
+
+/* For isalpha-like tests in the compiler, we're expected to resort to
+   safe-ctype.h/ISALPHA.  This isn't available for the runtime library
+   build, so we fallback on ctype.h/isalpha there.  */
+
+#ifdef IN_RTS
+#include 
+#define ISALPHA isalpha
+#endif
+
+#elif defined (__MINGW32__) || defined (__CYGWIN__)
 
 #include "mingw32.h"
 
@@ -165,11 +176,16 @@ UINT CurrentCCSEncoding;
 #include 
 #endif
 
-#if defined (_WIN32)
-
+#if defined (__DJGPP__)
 #include 
 #include 
 #include 
+#include 
+#undef DIR_SEPARATOR
+#define DIR_SEPARATOR '\\'
+
+#elif defined (_WIN32)
+
 #include 
 #include 
 #include 
@@ -538,7 +554,11 @@ __gnat_try_lock (char *dir, char *file)
 int
 __gnat_get_maximum_file_name_length (void)
 {
+#if defined (__DJGPP__)
+  return (_use_lfn(".")) ? -1 : 8;
+#else
   return -1;
+#endif
 }
 
 /* Return nonzero if file names are case sensitive.  */
@@ -560,7 +580,7 @@ __gnat_get_file_names_case_sensitive (void)
 	{
 	  /* By default, we suppose filesystems aren't case sensitive on
 	 Windows and Darwin (but they are on arm-darwin).  */
-#if defined (WINNT) \
+#if defined (WINNT) || defined (__DJGPP__) \
   || (defined (__APPLE__) && !(defined (__arm__) || defined (__arm64__)))
 	  file_names_case_sensitive_cache = 0;
 #else
@@ -576,7 +596,7 @@ __gnat_get_file_names_case_sensitive (void)
 int
 __gnat_get_env_vars_case_sensitive (void)
 {
-#if defined (WINNT)
+#if defined (WINNT) || defined (__DJGPP__)
  return 0;
 #else
  return 1;
@@ -586,7 +606,11 @@ __gnat_get_env_vars_case_sensitive (void)
 char
 __gnat_get_default_identifier_character_set (void)
 {
+#if defined (__DJGPP__)
+  return 'p';
+#else
   return '1';
+#endif
 }
 
 /* Return the current working directory.  */
@@ -1646,7 +1670,7 @@ __gnat_is_absolute_path (char *name, int length)
 #else
   return (length != 0) &&
  (*name == '/' || *name == DIR_SEPARATOR
-#if defined (WINNT)
+#if defined (WINNT) || defined(__DJGPP__)
   || (length > 1 && ISALPHA (name[0]) && name[1] == ':')
 #endif
 	  );
@@ -2234,7 +2258,7 @@ __gnat_portable_spawn (char *args[] ATTRIBUTE_UNUSED)
 #if defined (__vxworks) || defined(__PikeOS__)
   return -1;
 
-#elif defined (_WIN32)
+#elif defined (__DJGPP__) || defined (_WIN32)
   /* args[0] must be quotes as it could contain a full pathname with spaces */
   char *args_0 = args[0];
   args[0] = (char *)xmalloc (strlen (args_0) + 3);
@@ -2606,6 +2630,12 @@ __gnat_portable_no_block_spawn (char *args[] ATTRIBUTE_UNUSED)
   /* Not supported.  */
   return -1;
 
+#elif defined(__DJG

Re: [PATCH 3/4][Ada,DJGPP] Ada support for DJGPP

2016-09-04 Thread Andris Pavenis

On 08/25/2016 12:46 PM, Arnaud Charlet wrote:

Which exception handling mechanism is used by the DJGPP port?
Is it (GCC) SJLJ?

No. Updated to set ZCX_By_Default := true for DJGPP.

New patch attached.

Andris

>From 45d1e01d7b29e88eea85a284733efdd7f38cc604 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Fri, 26 Aug 2016 19:46:24 +0300
Subject: [PATCH 3/4] [DJGPP, Ada] DJGPP support

* ada/gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS): Define for DJGPP target
  (EH_MECHANISM): Define to -gcc for DJGPP
* ada/system-djgpp.ads: New file
---
 gcc/ada/gcc-interface/Makefile.in |  17 +
 gcc/ada/system-djgpp.ads  | 148 ++
 2 files changed, 165 insertions(+)
 create mode 100644 gcc/ada/system-djgpp.ads

diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 0df7f89..dcb7c93 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1773,6 +1773,23 @@ ifeq ($(strip $(filter-out elf eabi eabispe,$(target_os))),)
   indepsw.adbhttp://www.gnu.org/licenses/>.  --
+--  --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.  --
+--  --
+--
+
+package System is
+   pragma Pure;
+   --  Note that we take advantage of the implementation permission to make
+   --  this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
+   --  2005, this is Pure in any case (AI-362).
+
+   pragma No_Elaboration_Code_All;
+   --  Allow the use of that restriction in units that WITH this unit
+
+   type Name is (SYSTEM_NAME_GNAT);
+   System_Name : constant Name := SYSTEM_NAME_GNAT;
+
+   --  System-Dependent Named Numbers
+
+   Min_Int   : constant := Long_Long_Integer'First;
+   Max_Int   : constant := Long_Long_Integer'Last;
+
+   Max_Binary_Modulus: constant := 2 ** Long_Long_Integer'Size;
+   Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
+
+   Max_Base_Digits   : constant := Long_Long_Float'Digits;
+   Max_Digits: constant := Long_Long_Float'Digits;
+
+   Max_Mantissa  : constant := 63;
+   Fine_Delta: constant := 2.0 ** (-Max_Mantissa);
+
+   Tick  : constant := 0.01;
+
+   --  Storage-related Declarations
+
+   type Address is private;
+   pragma Preelaborable_Initialization (Address);
+   Null_Address : constant Address;
+
+   Storage_Unit : constant := 8;
+   Word_Size: constant := 32;
+   Memory_Size  : constant := 2 ** 32;
+
+   --  Address comparison
+
+   function "<"  (Left, Right : Address) return Boolean;
+   function "<=" (Left, Right : Address) return Boolean;
+   function ">"  (Left, Right : Address) return Boolean;
+   function ">=" (Left, Right : Address) return Boolean;
+   function "="  (Left, Right : Address) return Boolean;
+
+   pragma Import (Intrinsic, "<");
+   pragma Import (Intrinsic, "<=");
+   pragma Import (Intrinsic, ">");
+   pragma Import (Intrinsic, ">=");
+   pragma Import (Intrinsic, "=");
+
+   --  Other System-Dependent Declarations
+
+   type Bit_Order is (High_Order_First, Low_Order_First);
+   Default_Bit_Order : constant Bit_Order := Low_Order_First;
+   pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
+
+   --  Priority-related Declarations (RM D.1)
+
+   Max_Priority   : constant Positive := 30;
+   Max_Interrupt_Priority : constant Positive := 31;
+
+   subtype Any_Priority   is Integer  range  0 .. 31;
+   subtype Priority   is Any_Priority range  0 .. 30;
+   subtype Interrupt_Priority is Any_Priority range 31 .. 31;
+
+   Default_Priority : constant Priority := 15;
+
+private
+
+   type Address is mod Memory_Size;
+   Null_Address : constant Address := 0;
+
+   --
+   -- System Implementation Parameters --
+   --
+
+   --  These parameters provide information about the target that is used
+   --  by the compiler. They are in the private part of System, where they
+   --  can be accessed using the special circuitry in the Targparm unit
+   --  whose source should be consulted for more detailed descriptions
+   --  of the individual switch values.
+
+   Backend_Divide_Checks : constant Boolean := False;
+   Backend_Overflow_Checks   : constant Boolean := True;
+   Command_Line_Args : constant Boolean := True;
+   Configurable_Run_Time : constant Boolean := False;
+   Denorm: const

Re: [PATCH 2/4][Ada,DJGPP] Ada support for DJGPP

2016-09-04 Thread Andris Pavenis

On 08/25/2016 12:17 PM, Arnaud Charlet wrote:

-#if defined (__MINGW32__)
+#if defined (__DJGPP__)
+
+/* FIXME: this is draft version only. Fix me if that is not correct  */
+/*or not complete (AP)   */

This FIXME needs to be addressed.

DJGPP special implementation was actually not required. SImple use of 
localtime_r is sufficient

The rest of the patch is OK.

One additional new change is for file env.c (use of unsetenv for DJGPP).

Updated ChangeLog entry is  in the attachment.

Testing changes took more time than I expected as native bootstrap for DJGPP did not work with 
current trunk version. There is no problems with building Linux to DJGPP cross-compiler including 
Ada compiler. All was OK with r238675 but no more with r239639 and some later revisions (of course 
with DJGPP related patches applied). gnat1 fails when building Ada libraries (all-target-libada). 
I'll try to find which change has caused the error (unfortunately I have not saved the message).


Andris

>From 83fe70a17d811ebdec7ca70509e3c2521657d8f2 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sun, 28 Aug 2016 08:02:11 +0300
Subject: [PATCH 2/4] [DJGPP, Ada] DJGPP support

* ada/ctrl_c.c: Do not use macro SA_RESTART for DJGPP.

* ada/gsocket.h: Do not support sockets for DJGPP.

* ada/init.c (__gnat_install_handler): Implememt for DJGPP

* ada/sysdep.c: Include  for DJGPP
  (_setmode): Define to setmode for DJGPP
  (__gnat_set_mode): Add implementation for DJGPP
  (__gnat_localtime_tzoff): Use localtime_r for DJGPP

* ada/terminals.c: Add DJGPP to list of unsupported platforms.

* ada/env.c (__gnat_clearenv): use _gnat_unsetenv on all entries for DJGPP
---
 gcc/ada/ctrl_c.c|  4 ++--
 gcc/ada/env.c   |  2 +-
 gcc/ada/gsocket.h   |  2 +-
 gcc/ada/init.c  |  8 
 gcc/ada/sysdep.c| 35 +--
 gcc/ada/terminals.c |  2 +-
 6 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/gcc/ada/ctrl_c.c b/gcc/ada/ctrl_c.c
index 7f8d177..d4fc551 100644
--- a/gcc/ada/ctrl_c.c
+++ b/gcc/ada/ctrl_c.c
@@ -92,8 +92,8 @@ __gnat_install_int_handler (void (*proc) (void))
   if (sigint_intercepted == 0)
 {
   act.sa_handler = __gnat_int_handler;
-#if defined (__Lynx__) || defined (VMS)
-  /* LynxOS and VMS do not support SA_RESTART. */
+#if defined (__Lynx__) || defined (VMS) || defined(__DJGPP__)
+  /* LynxOS, VMS or DJGPP do not support SA_RESTART. */
   act.sa_flags = 0;
 #else
   act.sa_flags = SA_RESTART;
diff --git a/gcc/ada/env.c b/gcc/ada/env.c
index 8469876..da6b7b0 100644
--- a/gcc/ada/env.c
+++ b/gcc/ada/env.c
@@ -302,7 +302,7 @@ void __gnat_clearenv (void)
 #elif defined (__MINGW32__) || defined (__FreeBSD__) || defined (__APPLE__) \
|| (defined (__vxworks) && defined (__RTP__)) || defined (__CYGWIN__) \
|| defined (__NetBSD__) || defined (__OpenBSD__) || defined (__rtems__) \
-   || defined (__DragonFly__)
+   || defined (__DragonFly__) || defined (__DJGPP__)
   /* On Windows, FreeBSD and MacOS there is no function to clean all the
  environment but there is a "clean" way to unset a variable. So go
  through the environ table and call __gnat_unsetenv on all entries */
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index 31a3ccf..a979d3a 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -29,7 +29,7 @@
  *  *
  /
 
-#if defined(VTHREADS) || defined(__PikeOS__)
+#if defined(VTHREADS) || defined(__PikeOS__) || defined(__DJGPP__)
 
 /* Sockets not supported on these platforms.  */
 #undef HAVE_SOCKETS
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 6d51896..cec968b 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -2516,6 +2516,14 @@ __gnat_install_handler (void)
   __gnat_handler_installed = 1;
 }
 
+#elif defined (__DJGPP__)
+
+void
+__gnat_install_handler ()
+{
+  __gnat_handler_installed = 1;
+}
+
 #elif defined(__ANDROID__)
 
 /***/
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index 465007e..5390209 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -126,7 +126,7 @@ extern struct tm *localtime_r(const time_t *, struct tm *);
 
 */
 
-#if defined (WINNT) || defined (__CYGWIN__)
+#if defined (WINNT) || defined (__CYGWIN__) || defined(__DJGPP__)
 
 const char __gnat_text_translation_required = 1;
 
@@ -137,6 +137,11 @@ const char __gnat_text_translation_required = 1;
 #define WIN_SETMODE _setmode
 #endif
 
+#if defined(__DJGPP__)
+#include 
+#define _setmode setmode
+#endif /* __DJGPP__ */
+
 void
 __gnat_set_binary_mode (int handle)
 {
@@ -149,6 +154,30 @@ __gnat_set_text_mode (int handle)
   WIN_SETMODE (handle, O_TEXT);
 }
 
+#ifdef __DJGPP__
+void
+__gnat_set_mode (int handle, int mode)
+{
+  /*  the value

Re: [PATCH 3/4][Ada,DJGPP] Ada support for DJGPP

2016-08-21 Thread Andris Pavenis

On 08/18/2016 12:41 PM, Arnaud Charlet wrote:

2016-07-30 Andris Pavenis <andris.pave...@iki.fi>

* ada/gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS): Define for
DJGPP target
   (EH_MECHANISM): Define to -gcc for DJGPP
* ada/system-djgpp.ads: New file

Andris
+++ b/gcc/ada/system-djgpp.ads
@@ -0,0 +1,148 @@
+--

+--  --
+--GNAT RUN-TIME COMPONENTS  --
+--  --
+--   S Y S T E M--
+--  --
+-- S p e c  --
+--(DJGPP Version) --

Wrong formatting here.

Fixed



+--  --
+--  Copyright (C) 1992-2015, Free Software Foundation, Inc. --

Wrong copyright here.


Also fixed. New patch is in attachment.

Andris



>From 3cfe377c3d5b798e39209518ebdf15752818e5ee Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sun, 21 Aug 2016 13:30:10 +0300
Subject: [PATCH 3/4] [DJGPP, Ada] DJGPP support

* ada/gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS): Define for DJGPP target
  (EH_MECHANISM): Define to -gcc for DJGPP
* ada/system-djgpp.ads: New file
---
 gcc/ada/gcc-interface/Makefile.in |  17 +
 gcc/ada/system-djgpp.ads  | 148 ++
 2 files changed, 165 insertions(+)
 create mode 100644 gcc/ada/system-djgpp.ads

diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 0df7f89..dcb7c93 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1773,6 +1773,23 @@ ifeq ($(strip $(filter-out elf eabi eabispe,$(target_os))),)
   indepsw.adbhttp://www.gnu.org/licenses/>.  --
+--  --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.  --
+--  --
+--
+
+package System is
+   pragma Pure;
+   --  Note that we take advantage of the implementation permission to make
+   --  this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
+   --  2005, this is Pure in any case (AI-362).
+
+   pragma No_Elaboration_Code_All;
+   --  Allow the use of that restriction in units that WITH this unit
+
+   type Name is (SYSTEM_NAME_GNAT);
+   System_Name : constant Name := SYSTEM_NAME_GNAT;
+
+   --  System-Dependent Named Numbers
+
+   Min_Int   : constant := Long_Long_Integer'First;
+   Max_Int   : constant := Long_Long_Integer'Last;
+
+   Max_Binary_Modulus: constant := 2 ** Long_Long_Integer'Size;
+   Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
+
+   Max_Base_Digits   : constant := Long_Long_Float'Digits;
+   Max_Digits: constant := Long_Long_Float'Digits;
+
+   Max_Mantissa  : constant := 63;
+   Fine_Delta: constant := 2.0 ** (-Max_Mantissa);
+
+   Tick  : constant := 0.01;
+
+   --  Storage-related Declarations
+
+   type Address is private;
+   pragma Preelaborable_Initialization (Address);
+   Null_Address : constant Address;
+
+   Storage_Unit : constant := 8;
+   Word_Size: constant := 32;
+   Memory_Size  : constant := 2 ** 32;
+
+   --  Address comparison
+
+   function "<"  (Left, Right : Address) return Boolean;
+   function "<=" (Left, Right : Address) return Boolean;
+   function ">"  (Left, Right : Address) return Boolean;
+   function ">=" (Left, Right : Address) return Boolean;
+   function "="  (Left, Right : Address) return Boolean;
+
+   pragma Import (Intrinsic, "<");
+   pragma Import (Intrinsic, "<=");
+   pragma Import (Intrinsic, ">");
+   pragma Import (Intrinsic, ">=");
+   pragma Import (Intrinsic, "=");
+
+   --  Other System-Dependent Declarations
+
+   type Bit_Order is (High_Order_First, Low_Order_First);
+   Default_Bit_Order : constant Bit_Order := Low_Order_First;
+   pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
+
+   --  Priority-related Declarations (RM D.1)
+
+   Max_Priority   : constant Positive := 30;
+   Max_Interrupt_Priority : constant Positive := 31;
+
+   subtype Any_Priority   is Integer  range  0 .. 31;
+   su

Re: [PATCH 2/4][Ada,DJGPP] Ada support for DJGPP

2016-08-21 Thread Andris Pavenis

On 08/18/2016 12:40 PM, Arnaud Charlet wrote:

This patch (2nd of 4) includes various changes to Ada related C files
required for DJGPP support

ChangeLog entry:

2016-07-30 Andris Pavenis <andris.pave...@iki.fi>

 * ada/ctrl_c.c: Do not use macro SA_RESTART for DJGPP.

 * ada/gsocket.h: Do not support sockets for DJGPP.

 * ada/init.c (timestruct_t): Define for DJGPP.
   (nanosleep): Implement for DJGPP using usleep().

Why do you need to define nanosleep() here? I suspect this is no longer
needed. If it is, would be good to know why.

Arno


Thanks for notice. It is really no more needed.

Updated patch is in attachment. New changelog entry is also there

Andris




>From 6cf25bcc18b4c0b8945af55bb1d9d0719f7ee8a8 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sun, 21 Aug 2016 11:15:11 +0300
Subject: [PATCH 2/4] [DJGPP, Ada] DJGPP support

* ada/ctrl_c.c: Do not use macro SA_RESTART for DJGPP.

* ada/gsocket.h: Do not support sockets for DJGPP.

* ada/init.c (__gnat_install_handler): Implement for DJGPP

* ada/sysdep.c: Include  for DJGPP
  (_setmode): Define to setmode for DJGPP
  (__gnat_set_mode): Add implementation for DJGPP
  (__gnat_localtime_tzoff): Add implementation for DJGPP

* ada/terminals.c: Add DJGPP to list of unsupported platforms.
---
 gcc/ada/ctrl_c.c|  4 ++--
 gcc/ada/gsocket.h   |  2 +-
 gcc/ada/init.c  |  8 
 gcc/ada/sysdep.c| 56 +++--
 gcc/ada/terminals.c |  2 +-
 5 files changed, 66 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/ctrl_c.c b/gcc/ada/ctrl_c.c
index 7f8d177..d4fc551 100644
--- a/gcc/ada/ctrl_c.c
+++ b/gcc/ada/ctrl_c.c
@@ -92,8 +92,8 @@ __gnat_install_int_handler (void (*proc) (void))
   if (sigint_intercepted == 0)
 {
   act.sa_handler = __gnat_int_handler;
-#if defined (__Lynx__) || defined (VMS)
-  /* LynxOS and VMS do not support SA_RESTART. */
+#if defined (__Lynx__) || defined (VMS) || defined(__DJGPP__)
+  /* LynxOS, VMS or DJGPP do not support SA_RESTART. */
   act.sa_flags = 0;
 #else
   act.sa_flags = SA_RESTART;
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index 31a3ccf..a979d3a 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -29,7 +29,7 @@
  *  *
  /
 
-#if defined(VTHREADS) || defined(__PikeOS__)
+#if defined(VTHREADS) || defined(__PikeOS__) || defined(__DJGPP__)
 
 /* Sockets not supported on these platforms.  */
 #undef HAVE_SOCKETS
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 6d51896..cec968b 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -2516,6 +2516,14 @@ __gnat_install_handler (void)
   __gnat_handler_installed = 1;
 }
 
+#elif defined (__DJGPP__)
+
+void
+__gnat_install_handler ()
+{
+  __gnat_handler_installed = 1;
+}
+
 #elif defined(__ANDROID__)
 
 /***/
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index 465007e..bfabf30 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -126,7 +126,7 @@ extern struct tm *localtime_r(const time_t *, struct tm *);
 
 */
 
-#if defined (WINNT) || defined (__CYGWIN__)
+#if defined (WINNT) || defined (__CYGWIN__) || defined(__DJGPP__)
 
 const char __gnat_text_translation_required = 1;
 
@@ -137,6 +137,11 @@ const char __gnat_text_translation_required = 1;
 #define WIN_SETMODE _setmode
 #endif
 
+#if defined(__DJGPP__)
+#include 
+#define _setmode setmode
+#endif /* __DJGPP__ */
+
 void
 __gnat_set_binary_mode (int handle)
 {
@@ -149,6 +154,30 @@ __gnat_set_text_mode (int handle)
   WIN_SETMODE (handle, O_TEXT);
 }
 
+#ifdef __DJGPP__
+void
+__gnat_set_mode (int handle, int mode)
+{
+  /*  the values here must be synchronized with
+  System.File_Control_Block.Content_Encodding:
+
+  None = 0
+  Default_Text = 1
+  Text = 2
+  U8text   = 3
+  Wtext= 4
+  U16text  = 5  */
+
+ switch (mode) {
+case 0 : setmode(handle, O_BINARY);  break;
+case 1 : setmode(handle, O_TEXT);break;
+case 2 : setmode(handle, O_TEXT);break;
+case 3 : setmode(handle, O_TEXT);break;
+case 4 : setmode(handle, O_BINARY);  break;
+case 5 : setmode(handle, O_BINARY);  break;
+ }
+}
+#else
 void
 __gnat_set_mode (int handle, int mode)
 {
@@ -171,6 +200,7 @@ __gnat_set_mode (int handle, int mode)
 case 5 : WIN_SETMODE (handle, _O_U16TEXT); break;
  }
 }
+#endif
 
 #ifdef __CYGWIN__
 
@@ -603,7 +633,29 @@ long __gnat_invalid_tzoff = 259273;
 
 /* Definition of __gnat_localtime_r used by a-calend.adb */
 
-#if defined (__MINGW32__)
+#if defined (__DJGPP__)
+
+/* FIXME: this is draft version only. Fix me if that is not correct  */
+/*or not complete (AP)   */
+
+extern void
+__gnat_localtime_tzoff (const

Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP

2016-08-16 Thread Andris Pavenis

On 08/15/2016 11:27 AM, Eric Botcazou wrote:

Both '/' and '\' must be supported as directory separators. So
DIR_SEPARATOR='/' is not OK in this case.

Understood.
  

Unconditional converting '/' to '\' in case of DJGPP native build causes
gnatmake to break. Retested it today it with gcc-6.1.0. The problem is that
special directory name /dev/env/DJDIR is used as prefix for DJGPP (it
resolves to $DJDIR in execution time)

So it's only because of the /dev/ thing, i.e. this would work without it?  If
so, can we restrict the special-casing to this block of code?

   --  Replace all '/' by Directory Separators (this is for Windows)

   if Directory_Separator /= '/' then
  for Index in 1 .. End_Path loop
 if Path_Buffer (Index) = '/' then
Path_Buffer (Index) := Directory_Separator;
 end if;
  end loop;
   end if;

IOW, can we disable it for the /dev/ thing and leave the rest untouched?
Since DIR_SEPARATOR=='\', the block immediately below will be disabled too.

Some more study shows that smaller patch (attached) is sufficient. There is no harm from 
pre-pending drive letter (like 'c:'). Specifying '\dev\' do not however work. Disabling conversion 
for '/dev/' alone would influence Windows port as such directory name is OK for Windows.


Updated changelog entry is inside the attachment.

Andris


>From d746c4fa913a2eca6f1d93b614fd0aa908cfd13a Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Tue, 16 Aug 2016 06:15:57 +0300
Subject: [PATCH 1/4] [DJGPP, Ada] File path handling for DJGPP host

* ada/adaint.c (__gnat_is_djgpp): define (1 for DJGPP host, 0 otherwise).
* ada/s-os_lib.ads (Is_Djgpp): import __gnat_is_djgpp as constant.
* ada/s-os_lib.adb (Normalize_Pathname): do not convert '/' to '\' for DJGPP host
---
 gcc/ada/adaint.c | 6 ++
 gcc/ada/s-os_lib.adb | 5 -
 gcc/ada/s-os_lib.ads | 3 +++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index e011fef..f317865 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -226,6 +226,12 @@ char __gnat_dir_separator = DIR_SEPARATOR;
 
 char __gnat_path_separator = PATH_SEPARATOR;
 
+#ifdef __DJGPP__
+int __gnat_is_djgpp = 1;
+#else
+int __gnat_is_djgpp = 0;
+#endif
+
 /* The GNAT_LIBRARY_TEMPLATE contains a list of expressions that define
the base filenames that libraries specified with -lsomelib options
may have. This is used by GNATMAKE to check whether an executable
diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb
index 31b2f08..21173db 100644
--- a/gcc/ada/s-os_lib.adb
+++ b/gcc/ada/s-os_lib.adb
@@ -2242,8 +2242,11 @@ package body System.OS_Lib is
   end File_Name_Conversion;
 
   --  Replace all '/' by Directory Separators (this is for Windows)
+  --  No need to do that however for DJGPP
 
-  if Directory_Separator /= '/' then
+  if Directory_Separator /= '/'
+and then Is_Djgpp = 0
+  then
  for Index in 1 .. End_Path loop
 if Path_Buffer (Index) = '/' then
Path_Buffer (Index) := Directory_Separator;
diff --git a/gcc/ada/s-os_lib.ads b/gcc/ada/s-os_lib.ads
index 9004874..5c8bfe2 100644
--- a/gcc/ada/s-os_lib.ads
+++ b/gcc/ada/s-os_lib.ads
@@ -1068,9 +1068,12 @@ package System.OS_Lib is
Path_Separator : constant Character;
--  The character to separate paths in an environment variable value
 
+   Is_Djgpp : constant Integer;
+
 private
pragma Import (C, Path_Separator, "__gnat_path_separator");
pragma Import (C, Directory_Separator, "__gnat_dir_separator");
+   pragma Import (C, Is_Djgpp, "__gnat_is_djgpp");
pragma Import (C, Current_Time, "__gnat_current_time");
pragma Import (C, Current_Process_Id, "__gnat_current_process_id");
 
-- 
2.7.4



Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP

2016-08-13 Thread Andris Pavenis

On 08/12/2016 07:18 PM, Eric Botcazou wrote:

2016-07-30 Andris Pavenis <andris.pave...@iki.fi>

  * ada/adaint.c (__gnat_is_djgpp): define (1 for DJGPP host, 0
otherwise). * ada/s-os_lib.ads (Is_Djgpp): import __gnat_is_djgpp as
constant. * ada/s-os_lib.adb (Normalize_Pathname): support DJGPP special
paths (/dev/*) for DJGPP hosts

The patch does more than this though:

Updated ChangeLog entry:

Subject: [PATCH 1/4] [DJGPP, Ada] File path handling for DJGPP host

* ada/adaint.c (__gnat_is_djgpp): define (1 for DJGPP host, 0 otherwise).
* ada/s-os_lib.ads (Is_Djgpp): import __gnat_is_djgpp as constant.
* ada/s-os_lib.adb (Normalize_Pathname): support DJGPP special paths (/dev/*) 
for DJGPP hosts,
 (Normalize_Pathname): do not convert '/' to '\' for DJGPP hosts.




@@ -2242,8 +2271,11 @@ package body System.OS_Lib is
end File_Name_Conversion;
  
--  Replace all '/' by Directory Separators (this is for Windows)

+  --  No need to do that however for DJGPP
  
-  if Directory_Separator /= '/' then

+  if Directory_Separator /= '/'
+and then Is_Djgpp = 0
+  then
   for Index in 1 .. End_Path loop
  if Path_Buffer (Index) = '/' then
 Path_Buffer (Index) := Directory_Separator;

Why does DJGPP need to be special-cased here?  In order to disable some
further transformation downstream?  Could DIR_SEPARATOR be just '/'?

Both '/' and '\' must be supported as directory separators. So DIR_SEPARATOR='/' is not OK in this 
case.


Unconditional converting '/' to '\' in case of DJGPP native build causes gnatmake to break. 
Retested it today it with gcc-6.1.0. The problem is that special directory name /dev/env/DJDIR is 
used as prefix for DJGPP (it resolves to $DJDIR in execution time)


Andris

PS. Maybe it could be nicer if Normalize_Pathname would be in a separate package. This way one 
could override it for all targets for which special handling is needed.








Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP

2016-07-31 Thread Andris Pavenis

On 07/31/2016 10:57 AM, Arnaud Charlet wrote:

Frankly at this stage, I do not think it makes sense to maintain an
Ada port for DJGPP and in particular maintain all these extra
special cases and #ifdefs.

I don't think this is a reasonable attitude to take with people who
are willing to do the work to do it.

OK, let me reformulate my comments and questions then:

- can you (Andris) clarify what usage you are/will be doing with this port?
I'm providing packages of DJGPP port of GCC already since gcc-2.8.1 including also Ada compiler 
since gcc-3.2. Required changes were maintained outside official GCC source tree for a long time. 
That required both merge conflicts and port breakages to be handled due to  upstream sources 
development related changes. I myself am not using Ada otherwise. As result It is difficult to say 
how many are actually using it as everybody who wants it can freely download binary packages from 
DJGPP distribution. At least related asking in DJGPP mailing list showed that the number is not 0. 
One do not however need to subscribed to that list to download and use packages.


Also amount of changes required for port of Ada compiler was considerably decreased since dropping 
support of old DJGPP v.203.




- are you volunterring to regularly test this port and maintain it
I have already done it with changes outside official source tree for a rather long time. Having 
changes in will make this maintenance easier.

(e.g.
   fix breakage)

"Doing the work" isn't a one shot thing, it's a long term commitment, so it
better be worth it as you said yourself.

Andris



[PATCH 4/4][Ada,DJGPP] Ada support for DJGPP

2016-07-29 Thread Andris Pavenis
This last patch (4/4) contains DJGPP related changes to adaint.c (except one which belongs to patch 
1/4).


ChangeLog entry:

2016-07-30 Andris Pavenis <andris.pave...@iki.fi>

* ada/adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
  (DIR_SEPARATOR) define to '\\' for DJGPP.
  (__gnat_get_maximum_file_name_length): decide return value depending on
  availability of LFN for DJGPP
  (__gnat_get_file_names_case_sensitive): return 0 for DJGPP unless
  overriden in environment
  (__gnat_get_default_identifier_character_set): return '1' for DJGPP
  (__gnat_is_absolute_path): Support MS-DOS style absolute paths for DJGPP.
  (__gnat_portable_spawn): Use spewnvp for DJGPP.
  (__gnat_portable_no_block_spawn): Use spawnvp for DJGPP.
  (__gnat_portable_wait): Return 0 for DJGPP.


Andris


>From 3f96c997eb087c5ee4b90d706919074e36ee9927 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Mon, 25 Jul 2016 20:08:26 +0300
Subject: [PATCH 4/4] [DJGPP, Ada] DJGPP support

* ada/adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
  (DIR_SEPARATOR) define to '\\' for DJGPP.
  (__gnat_get_maximum_file_name_length): decide return value depending on
  availability of LFN for DJGPP
  (__gnat_get_file_names_case_sensitive): return 0 for DJGPP unless
  overriden in environment
  (__gnat_get_default_identifier_character_set): return '1' for DJGPP
  (__gnat_is_absolute_path): Support MS-DOS style absolute paths for DJGPP.
  (__gnat_portable_spawn): Use spewnvp for DJGPP.
  (__gnat_portable_no_block_spawn): Use spawnvp for DJGPP.
  (__gnat_portable_wait): Return 0 for DJGPP.



Signed-off-by: Andris Pavenis <andris.pave...@iki.fi>
---
 gcc/ada/adaint.c | 32 ++--
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index f317865..1658acf 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -165,11 +165,16 @@ UINT CurrentCCSEncoding;
 #include 
 #endif
 
-#if defined (_WIN32)
-
+#if defined (__DJGPP__)
 #include 
 #include 
 #include 
+#include 
+#undef DIR_SEPARATOR
+#define DIR_SEPARATOR '\\'
+
+#elif defined (_WIN32)
+
 #include 
 #include 
 #include 
@@ -538,7 +543,11 @@ __gnat_try_lock (char *dir, char *file)
 int
 __gnat_get_maximum_file_name_length (void)
 {
+#if defined (__DJGPP__)
+  return (_use_lfn(".")) ? -1 : 8;
+#else
   return -1;
+#endif
 }
 
 /* Return nonzero if file names are case sensitive.  */
@@ -560,7 +569,7 @@ __gnat_get_file_names_case_sensitive (void)
 	{
 	  /* By default, we suppose filesystems aren't case sensitive on
 	 Windows and Darwin (but they are on arm-darwin).  */
-#if defined (WINNT) \
+#if defined (WINNT) || defined (__DJGPP__) \
   || (defined (__APPLE__) && !(defined (__arm__) || defined (__arm64__)))
 	  file_names_case_sensitive_cache = 0;
 #else
@@ -576,7 +585,7 @@ __gnat_get_file_names_case_sensitive (void)
 int
 __gnat_get_env_vars_case_sensitive (void)
 {
-#if defined (WINNT)
+#if defined (WINNT) || defined (__DJGPP__)
  return 0;
 #else
  return 1;
@@ -586,7 +595,11 @@ __gnat_get_env_vars_case_sensitive (void)
 char
 __gnat_get_default_identifier_character_set (void)
 {
+#if defined (__DJGPP__)
+  return 'p';
+#else
   return '1';
+#endif
 }
 
 /* Return the current working directory.  */
@@ -1646,7 +1659,7 @@ __gnat_is_absolute_path (char *name, int length)
 #else
   return (length != 0) &&
  (*name == '/' || *name == DIR_SEPARATOR
-#if defined (WINNT)
+#if defined (WINNT) || defined(__DJGPP__)
   || (length > 1 && ISALPHA (name[0]) && name[1] == ':')
 #endif
 	  );
@@ -2234,7 +2247,7 @@ __gnat_portable_spawn (char *args[] ATTRIBUTE_UNUSED)
 #if defined (__vxworks) || defined(__PikeOS__)
   return -1;
 
-#elif defined (_WIN32)
+#elif defined (__DJGPP__) || defined (_WIN32)
   /* args[0] must be quotes as it could contain a full pathname with spaces */
   char *args_0 = args[0];
   args[0] = (char *)xmalloc (strlen (args_0) + 3);
@@ -2606,6 +2619,12 @@ __gnat_portable_no_block_spawn (char *args[] ATTRIBUTE_UNUSED)
   /* Not supported.  */
   return -1;
 
+#elif defined(__DJGPP__)
+  if (spawnvp (P_WAIT, args[0], args) != 0)
+return -1;
+  else
+return 0;
+
 #elif defined (_WIN32)
 
   HANDLE h = NULL;
@@ -2649,6 +2668,7 @@ __gnat_portable_wait (int *process_status)
 
   pid = win32_wait ();
 
+#elif defined (__DJGPP__)
 #else
 
   pid = waitpid (-1, , 0);
-- 
2.7.4




[PATCH 3/4][Ada,DJGPP] Ada support for DJGPP

2016-07-29 Thread Andris Pavenis
This patch (3rd of 4) contains changes to gcc-interface/Makefile.in and DJGPP own implementation of 
system.ads.


ChangeLog entry:

2016-07-30 Andris Pavenis <andris.pave...@iki.fi>

* ada/gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS): Define for DJGPP target
  (EH_MECHANISM): Define to -gcc for DJGPP
* ada/system-djgpp.ads: New file

Andris


>From f1141f462de62c22fa6edde0a9f90ad78a7d6cd2 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Mon, 25 Jul 2016 19:41:04 +0300
Subject: [PATCH 3/4] [DJGPP, Ada] DJGPP support

* ada/gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS): Define for DJGPP target
  (EH_MECHANISM): Define to -gcc for DJGPP
* ada/system-djgpp.ads: New file
---
 gcc/ada/gcc-interface/Makefile.in |  17 +
 gcc/ada/system-djgpp.ads  | 148 ++
 2 files changed, 165 insertions(+)
 create mode 100644 gcc/ada/system-djgpp.ads

diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 0df7f89..dcb7c93 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1773,6 +1773,23 @@ ifeq ($(strip $(filter-out elf eabi eabispe,$(target_os))),)
   indepsw.adbhttp://www.gnu.org/licenses/>.  --
+--  --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.  --
+--  --
+--
+
+package System is
+   pragma Pure;
+   --  Note that we take advantage of the implementation permission to make
+   --  this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
+   --  2005, this is Pure in any case (AI-362).
+
+   pragma No_Elaboration_Code_All;
+   --  Allow the use of that restriction in units that WITH this unit
+
+   type Name is (SYSTEM_NAME_GNAT);
+   System_Name : constant Name := SYSTEM_NAME_GNAT;
+
+   --  System-Dependent Named Numbers
+
+   Min_Int   : constant := Long_Long_Integer'First;
+   Max_Int   : constant := Long_Long_Integer'Last;
+
+   Max_Binary_Modulus: constant := 2 ** Long_Long_Integer'Size;
+   Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
+
+   Max_Base_Digits   : constant := Long_Long_Float'Digits;
+   Max_Digits: constant := Long_Long_Float'Digits;
+
+   Max_Mantissa  : constant := 63;
+   Fine_Delta: constant := 2.0 ** (-Max_Mantissa);
+
+   Tick  : constant := 0.01;
+
+   --  Storage-related Declarations
+
+   type Address is private;
+   pragma Preelaborable_Initialization (Address);
+   Null_Address : constant Address;
+
+   Storage_Unit : constant := 8;
+   Word_Size: constant := 32;
+   Memory_Size  : constant := 2 ** 32;
+
+   --  Address comparison
+
+   function "<"  (Left, Right : Address) return Boolean;
+   function "<=" (Left, Right : Address) return Boolean;
+   function ">"  (Left, Right : Address) return Boolean;
+   function ">=" (Left, Right : Address) return Boolean;
+   function "="  (Left, Right : Address) return Boolean;
+
+   pragma Import (Intrinsic, "<");
+   pragma Import (Intrinsic, "<=");
+   pragma Import (Intrinsic, ">");
+   pragma Import (Intrinsic, ">=");
+   pragma Import (Intrinsic, "=");
+
+   --  Other System-Dependent Declarations
+
+   type Bit_Order is (High_Order_First, Low_Order_First);
+   Default_Bit_Order : constant Bit_Order := Low_Order_First;
+   pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
+
+   --  Priority-related Declarations (RM D.1)
+
+   Max_Priority   : constant Positive := 30;
+   Max_Interrupt_Priority : constant Positive := 31;
+
+   subtype Any_Priority   is Integer  range  0 .. 31;
+   subtype Priority   is Any_Priority range  0 .. 30;
+   subtype Interrupt_Priority is Any_Priority range 31 .. 31;
+
+   Default_Priority : constant Priority := 15;
+
+private
+
+   type Address is mod Memory_Size;
+   Null_Address : constant Address := 0;
+
+   --
+   -- System Implementation Parameters --
+   --
+
+   --  These parameters provide information about the target that is used
+   --  by the compiler. They are in the private part of System, where they
+   --  can be accessed using the special circuitry in the Targparm unit
+   --  whose source should be consulted for more detailed descriptions
+   --  of the individual switch values.
+
+   Backend_Divide_Checks : constant Boolean := False;
+   Backend_Overflow_Checks   : constant Boolean := True;
+   Command_Line_Args  

[PATCH 1/4][Ada,DJGPP] Ada support for DJGPP

2016-07-29 Thread Andris Pavenis

This is first of 4 patches for DJGPP support of Ada compiler

Patch adds support of handling DJGPP special paths which do not follow normal 
DOS file-name rules.

Some details about handled DJGPP special pathnames: for example '/dev/c/foo' is interpreted as 
'c:/foo', '/dev/env/DJDIR/include' is interpreted as $DJDIR/include. Adding drive prefix (like 
c:/dev/c/foo) is not supported for these special path-names.


ChangeLog entry:

2016-07-30 Andris Pavenis <andris.pave...@iki.fi>

* ada/adaint.c (__gnat_is_djgpp): define (1 for DJGPP host, 0 otherwise).
* ada/s-os_lib.ads (Is_Djgpp): import __gnat_is_djgpp as constant.
* ada/s-os_lib.adb (Normalize_Pathname): support DJGPP special paths 
(/dev/*) for DJGPP hosts

Andris



>From ecf2e5463c56c5221107090288b2990584cd4bfb Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sat, 30 Jul 2016 08:01:45 +0300
Subject: [PATCH 1/4] [DJGPP, Ada] File path handling for DJGPP host

* ada/adaint.c (__gnat_is_djgpp): define (1 for DJGPP host, 0 otherwise).
* ada/s-os_lib.ads (Is_Djgpp): import __gnat_is_djgpp as constant.
* ada/s-os_lib.adb (Normalize_Pathname): support DJGPP special paths (/dev/*) for DJGPP hosts
---
 gcc/ada/adaint.c |  6 ++
 gcc/ada/s-os_lib.adb | 35 ++-
 gcc/ada/s-os_lib.ads |  3 +++
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index e011fef..f317865 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -226,6 +226,12 @@ char __gnat_dir_separator = DIR_SEPARATOR;
 
 char __gnat_path_separator = PATH_SEPARATOR;
 
+#ifdef __DJGPP__
+int __gnat_is_djgpp = 1;
+#else
+int __gnat_is_djgpp = 0;
+#endif
+
 /* The GNAT_LIBRARY_TEMPLATE contains a list of expressions that define
the base filenames that libraries specified with -lsomelib options
may have. This is used by GNATMAKE to check whether an executable
diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb
index 31b2f08..73bc2db 100644
--- a/gcc/ada/s-os_lib.adb
+++ b/gcc/ada/s-os_lib.adb
@@ -2069,6 +2069,13 @@ package body System.OS_Lib is
  not Case_Sensitive
and then Get_File_Names_Case_Sensitive = 0;
 
+  function Is_Directory_Separator (C : Character) return Boolean;
+  --  Test whether provided character is directory separator
+
+  function Is_Djgpp_Special_Path (Path : String) return Boolean;
+  --  Test whether provided path is DJGPP special path (/dev/...).
+  --  Returns false in all other cases also when not DJGPP.
+
   function Final_Value (S : String) return String;
   --  Make final adjustment to the returned string. This function strips
   --  trailing directory separators, and folds returned string to lower
@@ -2079,6 +2086,28 @@ package body System.OS_Lib is
   --  if not already present, otherwise return current working directory
   --  with terminating directory separator.
 
+  
+  -- Is_Directory_Separator --
+  
+
+  function Is_Directory_Separator (C : Character) return Boolean is
+  begin
+ return C = '/'
+   or else C = Directory_Separator;
+  end Is_Directory_Separator;
+
+  ---
+  -- Is_Djgpp_Special_Path --
+  ---
+
+  function Is_Djgpp_Special_Path (Path : String) return Boolean is
+  begin
+ return Is_Djgpp /= 0
+   and then Is_Directory_Separator (Path (Path'First))
+   and then Path (Path'First + 1 .. Path'First + 3) = "dev"
+   and then Is_Directory_Separator (Path (Path'First + 4));
+  end Is_Djgpp_Special_Path;
+
   -
   -- Final_Value --
   -
@@ -2242,8 +2271,11 @@ package body System.OS_Lib is
   end File_Name_Conversion;
 
   --  Replace all '/' by Directory Separators (this is for Windows)
+  --  No need to do that however for DJGPP
 
-  if Directory_Separator /= '/' then
+  if Directory_Separator /= '/'
+and then Is_Djgpp = 0
+  then
  for Index in 1 .. End_Path loop
 if Path_Buffer (Index) = '/' then
Path_Buffer (Index) := Directory_Separator;
@@ -2264,6 +2296,7 @@ package body System.OS_Lib is
 
  if Path_Buffer (1) = Directory_Separator
and then Path_Buffer (2) /= Directory_Separator
+   and then not Is_Djgpp_Special_Path (Path_Buffer)
  then
 declare
Cur_Dir : constant String := Get_Directory ("");
diff --git a/gcc/ada/s-os_lib.ads b/gcc/ada/s-os_lib.ads
index 9004874..5c8bfe2 100644
--- a/gcc/ada/s-os_lib.ads
+++ b/gcc/ada/s-os_lib.ads
@@ -1068,9 +1068,12 @@ package System.OS_Lib is
Path_Separator : constant Character;
--  The character to separate paths in an environment variable value
 
+   Is_Djgpp : cons

[PATCH 2/4][Ada,DJGPP] Ada support for DJGPP

2016-07-29 Thread Andris Pavenis

This patch (2nd of 4) includes various changes to Ada related C files required 
for DJGPP support

ChangeLog entry:

2016-07-30 Andris Pavenis <andris.pave...@iki.fi>

* ada/ctrl_c.c: Do not use macro SA_RESTART for DJGPP.

* ada/gsocket.h: Do not support sockets for DJGPP.

* ada/init.c (timestruct_t): Define for DJGPP.
  (nanosleep): Implement for DJGPP using usleep().
  (__gnat_install_handler): Implememt for DJGPP

* ada/sysdep.c: Include  for DJGPP
  (_setmode): Define to setmode for DJGPP
  (__gnat_set_mode): Add implementation for DJGPP
  (__gnat_localtime_tzoff): Add implementation for DJGPP

* ada/terminals.c: Add DJGPP to list of unsupported platforms.


Andris


>From 935f11dbb31a46358a5927ad41cc6877683c13aa Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Mon, 25 Jul 2016 19:37:55 +0300
Subject: [PATCH 2/4] [DJGPP, Ada] DJGPP support

* ada/ctrl_c.c: Do not use macro SA_RESTART for DJGPP.

* ada/gsocket.h: Do not support sockets for DJGPP.

* ada/init.c (timestruct_t): Define for DJGPP.
  (nanosleep): Implement for DJGPP using usleep().
  (__gnat_install_handler): Implememt for DJGPP

* ada/sysdep.c: Include  for DJGPP
  (_setmode): Define to setmode for DJGPP
  (__gnat_set_mode): Add implementation for DJGPP
  (__gnat_localtime_tzoff): Add implementation for DJGPP

* ada/terminals.c: Add DJGPP to list of unsupported platforms.
---
 gcc/ada/ctrl_c.c|  4 ++--
 gcc/ada/gsocket.h   |  2 +-
 gcc/ada/init.c  | 25 
 gcc/ada/sysdep.c| 56 +++--
 gcc/ada/terminals.c |  2 +-
 5 files changed, 83 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/ctrl_c.c b/gcc/ada/ctrl_c.c
index 7f8d177..d4fc551 100644
--- a/gcc/ada/ctrl_c.c
+++ b/gcc/ada/ctrl_c.c
@@ -92,8 +92,8 @@ __gnat_install_int_handler (void (*proc) (void))
   if (sigint_intercepted == 0)
 {
   act.sa_handler = __gnat_int_handler;
-#if defined (__Lynx__) || defined (VMS)
-  /* LynxOS and VMS do not support SA_RESTART. */
+#if defined (__Lynx__) || defined (VMS) || defined(__DJGPP__)
+  /* LynxOS, VMS or DJGPP do not support SA_RESTART. */
   act.sa_flags = 0;
 #else
   act.sa_flags = SA_RESTART;
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index 31a3ccf..a979d3a 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -29,7 +29,7 @@
  *  *
  /
 
-#if defined(VTHREADS) || defined(__PikeOS__)
+#if defined(VTHREADS) || defined(__PikeOS__) || defined(__DJGPP__)
 
 /* Sockets not supported on these platforms.  */
 #undef HAVE_SOCKETS
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 6d51896..eed212c 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -2516,6 +2516,31 @@ __gnat_install_handler (void)
   __gnat_handler_installed = 1;
 }
 
+#elif defined (__DJGPP__)
+
+struct timestruc_t
+{
+   time_t  tv_sec;
+   longtv_nsec;
+};
+
+int
+nanosleep (struct timestruc_t *Rqtp, struct timestruc_t *Rmtp);
+
+int
+nanosleep (struct timestruc_t *Rqtp, struct timestruc_t *Rmtp)
+{
+usleep (100*Rqtp->tv_sec+Rqtp->tv_nsec/1000);
+if (Rmtp) { Rmtp->tv_sec = Rmtp->tv_nsec=0; }
+return 0;
+}
+
+void
+__gnat_install_handler ()
+{
+  __gnat_handler_installed = 1;
+}
+
 #elif defined(__ANDROID__)
 
 /***/
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index 465007e..bfabf30 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -126,7 +126,7 @@ extern struct tm *localtime_r(const time_t *, struct tm *);
 
 */
 
-#if defined (WINNT) || defined (__CYGWIN__)
+#if defined (WINNT) || defined (__CYGWIN__) || defined(__DJGPP__)
 
 const char __gnat_text_translation_required = 1;
 
@@ -137,6 +137,11 @@ const char __gnat_text_translation_required = 1;
 #define WIN_SETMODE _setmode
 #endif
 
+#if defined(__DJGPP__)
+#include 
+#define _setmode setmode
+#endif /* __DJGPP__ */
+
 void
 __gnat_set_binary_mode (int handle)
 {
@@ -149,6 +154,30 @@ __gnat_set_text_mode (int handle)
   WIN_SETMODE (handle, O_TEXT);
 }
 
+#ifdef __DJGPP__
+void
+__gnat_set_mode (int handle, int mode)
+{
+  /*  the values here must be synchronized with
+  System.File_Control_Block.Content_Encodding:
+
+  None = 0
+  Default_Text = 1
+  Text = 2
+  U8text   = 3
+  Wtext= 4
+  U16text  = 5  */
+
+ switch (mode) {
+case 0 : setmode(handle, O_BINARY);  break;
+case 1 : setmode(handle, O_TEXT);break;
+case 2 : setmode(handle, O_TEXT);break;
+case 3 : setmode(handle, O_TEXT);break;
+case 4 : setmode(handle, O_BINARY);  break;
+case 5 : setmode(handle, O_BINARY);  break;
+ }
+}
+#else
 void
 __gnat_set_mode (int handle, int mode)
 {
@@ -171,6 +200,7 @@ __gnat_set_mode (int ha

[PATCH, libstdc++-v3] Fix import of wide character related symbols in stdlib.h wraper

2016-01-25 Thread Andris Pavenis

include/c_compatibility/stdlib.h imports wide character related symbols
into global namespace unconditionaly which causes libstdc++-v3 build
to fail when one or both of _GLIBCXX_USE_WCHAR_T and _GLIBCXX_HAVE_MBSTATE_T
are not defined.

Included patch changes it to import them into global namespace only
when they are defined in cstdlib

Andris

2016-01-26  Andris Pavenis  <andris.pave...@iki.fi>

* include/c_compatibility/stdlib.h: Include wide character related
definitions only when they are available in cstdlib.

>From 17778d89abe4f51f929806e67d2e2352b6b4376e Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Tue, 26 Jan 2016 06:24:48 +0200
Subject: [PATCH] [PATCH,libstdc++-v3] Fix use use wide character related
 symbols in stdlib.h wrapper

* include/c_compatibility/stdlib.h: include wide character related
definitions only when they are available in cstdlib
---
 libstdc++-v3/include/c_compatibility/stdlib.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/libstdc++-v3/include/c_compatibility/stdlib.h b/libstdc++-v3/include/c_compatibility/stdlib.h
index bd72580..31e7e5f 100644
--- a/libstdc++-v3/include/c_compatibility/stdlib.h
+++ b/libstdc++-v3/include/c_compatibility/stdlib.h
@@ -62,9 +62,11 @@ using std::getenv;
 using std::labs;
 using std::ldiv;
 using std::malloc;
+#ifdef _GLIBCXX_HAVE_MBSTATE_T
 using std::mblen;
 using std::mbstowcs;
 using std::mbtowc;
+#endif // _GLIBCXX_HAVE_MBSTATE_T
 using std::qsort;
 using std::rand;
 using std::realloc;
@@ -73,8 +75,10 @@ using std::strtod;
 using std::strtol;
 using std::strtoul;
 using std::system;
+#ifdef _GLIBCXX_USE_WCHAR_T
 using std::wcstombs;
 using std::wctomb;
+#endif // _GLIBCXX_USE_WCHAR_T
 #endif
 
 #endif
-- 
2.5.0



[PING][PATCH][DJGPP][libgfortran] Do not use S_ISVTX for DJGPP in libfortran/intrinsic/chmod.c

2016-01-16 Thread Andris Pavenis

Patch avoids using S_ISVTX if it is not defined.

https://gcc.gnu.org/ml/gcc-patches/2015-11/msg01899.html

Initial version of patch avoided it additionally for DJGPP 
(https://gcc.gnu.org/ml/gcc-patches/2015-11/msg01880.html)


Andris



[PING][PATCH 5/6] [DJGPP] gcc/config/i386: update DJGPP configuration related files

2016-01-11 Thread Andris Pavenis

I posted last version of patch where I took review comments into account
month ago:

https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01328.html

Andris





Re: [PATCH 6/6] [DJGPP] configure.ac: enable LTO

2016-01-08 Thread Andris Pavenis

On 01/09/2016 01:29 AM, Jeff Law wrote:

On 12/21/2015 11:22 PM, Andris Pavenis wrote:

12/21/2015, 10:00 PM, Jeff Law kirjoitti:

On 12/17/2015 10:51 PM, Andris Pavenis wrote:

On 12/13/2015 08:12 PM, DJ Delorie wrote:

You can list me as your sponsor.

I've been wanting him to be a djgpp target/host maintainer for
years anyway, so +1 from me :-)



Approved part of patches are in (except 6th which I commit after
5th)

In middle come a problem with mailing list (collected outgoing
patches in a batch and did not notice that I had written wrong
address). Noticed it only after sending when it was too late.

Is there anything in this series that still needs review?



Well. I understood that new version of patch could require new
approving. I comments about 5th patch which I took into account in new
patch version or responded. There were however no "OK for trunk" or
equivalent. Sorry if I'm too pedantic
No worries.  We're always happy when folks are conservative, particularly when they're just 
getting engaged with the community.


Can you post the updated #5 patch.  DJ or I will give it a final yes/no so that you can move 
forward.


It was actually already sent a month ago with comments corresponding review 
notices::

https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01328.html

Andris




[COMMITTED] Add myself to MAINTAINERS (Write After Approval)

2015-12-17 Thread Andris Pavenis

Just committed.revision 231774

Andris

Index: MAINTAINERS
===
--- MAINTAINERS (revision 231774)
+++ MAINTAINERS (working copy)
@@ -525,6 +525,7 @@
  Patrick Palka<ppa...@gcc.gnu.org>
  Seongbae Park<seongbae.p...@gmail.com>
  Devang Patel<dpa...@apple.com>
+Andris Pavenis<andris.pave...@iki.fi>
  Fernando Pereira<prone...@gmail.com>
  Kaushik Phatak<kaushik.pha...@kpitcummins.com>
  Nicolas Pitre<n...@cam.org>
Index: ChangeLog
===
--- ChangeLog   (revision 231774)
+++ ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2015-12-17  Andris Pavenis<andris.pave...@iki.fi>
+
+   * MAINTAINERS (Write After Approval): Add Myself.
+
  2015-12-17  Nathan Sidwell<nat...@acm.org>

 * config/isl.m4 (ISL_CHECK_VERSION): Add gmp libs.



Re: [PATCH 6/6] [DJGPP] configure.ac: enable LTO

2015-12-12 Thread Andris Pavenis

On 12/11/2015 12:32 AM, Jeff Law wrote:

On 12/05/2015 10:25 AM, Andris Pavenis wrote:

Patch enables LTO support for DJGPP in top level configure.ac

Andris

2015-12-05 Andris Pavenis <andris.pave...@iki.fi>

* configure.ac: enable LTO for *-*-msdosdjgpp
OK once prereqs have gone in.  Note you should to the autoconf dance to update the generated 
files.  Mention them in your ChangeLog as

* configure: Regenerated

jeff



Updated patch is in attachment.

Andris

PS. Somebody other should apply this and my other DJGPP related patches as I do not have SVN write 
access.


2015-12-05 Andris Pavenis <andris.pave...@iki.fi>

* configure.ac: Enable LTO for *-*-msdosdjgpp.
* configure: Regenerate.

>From d001fa0866e6bf1f4b879329841f7674f0e90eab Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sat, 12 Dec 2015 10:15:42 +0200
Subject: [PATCH 6/6] [DJGPP] configure.ac: enable LTO

---
 configure| 4 ++--
 configure.ac | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 090615f..0cde5a2 100755
--- a/configure
+++ b/configure
@@ -6122,7 +6122,7 @@ if test $target_elf = yes; then :
 else
   if test x"$default_enable_lto" = x"yes" ; then
 case $target in
-  *-apple-darwin9* | *-cygwin* | *-mingw*) ;;
+  *-apple-darwin9* | *-cygwin* | *-mingw* | *djgpp*) ;;
   # On other non-ELF platforms, LTO has yet to be validated.
   *) enable_lto=no ;;
 esac
@@ -6133,7 +6133,7 @@ else
   # warn during gcc/ subconfigure; unless you're bootstrapping with
   # -flto it won't be needed until after installation anyway.
 case $target in
-  *-cygwin* | *-mingw* | *-apple-darwin*) ;;
+  *-cygwin* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
   *) if test x"$enable_lto" = x"yes"; then
 	as_fn_error "LTO support is not enabled for this target." "$LINENO" 5
 fi
diff --git a/configure.ac b/configure.ac
index a6998ff..ee4fd23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1817,7 +1817,7 @@ ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
   build_lto_plugin=yes
 ],[if test x"$default_enable_lto" = x"yes" ; then
 case $target in
-  *-apple-darwin9* | *-cygwin* | *-mingw*) ;;
+  *-apple-darwin9* | *-cygwin* | *-mingw* | *djgpp*) ;;
   # On other non-ELF platforms, LTO has yet to be validated.
   *) enable_lto=no ;;
 esac
@@ -1828,7 +1828,7 @@ ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
   # warn during gcc/ subconfigure; unless you're bootstrapping with
   # -flto it won't be needed until after installation anyway.
 case $target in
-  *-cygwin* | *-mingw* | *-apple-darwin*) ;;
+  *-cygwin* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
   *) if test x"$enable_lto" = x"yes"; then
 	AC_MSG_ERROR([LTO support is not enabled for this target.])
 fi
-- 
2.5.0



Re: [PATCH 5/6] [DJGPP] gcc/config/i386: update DJGPP configuration related files

2015-12-12 Thread Andris Pavenis

On 12/11/2015 12:43 AM, Jeff Law wrote:

On 12/05/2015 10:22 AM, Andris Pavenis wrote:

Patch include updates to DJGPP related files in gcc/config/i386.

There are too many changes to gcc/config/i386/djgpp.h and
gcc/config/i386/xm-djgpp.h to list them completely in changelog
entry.

Andris

2015-11-25 Andris Pavenis <andris.pave...@iki.fi>

Subject: [PATCH 6/6] [DJGPP] gcc/config/i386: update DJGPP configuration
  related files

* gcc/config/i386/djgpp.h: update
* gcc/config/i386/xm-djgpp.h: update
* gcc/config/i386/djgpp.c: new file
* gcc/config/i386/djgpp.opt: remove obsolete option -mbnu210
* gcc/config/i386/t-djgpp: new file
* gcc/config.gcc: use i386/t-djgpp for DJGPP target

0005-DJGPP-gcc-config-i386-update-DJGPP-configuration-rel.patch


 From 367432d08b4a00f180c3d0710a0f34cda1b6 Mon Sep 17 00:00:00 2001
From: Andris Pavenis<andris.pave...@iki.fi>
Date: Sat, 5 Dec 2015 08:49:12 +0200
Subject: [PATCH 5/6] [DJGPP] gcc/config/i386: update DJGPP configuration 
related files

* gcc/config/i386/djgpp.h: update
* gcc/config/i386/xm-djgpp.h: update

You should describe what you updated.  SImply saying "update" is insufficient 
here.

Updated ChangeLog entry included


diff --git a/gcc/config/i386/djgpp.c b/gcc/config/i386/djgpp.c
new file mode 100644
index 000..29dad33
--- /dev/null
+++ b/gcc/config/i386/djgpp.c
@@ -0,0 +1,50 @@
+/* Subroutines for DJGPP.
+   Contributed by Andris Pavenis<andris.pave...@iki.fi>
+   Copyright (C) 2013 Free Software Foundation, Inc.

Copyright date needs updating.

I also removed direct reference to me. One can check search ChangeLog if 
interested



+
+void
+i386_djgpp_asm_named_section(const char *name, unsigned int flags,
+ tree decl)
+{
+  char flagchars[8], *f = flagchars;
+
+(void)decl; /* silence warning. */
The way to do this now is to not give a name to the parameter. So remove "decl" from the function 
signature (leaving its type though). Then you can remove this line.


OK



--- a/gcc/config/i386/djgpp.h
+++ b/gcc/config/i386/djgpp.h
@@ -17,12 +17,27 @@ You should have received a copy of the GNU General Public 
License
  along with GCC; see the file COPYING3.  If not see
  <http://www.gnu.org/licenses/>.  */

+#define DBX_DEBUGGING_INFO 1
+#define SDB_DEBUGGING_INFO 1
?  Really,  do you *really* need this.  I'd really like to see DBX and SDB debugging info die, 
not propagate into more targets.

They were missing for some versions of DJGPP builds and re-added after some 
discussion.
DJGPP port of Emacs depends on COFF debugging information. Building it with recent versions of GCC 
do not however work, so

no harm from removing it




-#define IX86_MAYBE_NO_LIBGCC_TFMODE
+#undef DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]

And if the DBX_DEBUGGING_INFO goes away, can't this go away too?
Not according GCC internal docs 
(https://gcc.gnu.org/onlinedocs/gccint/All-Debuggers.html#All-Debuggers).

It is also rather widely used for other targets


Jeff




Andris


New ChangeLog entry:

015-12-12 Andris Pavenis <andris.pave...@iki.fi>

   [DJGPP] gcc/config/i386: update DJGPP configuration related files

   * config/i386/djgpp.h (PREFERRED_DEBUGGING_TYPE): Define to DWARF2
   (TARGET_ASM_OUTPUT_IDENT): Define to default_asm_output_ident_directive
   (MD_EXEC_PREFIX): Remove.
   (MD_STARTFILE_PREFIX) Removee.
   (FILE_NAME_ABSOLUTE_P): Remove.
   (CPP_SPEC): Do not read macros from sys/version.h.
   (LINK_COMMAND_SPEC): Remove.
   (LOCAL_INCLUDE_DIR): Remove.
   (TARGET_ASM_NAMED_SECTION): Define to i386_djgpp_asm_named_section
   (TARGET_OS_CPP_BUILTINS): Add DJGPP (non ISO only), __DJGPP, __DJGPP__, 
unix.
   (POST_LINK_SPEC): Define to invoke stubify after linker
   (LIBSTDCXX): Remove define
   (DBX_REGISTER_NUMBER): Define to svr4_dbx_register_map.
   (DEFAULT_PCC_STRUCT_RETURN): Define to 1.
   (SUBTARGET_OVERRIDE_OPTIONS): Remove warning about -mbnu2210.
   (SUBTARGET_OVERRIDE_OPTIONS): Ignore -fPIC and generate message.
   (SUBTARGET_OVERRIDE_OPTIONS): Default to DWARF2 debugging info.
   (IX86_MAYBE_NO_LIBGCC_TFMODE): Remove.
   (i386_djgpp_asm_named_section): Add propotype of new procedure

   * config/i386/xm-djgpp.h (NATIVE_SYSTEM_HEADER_DIR): Define.
   (MD_EXEC_PREFIX): Define (moved from config/i386/djgpp.h).
   (STANDARD_STARTFILE_PREFIX_1): Define (moved from MD_STARTFILE_PREFIX in 
config/i386/djgpp.h).
   (STANDARD_STARTFILE_PREFIX_2): Define identical to 
STANDARD_STARTFILE_PREFIX_1.
   (LOCAL_INCLUDE_DIR): Define (moved from config/i386/djgpp.h).
   (GCC_DRIVER_HOST_INITIALIZATION): Fix reporting fatal installation 
errors.
   (MAX_OFILE_ALIGNMENT): Define to 128.
   (HAVE_FTW_H): Undefine as DJGPP do not have nftw, but have ftw.h.

   * config/i386/djgpp.c: New file. Add implementation of 
i386_djgpp_asm_named_section.


[PATCH 3/6] [DJGPP] libbacktrace/configure.ac: specify that DJGPP do not have mmap()

2015-12-05 Thread Andris Pavenis

Patch specifies that DJGPP do not have mmap() even when sys/mman.h is available.
libbacktrace is perhaps currently unusable for DJGPP but otherwise mmap() 
usability
misdetection breaks cross-compiler build for DJGPP target (for example Linux 
hosted
cross-compiler)

Andris

2015-12-05 Andris Pavenis <andris.pave...@iki.fi>

* configure.ac: Specify that DJGPP do not have mmap even when sys/mman.h exists
* configure: Regenerate
>From 5fb05d0ae112ae1c938c2edf94b8dff8cd5dd1d6 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Tue, 24 Nov 2015 20:22:52 +0200
Subject: [PATCH 3/6] [DJGPP] libbacktrace/configure.ac: specify that DJGPP do not have mmap()

---
 libbacktrace/configure| 3 ++-
 libbacktrace/configure.ac | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libbacktrace/configure b/libbacktrace/configure
index f8adc83..015c944 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -12301,9 +12301,10 @@ else
 # simply assume that if we have mman.h, we have mmap.
 have_mmap=yes
 case "${host}" in
-spu-*-*)
+spu-*-*|*-*-msdosdjgpp)
 # The SPU does not have mmap, but it has a sys/mman.h header file
 # containing "mmap_eaddr" and the mmap flags, confusing the test.
+# DJGPP also has sys/man.h, but no mmap
 	have_mmap=no ;;
 esac
   else
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 33866e9..7a0a157 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -267,9 +267,10 @@ else
 # simply assume that if we have mman.h, we have mmap.
 have_mmap=yes
 case "${host}" in
-spu-*-*)
+spu-*-*|*-*-msdosdjgpp)
 # The SPU does not have mmap, but it has a sys/mman.h header file
 # containing "mmap_eaddr" and the mmap flags, confusing the test.
+# DJGPP also has sys/man.h, but no mmap
 	have_mmap=no ;;
 esac
   else
-- 
2.4.3



[PATCH 6/6] [DJGPP] configure.ac: enable LTO

2015-12-05 Thread Andris Pavenis

Patch enables LTO support for DJGPP in top level configure.ac

Andris

2015-12-05 Andris Pavenis <andris.pave...@iki.fi>

* configure.ac: enable LTO for *-*-msdosdjgpp
>From 9df385353dd1f6c275e0ce9266ab4bbb3a80cd44 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sat, 14 Nov 2015 20:38:32 +0200
Subject: [PATCH 6/6] [DJGPP] configure.ac: enable LTO

---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index a6998ff..ee4fd23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1817,7 +1817,7 @@ ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
   build_lto_plugin=yes
 ],[if test x"$default_enable_lto" = x"yes" ; then
 case $target in
-  *-apple-darwin9* | *-cygwin* | *-mingw*) ;;
+  *-apple-darwin9* | *-cygwin* | *-mingw* | *djgpp*) ;;
   # On other non-ELF platforms, LTO has yet to be validated.
   *) enable_lto=no ;;
 esac
@@ -1828,7 +1828,7 @@ ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
   # warn during gcc/ subconfigure; unless you're bootstrapping with
   # -flto it won't be needed until after installation anyway.
 case $target in
-  *-cygwin* | *-mingw* | *-apple-darwin*) ;;
+  *-cygwin* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
   *) if test x"$enable_lto" = x"yes"; then
 	AC_MSG_ERROR([LTO support is not enabled for this target.])
 fi
-- 
2.4.3



[PATCH 4/6] [DJGPP] config/i386/djgpp: Update definitions of signed types

2015-12-05 Thread Andris Pavenis

Included patch updates typedefs of integer types in config/i386/djgpp-stdint.h.
Patch is similar but not identical as attached to

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41557

Andris

2015-12-05 Andris Pavenis <andris.pave...@iki.fi>

* config/i386/djgpp-stdint.h: update typedefs for integer types

>From 3533f7a8ac0a16b17e27ab772cfdeae6309005a3 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sat, 14 Nov 2015 14:20:14 +0200
Subject: [PATCH 4/6] [DJGPP] config/i386/djgpp: Update definitions of signed types

* config/i386/djgpp-stdint.h: update definitions of integer types
---
 gcc/config/i386/djgpp-stdint.h | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/gcc/config/i386/djgpp-stdint.h b/gcc/config/i386/djgpp-stdint.h
index 84f2b50..36642e3 100644
--- a/gcc/config/i386/djgpp-stdint.h
+++ b/gcc/config/i386/djgpp-stdint.h
@@ -22,21 +22,21 @@ along with GCC; see the file COPYING3.  If not see
 /* Exact-width integer types */
 
 #define INT8_TYPE "signed char"
-#define INT16_TYPE "signed short int"
-#define INT32_TYPE "signed long int"
-#define INT64_TYPE "signed long long int"
+#define INT16_TYPE "short int"
+#define INT32_TYPE "int"
+#define INT64_TYPE "long long int"
 
 #define UINT8_TYPE "unsigned char"
 #define UINT16_TYPE "short unsigned int"
-#define UINT32_TYPE "long unsigned int"
+#define UINT32_TYPE "unsigned int"
 #define UINT64_TYPE "long long unsigned int"
 
 /* Minimum-width integer types */
 
 #define INT_LEAST8_TYPE "signed char"
-#define INT_LEAST16_TYPE "signed short int"
-#define INT_LEAST32_TYPE "signed int"
-#define INT_LEAST64_TYPE "signed long long int"
+#define INT_LEAST16_TYPE "short int"
+#define INT_LEAST32_TYPE "int"
+#define INT_LEAST64_TYPE "long long int"
 
 #define UINT_LEAST8_TYPE "unsigned char"
 #define UINT_LEAST16_TYPE "short unsigned int"
@@ -46,12 +46,12 @@ along with GCC; see the file COPYING3.  If not see
 /* Fastest minimum-width integer types */
 
 #define INT_FAST8_TYPE "signed char"
-#define INT_FAST16_TYPE "signed int"
-#define INT_FAST32_TYPE "signed int"
-#define INT_FAST64_TYPE "long long signed int"
+#define INT_FAST16_TYPE "short int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
 
 #define UINT_FAST8_TYPE "unsigned char"
-#define UINT_FAST16_TYPE "unsigned int"
+#define UINT_FAST16_TYPE "short unsigned int"
 #define UINT_FAST32_TYPE "unsigned int"
 #define UINT_FAST64_TYPE "long long unsigned int"
 
-- 
2.4.3



[PATCH 5/6] [DJGPP] gcc/config/i386: update DJGPP configuration related files

2015-12-05 Thread Andris Pavenis

Patch include updates to DJGPP related files in gcc/config/i386.

There are too many changes to gcc/config/i386/djgpp.h and
gcc/config/i386/xm-djgpp.h to list them completely in changelog
entry.

Andris

2015-11-25 Andris Pavenis <andris.pave...@iki.fi>

Subject: [PATCH 6/6] [DJGPP] gcc/config/i386: update DJGPP configuration
 related files

* gcc/config/i386/djgpp.h: update
* gcc/config/i386/xm-djgpp.h: update
* gcc/config/i386/djgpp.c: new file
* gcc/config/i386/djgpp.opt: remove obsolete option -mbnu210
* gcc/config/i386/t-djgpp: new file
* gcc/config.gcc: use i386/t-djgpp for DJGPP target
>From 367432d08b4a00f180c3d0710a0f34cda1b6 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sat, 5 Dec 2015 08:49:12 +0200
Subject: [PATCH 5/6] [DJGPP] gcc/config/i386: update DJGPP configuration related files

* gcc/config/i386/djgpp.h: update
* gcc/config/i386/xm-djgpp.h: update
* gcc/config/i386/djgpp.c: new file
* gcc/config/i386/djgpp.opt: remove obsolete option
* gcc/config/i386/t-djgpp: new file
* gcc/config.gcc: use i386/t-djgpp for DJGPP target
---
 gcc/config.gcc |   3 ++
 gcc/config/i386/djgpp.c|  50 +++
 gcc/config/i386/djgpp.h| 122 ++---
 gcc/config/i386/djgpp.opt  |   6 ---
 gcc/config/i386/t-djgpp|   8 +++
 gcc/config/i386/xm-djgpp.h |  40 +--
 6 files changed, 158 insertions(+), 71 deletions(-)
 create mode 100644 gcc/config/i386/djgpp.c
 create mode 100644 gcc/config/i386/t-djgpp

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 59aee2c..656cbd8 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4387,6 +4387,9 @@ case ${target} in
 	i[34567]86-*-gnu*)
 		tmake_file="$tmake_file i386/t-gnu"
 		;;
+	i[34567]86-*-msdosdjgpp*)
+		tmake_file="${tmake_file} i386/t-djgpp"
+		;;
 	i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
 		;;
 	i[34567]86-*-cygwin* | x86_64-*-cygwin*)
diff --git a/gcc/config/i386/djgpp.c b/gcc/config/i386/djgpp.c
new file mode 100644
index 000..29dad33
--- /dev/null
+++ b/gcc/config/i386/djgpp.c
@@ -0,0 +1,50 @@
+/* Subroutines for DJGPP.
+   Contributed by Andris Pavenis <andris.pave...@iki.fi>
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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; either version 3, or (at your option) any later
+version.
+
+GCC 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 GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "output.h"
+#include "lto-section-names.h"
+
+void
+i386_djgpp_asm_named_section(const char *name, unsigned int flags,
+			 tree decl)
+{
+  char flagchars[8], *f = flagchars;
+
+(void)decl; /* silence warning. */
+
+  if (flags & SECTION_WRITE)
+*f++ = 'w';
+  if (flags & SECTION_CODE)
+*f++ = 'x';
+
+  /* LTO sections need 1-byte alignment to avoid confusing the
+ zlib decompression algorithm with trailing zero pad bytes.  */
+  if (strncmp (name, LTO_SECTION_NAME_PREFIX,
+			strlen (LTO_SECTION_NAME_PREFIX)) == 0)
+*f++ = '0';
+
+  *f++ = '\0';
+
+  fprintf (asm_out_file, "\t.section\t%s,\"%s\"\n", name, flagchars);
+}
diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h
index f8b9031..dd441b3 100644
--- a/gcc/config/i386/djgpp.h
+++ b/gcc/config/i386/djgpp.h
@@ -17,12 +17,27 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define DBX_DEBUGGING_INFO 1
+#define SDB_DEBUGGING_INFO 1
+
 /* Support generation of DWARF2 debugging info.  */
 #define DWARF2_DEBUGGING_INFO 1
 
+/* Use DWARF2 debugging info by default: comment out following  */
+/* 2 lines to default to COFF debugging info  */
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+
 /* Don't assume anything about the header files.  */
 #define NO_IMPLICIT_EXTERN_C
 
+/* If defined, a C expression whose value is a string containing the
+   assembler operation to identify the following data as
+   uninitialized global data.  If not defined, and neither
+   `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
+   uninitialized global data will be output in the data section if
+   `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
+   used.  */
 #undef BSS_SECTION_ASM_OP
 #define BSS_SECTION_ASM_OP "

[PATCH 2/6] [DJGPP] libgcc: Add djgpp to lists of i[34567]86-*-* and x86_64-*-* soft-fp targets.

2015-12-05 Thread Andris Pavenis

Included patch adds *-*-msdosdjgpp to lists of i[34567]86-*-* soft-fp targets.

Andris

PS. Sending from different address as posts from other address seems not to go 
through

2015-12-05 Andris Pavenis <andris.pave...@iki.fi>

*  config.host: Add *-*-msdosdjgpp to lists of i[34567]86-*-* soft-fp targets
>From 9e5259eabf7ce876c8639500b56ad8213d852417 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Tue, 24 Nov 2015 20:16:38 +0200
Subject: [PATCH 2/6] [DJGPP] libgcc/config.host: update

* config.host: Add *-*-msdosdjgpp to lists of i[34567]86-*-* and x86_64-*-* soft-fp targets.
---
 libgcc/config.host | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libgcc/config.host b/libgcc/config.host
index 9a58beb..11a82e6 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1348,6 +1348,7 @@ case ${host} in
 i[34567]86-*-darwin* | x86_64-*-darwin* | \
   i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
   i[34567]86-*-linux* | x86_64-*-linux* | \
+  i[34567]86-*-msdosdjgpp* | \
   i[34567]86-*-gnu* | \
   i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \
   i[34567]86-*-cygwin* | x86_64-*-cygwin* | \
-- 
2.4.3



Re: [PATCH 1/6] [DJGPP] libstdc++-v3/config/os/djgpp/error_constants.h: Update according to errno codes available for DJGPP

2015-12-05 Thread Andris Pavenis

On 12/05/2015 06:35 PM, Andris Pavenis wrote:

Included patch updates libstdc++-v3/config/os/djgpp/error_constants.h
according to defines available in DJGPP errno.h.

I'm reposting a patch as earlier post (Nov 15, 2015) have bug in changelog entry

Andris

2015-12-05 Andris Pavenis <andris.pave...@iki.fi>

* config/os/djgpp/error_constants.h: update according to DJGPP errno macros.




Re: [PATCH] Fix inconsistent use of integer types in gcc/lto-streamer-out.c

2015-11-16 Thread Andris Pavenis

On 11/16/2015 01:12 PM, Richard Biener wrote:

On Sun, Nov 15, 2015 at 9:21 AM, Andris Pavenis <andris.pave...@iki.fi> wrote:

This fixes use of pointers different unsigned integer types as function
parameter.
Function prototype is (see gcc/tree-streamer.h):

bool streamer_tree_cache_lookup (struct streamer_tree_cache_d *, tree,
  unsigned *);

gcc/lto-streamer-out.c passes uint32_t int * as parameter to this method in
2 places.
Current type unisgned is used elsewhere in the same file.

uint32_t is not guaranteed to be the same as unsigned (for DJGPP uint32_t is
actually
unsigned long). That causes compile failure for DJGPP native build.

Ok.

Thanks,
Richard.


Could somebody apply it as I do not have SVN write access.

Andris




Andris

2015-11-15 Andris Pavenis <andris.pave...@iki.fi>

* gcc/lto-streamer-out.c (write_global_references): Adjust integer type
   (lto_output_decl_state_refs): Likewise





[PATCH] Fix inconsistent use of integer types in gcc/lto-streamer-out.c

2015-11-15 Thread Andris Pavenis

This fixes use of pointers different unsigned integer types as function 
parameter.
Function prototype is (see gcc/tree-streamer.h):

bool streamer_tree_cache_lookup (struct streamer_tree_cache_d *, tree,
 unsigned *);

gcc/lto-streamer-out.c passes uint32_t int * as parameter to this method in 2 
places.
Current type unisgned is used elsewhere in the same file.

uint32_t is not guaranteed to be the same as unsigned (for DJGPP uint32_t is 
actually
unsigned long). That causes compile failure for DJGPP native build.

Andris

2015-11-15 Andris Pavenis <andris.pave...@iki.fi>

* gcc/lto-streamer-out.c (write_global_references): Adjust integer type
  (lto_output_decl_state_refs): Likewise

>From 8962f5b60f3ea241634a5e50cda04dc17ebb1322 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sun, 15 Nov 2015 09:57:24 +0200
Subject: [PATCH] lto-streamer-out.c: Fix inconsistent use unsigned integer
 types

* lto-streamer-out (write_global_references, lto_output_decl_state_streams): use integer
 type passed to streamer_tree_cache_lookup.
---
 gcc/lto-streamer-out.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 11daf7a..7d008b5 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2402,7 +2402,7 @@ write_global_references (struct output_block *ob,
 
   for (index = 0; index < size; index++)
 {
-  uint32_t slot_num;
+  unsigned slot_num;
 
   t = lto_tree_ref_encoder_get_tree (encoder, index);
   streamer_tree_cache_lookup (ob->writer_cache, t, _num);
@@ -2437,7 +2437,7 @@ lto_output_decl_state_refs (struct output_block *ob,
 			struct lto_out_decl_state *state)
 {
   unsigned i;
-  uint32_t ref;
+  unsigned ref;
   tree decl;
 
   /* Write reference to FUNCTION_DECL.  If there is not function,
-- 
2.4.3



Re: [PATCH] gcc.c: new macro POST_LINK_SPECS to be able to add additional steps after linking

2015-11-15 Thread Andris Pavenis

On 11/13/2015 08:40 AM, Jeff Law wrote:

On 11/10/2015 11:16 AM, Andris Pavenis wrote:

One may need to execute extra steps after linking program. This is required
for example for DJGPP to run stubify.exe on file generated by linker.

The only way how to achieve was to use LINK_COMMAND_SPEC. It would be
much easier
and less error prone to use new macro POST_LINK_SPEC introduced in this
patch.

Andris

ChangeLog entry

2015 Nov 10 Andris Pavenis <andris.pave...@iki.fi>

 * gcc.c: new macro POST_LINK_SPEC
 * doc/tm.texi.in: document POST_LINK_SPEC
 * doc/tm.texi: regenerate
Instaled with a better ChangeLog.  Presumably there's going to be a followup to simplify a bunch 
of hte djgpp configuration?


jeff



There are large number of changes in djgpp related configuration files accumulated over many years. 
Some cleanup and
verification whether all is still needed and and of course testing of both cross- and native 
compiler is required.


It would be rather difficult to split it into parts. I'll going to submit configuration changes for 
DJGPP
(gcc/config.host + gcc/config/i386/*djgpp*) in one large patch after cleanup and testing unless 
there are objections.


Therefore small small separate changes can be expected first.

Andris



[PATCH, libstdc++-v3, DJGPP] Update error constants for DJGPP

2015-11-15 Thread Andris Pavenis

Included patch updates error constants for DJGPP.

Andris

2015-11-15 Andris Pavenis <andris.pave...@delorie.com>

* libstdc++-v3/config/os/djgpp/error_constants.h (std::errc): Update error 
constants for DJGPP

>From fd43935415eee35aaa2ece3d07b0814de4da70f7 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sun, 15 Nov 2015 20:22:33 +0200
Subject: [PATCH] [DJGPP} libstdc++-v3/config/os/djgpp/error_constants.h:
 Update according to errno codes available for DJGPP

---
 libstdc++-v3/config/os/djgpp/error_constants.h | 99 +++---
 1 file changed, 75 insertions(+), 24 deletions(-)

diff --git a/libstdc++-v3/config/os/djgpp/error_constants.h b/libstdc++-v3/config/os/djgpp/error_constants.h
index 8e25aa0..21e4906 100644
--- a/libstdc++-v3/config/os/djgpp/error_constants.h
+++ b/libstdc++-v3/config/os/djgpp/error_constants.h
@@ -37,8 +37,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-// Most of the commented-out error codes are socket-related and could be
-// replaced by Winsock WSA-prefixed equivalents.
   enum class errc
 {
 //address_family_not_supported = 		EAFNOSUPPORT,
@@ -49,13 +47,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   argument_out_of_domain = 			EDOM,
   bad_address = EFAULT,
   bad_file_descriptor = 			EBADF,
-//bad_message = EBADMSG,
+
+#ifdef _GLIBCXX_HAVE_EBADMSG
+  bad_message = EBADMSG,
+#endif
+
   broken_pipe = EPIPE,
 //connection_aborted = 			ECONNABORTED,
 //connection_already_in_progress = 		EALREADY,
 //connection_refused = 			ECONNREFUSED,
 //connection_reset = 			ECONNRESET,
-//cross_device_link = 			EXDEV,
+  cross_device_link = 			EXDEV,
 //destination_address_required = 		EDESTADDRREQ,
   device_or_resource_busy = 		EBUSY,
   directory_not_empty = 			ENOTEMPTY,
@@ -65,7 +67,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   filename_too_long = 			ENAMETOOLONG,
   function_not_supported = 			ENOSYS,
 //host_unreachable = 			EHOSTUNREACH,
-//identifier_removed = 			EIDRM,
+
+#ifdef _GLIBCXX_HAVE_EIDRM
+  identifier_removed = 			EIDRM,
+#endif
+
   illegal_byte_sequence = 			EILSEQ,
   inappropriate_io_control_operation = 	ENOTTY,
   interrupted = EINTR,
@@ -78,48 +84,93 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 //network_reset = ENETRESET,
 //network_unreachable = 			ENETUNREACH,
 //no_buffer_space = 			ENOBUFS,
-//no_child_process = 			ECHILD,
-//no_link = ENOLINK,
+  no_child_process = 			ECHILD,
+
+#ifdef _GLIBCXX_HAVE_ENOLINK
+  no_link = ENOLINK,
+#endif
+
   no_lock_available = 			ENOLCK,
-//no_message_available = 			ENODATA, 
+
+#ifdef _GLIBCXX_HAVE_ENODATA
+  no_message_available = 			ENODATA, 
+#endif
+
 //no_message = ENOMSG, 
 //no_protocol_option = 			ENOPROTOOPT,
-//no_space_on_device = 			ENOSPC,
-//no_stream_resources = 			ENOSR,
+  no_space_on_device = 			ENOSPC,
+
+#ifdef _GLIBCXX_HAVE_ENOSR
+  no_stream_resources = 			ENOSR,
+#endif
+
   no_such_device_or_address = 		ENXIO,
   no_such_device = ENODEV,
   no_such_file_or_directory = 		ENOENT,
   no_such_process = 			ESRCH,
   not_a_directory = 			ENOTDIR,
 //not_a_socket = ENOTSOCK,
-//not_a_stream = ENOSTR,
+
+#ifdef _GLIBCXX_HAVE_ENOSTR
+  not_a_stream = ENOSTR,
+#endif
+
 //not_connected = ENOTCONN,
   not_enough_memory = 			ENOMEM,
-//not_supported = ENOTSUP,
-//operation_canceled = 			ECANCELED,
+
+#ifdef _GLIBCXX_HAVE_ENOTSUP
+  not_supported = ENOTSUP,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ECANCELED
+  operation_canceled = 			ECANCELED,
+#endif
+
 //operation_in_progress = 			EINPROGRESS,
-//operation_not_permitted = 		EPERM,
+  operation_not_permitted = 		EPERM,
 //operation_not_supported = 		EOPNOTSUPP,
 //operation_would_block = 			EWOULDBLOCK,
-//owner_dead = EOWNERDEAD,
+
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+  owner_dead = EOWNERDEAD,
+#endif
+
   permission_denied = 			EACCES,
-//protocol_error = EPROTO,
+
+#ifdef _GLIBCXX_HAVE_EPROTO
+  protocol_error = EPROTO,
+#endif
+
 //protocol_not_supported = 			EPROTONOSUPPORT,
   read_only_file_system = 			EROFS,
   resource_deadlock_would_occur = 		EDEADLK,
   resource_unavailable_try_again = 		EAGAIN,
   result_out_of_range = 			ERANGE,
-//state_not_recoverable = 			ENOTRECOVERABLE,
-//stream_timeout = ETIME,
-//text_file_busy = ETXTBSY,
+
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+  state_not_recoverable = 			ENOTRECOVERABLE,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETIME
+  stream_timeout = ETIME,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETXTBSY
+  text_file_busy = ETXTBSY,
+#endif
+
 //timed_out = ETIMEDOUT,
   too_many_files_open_in_system = 		ENFILE,
   too_many_files_open = 			EMFILE,
- 

Re: [PATCH, libstdc++-v3, DJGPP] Update error constants for DJGPP

2015-11-15 Thread Andris Pavenis

On 11/15/2015 08:56 PM, Andris Pavenis wrote:

Included patch updates error constants for DJGPP.

Andris

2015-11-15 Andris Pavenis <andris.pave...@delorie.com>

* libstdc++-v3/config/os/djgpp/error_constants.h (std::errc): Update error 
constants for DJGPP


Sorry email addrss andris.pave...@iki.fi


Re: [PATCH][DJGPP][libgfortran] Do not use S_ISVTX for DJGPP in libfortran/intrinsic/chmod.c

2015-11-15 Thread Andris Pavenis

On 11/15/2015 09:19 PM, Andreas Schwab wrote:

Andris Pavenis <andris.pave...@iki.fi> writes:


diff --git a/libgfortran/intrinsics/chmod.c b/libgfortran/intrinsics/chmod.c
index 1fffa3d..482a8a6 100644
--- a/libgfortran/intrinsics/chmod.c
+++ b/libgfortran/intrinsics/chmod.c
@@ -451,7 +451,7 @@ clause_done:
if ((ugo[2] || honor_umask) && !rwxXstugo[8])
  file_mode = (file_mode & ~(S_IROTH | S_IWOTH | S_IXOTH))
  | (new_mode & (S_IROTH | S_IWOTH | S_IXOTH));
-#ifndef __VXWORKS__
+#if !defined(__VXWORKS__) && !defined(__DJGPP__)

How about making that #ifdef S_ISVTX?

Andreas.


New patch attached. It is OK for DJGPP. Let us only hope that we have no some 
obscure target
for which S_ISVTX is present but is not a preprocessor macro. I have no way of 
checking for
all targets. From that point of view original patch was safer.

Andris

2015-11-16 Andris Pavenis <andris.pave...@iki.fi>

* libgfortran/intrinsics/chmod.c: use S_ISVTX only when it is defined


>From 6fcff7721ce292df7889797f1380d5313e445c6f Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Mon, 16 Nov 2015 06:33:14 +0200
Subject: [PATCH] libgfortran/intrinsics/chmod.c: use S_ISVTX only when it is
 defined

2015-11-16 Andris Pavenis <andris.pave...@iki.fi>

* libgfortran/intrinsics/chmod.c: use S_ISVTX only when it is defined
---
 libgfortran/intrinsics/chmod.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libgfortran/intrinsics/chmod.c b/libgfortran/intrinsics/chmod.c
index 1fffa3d..f8eed17 100644
--- a/libgfortran/intrinsics/chmod.c
+++ b/libgfortran/intrinsics/chmod.c
@@ -451,7 +451,7 @@ clause_done:
 	if ((ugo[2] || honor_umask) && !rwxXstugo[8])
 	  file_mode = (file_mode & ~(S_IROTH | S_IWOTH | S_IXOTH))
 		  | (new_mode & (S_IROTH | S_IWOTH | S_IXOTH));
-#ifndef __VXWORKS__
+#ifdef  S_ISVTX
 	if (is_dir && rwxXstugo[5])
 	  file_mode |= S_ISVTX;
 	else if (!is_dir)
@@ -463,7 +463,7 @@ clause_done:
   {
 	/* Clear '-'.  */
 	file_mode &= ~new_mode;
-#if !defined( __MINGW32__) && !defined (__VXWORKS__)
+#ifdef  S_ISVTX
 	if (rwxXstugo[5] || !is_dir)
 	  file_mode &= ~S_ISVTX;
 #endif
@@ -471,7 +471,7 @@ clause_done:
 else if (set_mode == 3)
   {
 	file_mode |= new_mode;
-#if !defined (__MINGW32__) && !defined (__VXWORKS__)
+#ifdef  S_ISVTX
 	if (rwxXstugo[5] && is_dir)
 	  file_mode |= S_ISVTX;
 	else if (!is_dir)
-- 
2.4.3



[PATCH][DJGPP][libgfortran] Do not use S_ISVTX for DJGPP in libfortran/intrinsic/chmod.c

2015-11-15 Thread Andris Pavenis

DJGPP do not have S_ISVTX defined. Therefore its use should be avoided.
Attached patch updates existing preprocessor conditional constructions
not to use S_ISVTX also for DJGPP

Andris

2015-11-15 Andris Pavenis <andris.pave...@iki.fi>

* libgfortran/intrinsics/chmod.c (chmod_internal): do not use S_ISVTX for DJGPP 
target


>From 09606704601c67d87ab69c0ee1da140b8f2d984d Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Sat, 14 Nov 2015 19:37:36 +0200
Subject: [PATCH] [DJGPP] libgfortran/intrinsic/chmod.c: avoid using S_ISVTX
 for DJGPP

---
 libgfortran/intrinsics/chmod.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libgfortran/intrinsics/chmod.c b/libgfortran/intrinsics/chmod.c
index 1fffa3d..482a8a6 100644
--- a/libgfortran/intrinsics/chmod.c
+++ b/libgfortran/intrinsics/chmod.c
@@ -451,7 +451,7 @@ clause_done:
 	if ((ugo[2] || honor_umask) && !rwxXstugo[8])
 	  file_mode = (file_mode & ~(S_IROTH | S_IWOTH | S_IXOTH))
 		  | (new_mode & (S_IROTH | S_IWOTH | S_IXOTH));
-#ifndef __VXWORKS__
+#if !defined(__VXWORKS__) && !defined(__DJGPP__)
 	if (is_dir && rwxXstugo[5])
 	  file_mode |= S_ISVTX;
 	else if (!is_dir)
@@ -463,7 +463,7 @@ clause_done:
   {
 	/* Clear '-'.  */
 	file_mode &= ~new_mode;
-#if !defined( __MINGW32__) && !defined (__VXWORKS__)
+#if !defined( __MINGW32__) && !defined (__VXWORKS__) && !defined(__DJGPP__)
 	if (rwxXstugo[5] || !is_dir)
 	  file_mode &= ~S_ISVTX;
 #endif
@@ -471,7 +471,7 @@ clause_done:
 else if (set_mode == 3)
   {
 	file_mode |= new_mode;
-#if !defined (__MINGW32__) && !defined (__VXWORKS__)
+#if !defined (__MINGW32__) && !defined (__VXWORKS__) && !defined(__DJGPP__)
 	if (rwxXstugo[5] && is_dir)
 	  file_mode |= S_ISVTX;
 	else if (!is_dir)
-- 
2.4.3



[PATCH] gcc.c: new macro POST_LINK_SPECS to be able to add additional steps after linking

2015-11-10 Thread Andris Pavenis

One may need to execute extra steps after linking program. This is required
for example for DJGPP to run stubify.exe on file generated by linker.

The only way how to achieve was to use LINK_COMMAND_SPEC. It would be much 
easier
and less error prone to use new macro POST_LINK_SPEC introduced in this patch.

Andris

ChangeLog entry

2015 Nov 10 Andris Pavenis <andris.pave...@iki.fi>

* gcc.c: new macro POST_LINK_SPEC
* doc/tm.texi.in: document POST_LINK_SPEC
* doc/tm.texi: regenerate

>From 2b50898ca2340aa43ce756bd605862b947cf1e7d Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Tue, 10 Nov 2015 19:52:57 +0200
Subject: [PATCH] New macro POST_LINK_SPEC for additional steps after rinning
 linker

---
 gcc/doc/tm.texi| 5 +
 gcc/doc/tm.texi.in | 5 +
 gcc/gcc.c  | 8 +++-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index f394db7..fe4e7f0 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -375,6 +375,11 @@ The sequence in which libgcc and libc are specified to the linker.
 By default this is @code{%G %L %G}.
 @end defmac
 
+@defmac POST_LINK_SPEC
+Define this macro to add additional steps to be executed after linker.
+The default value of this macro is empty string.
+@end defmac
+
 @defmac LINK_COMMAND_SPEC
 A C string constant giving the complete command line need to execute the
 linker.  When you do this, you will need to update your port each time a
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index d188c57..8c9c1b2 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -375,6 +375,11 @@ The sequence in which libgcc and libc are specified to the linker.
 By default this is @code{%G %L %G}.
 @end defmac
 
+@defmac POST_LINK_SPEC
+Define this macro to add additional steps to be executed after linker.
+The default value of this macro is empty string.
+@end defmac
+
 @defmac LINK_COMMAND_SPEC
 A C string constant giving the complete command line need to execute the
 linker.  When you do this, you will need to update your port each time a
diff --git a/gcc/gcc.c b/gcc/gcc.c
index bbc9b23..45d6089 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -979,6 +979,10 @@ proper position among the other output files.  */
 %{%:sanitize(leak):" LIBLSAN_SPEC "}}}"
 #endif
 
+#ifndef POST_LINK_SPEC
+#define POST_LINK_SPEC ""
+#endif
+
 /*  This is the spec to use, once the code for creating the vtable
 verification runtime library, libvtv.so, has been created.  Currently
 the vtable verification runtime functions are in libstdc++, so we use
@@ -1021,7 +1025,7 @@ proper position among the other output files.  */
 %(mflib) " STACK_SPLIT_SPEC "\
 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
-%{!nostdlib:%{!nostartfiles:%E}} %{T*} }}"
+%{!nostdlib:%{!nostartfiles:%E}} %{T*}  \n%(post_link) }}"
 #endif
 
 #ifndef LINK_LIBGCC_SPEC
@@ -1063,6 +1067,7 @@ static const char *linker_name_spec = LINKER_NAME;
 static const char *linker_plugin_file_spec = "";
 static const char *lto_wrapper_spec = "";
 static const char *lto_gcc_spec = "";
+static const char *post_link_spec = POST_LINK_SPEC;
 static const char *link_command_spec = LINK_COMMAND_SPEC;
 static const char *link_libgcc_spec = LINK_LIBGCC_SPEC;
 static const char *startfile_prefix_spec = STARTFILE_PREFIX_SPEC;
@@ -1571,6 +1576,7 @@ static struct spec_list static_specs[] =
   INIT_STATIC_SPEC ("linker_plugin_file",	_plugin_file_spec),
   INIT_STATIC_SPEC ("lto_wrapper",		_wrapper_spec),
   INIT_STATIC_SPEC ("lto_gcc",			_gcc_spec),
+  INIT_STATIC_SPEC ("post_link",		_link_spec),
   INIT_STATIC_SPEC ("link_libgcc",		_libgcc_spec),
   INIT_STATIC_SPEC ("md_exec_prefix",		_exec_prefix),
   INIT_STATIC_SPEC ("md_startfile_prefix",	_startfile_prefix),
-- 
2.4.3



Re: [PATCH] gcc.c: new macro POST_LINK_SPECS to be able to add additional steps after linking

2015-11-10 Thread Andris Pavenis

On 11/10/2015 11:20 PM, Jeff Law wrote:

On 11/10/2015 11:16 AM, Andris Pavenis wrote:

One may need to execute extra steps after linking program. This is required
for example for DJGPP to run stubify.exe on file generated by linker.

The only way how to achieve was to use LINK_COMMAND_SPEC. It would be
much easier
and less error prone to use new macro POST_LINK_SPEC introduced in this
patch.

Andris

ChangeLog entry

2015 Nov 10 Andris Pavenis <andris.pave...@iki.fi>

 * gcc.c: new macro POST_LINK_SPEC
 * doc/tm.texi.in: document POST_LINK_SPEC
 * doc/tm.texi: regenerate


Can you also include the changes to djgpp.h which exploit this capability?

Jeff


OK. I'm only sending changes for djgpp.h. There are required changes to other files not included, 
so djgpp.h patch currently

to illustrate use of POST_LINK_SPEC only not committing.

In short:

- earlier entire LINK_COMMAND_SPEC was redefined in djgpp.h (copy/paste from 
trunk)

#undef LINK_COMMAND_SPEC
#define LINK_COMMAND_SPEC \
"%{!fsyntax-only: \
%{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} \
\t%{r} %{s} %{t} %{u*} %{z} %{Z}\
\t%{!nostdlib:%{!nostartfiles:%S}}\
\t%{static:} %{L*} %D %o\
\t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
\t%{!nostdlib:%{!nostartfiles:%E}}\
\t-Tdjgpp.djl %{T*}}}\n\
%{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }"

One needed to update it each time when LINK_COMMAND_SPEC changes in gcc.c

- use of linker script djgpp.djl has actually done long ago (mentioned in 
comments for
LINK_COMMAND_SPEC override). The other reason: running stubify after linker has 
remain

- in new version I only need

#undef POST_LINK_SPEC
#define POST_LINK_SPEC "stubify %{v} %{o*:%*} %{!o*:a.out}"

instead, which is much simpler.

About DJGPP related changes accumulated in rather many years. There were changes to generic files 
which are highly
unlikely to be accepted (like use #ifdef __DJGPP__ in system independent files). I have to remove 
such ifdefs from
system independent files and re-implement it differently where possible. That will take some time 
and testing


Andris

diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h
index f8b9031..f3033f7 100644
--- a/gcc/config/i386/djgpp.h
+++ b/gcc/config/i386/djgpp.h
@@ -17,12 +17,27 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define DBX_DEBUGGING_INFO 1
+#define SDB_DEBUGGING_INFO 1
+
 /* Support generation of DWARF2 debugging info.  */
 #define DWARF2_DEBUGGING_INFO 1
 
+/* Use DWARF2 debugging info by default: comment out following  */
+/* 2 lines to default to COFF debugging info  */
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+
 /* Don't assume anything about the header files.  */
 #define NO_IMPLICIT_EXTERN_C
 
+/* If defined, a C expression whose value is a string containing the
+   assembler operation to identify the following data as
+   uninitialized global data.  If not defined, and neither
+   `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
+   uninitialized global data will be output in the data section if
+   `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
+   used.  */
 #undef BSS_SECTION_ASM_OP
 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
 
@@ -30,6 +45,10 @@ along with GCC; see the file COPYING3.  If not see
 #undef DATA_SECTION_ASM_OP
 #define DATA_SECTION_ASM_OP "\t.section .data"
 
+/* Define the name of the .ident op.  */
+#undef TARGET_ASM_OUTPUT_IDENT
+#define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive
+
 /* Enable alias attribute support.  */
 #ifndef SET_ASM_OP
 #define SET_ASM_OP "\t.set\t"
@@ -39,56 +58,26 @@ along with GCC; see the file COPYING3.  If not see
 #undef TEXT_SECTION_ASM_OP
 #define TEXT_SECTION_ASM_OP "\t.section .text"
 
-/* Define standard DJGPP installation paths.  */
-/* We override default /usr or /usr/local part with /dev/env/DJDIR which */
-/* points to actual DJGPP installation directory.  */
-
-/* Search for as.exe and ld.exe in DJGPP's binary directory.  */ 
-#undef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/"
-
-/* Standard DJGPP library and startup files */
-#undef MD_STARTFILE_PREFIX
-#define MD_STARTFILE_PREFIX "/dev/env/DJDIR/lib/"
-
-/* Correctly handle absolute filename detection in cp/xref.c */
-#define FILE_NAME_ABSOLUTE_P(NAME) \
-(((NAME)[0] == '/') || ((NAME)[0] == '\\') || \
-(((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':')))
-
 #define TARGET_OS_CPP_BUILTINS()		\
   do		\
 {		\
+if (!flag_iso)  \
+	   builtin_define_with_int_value ("DJGPP",2);  \
+	builtin_define_with_int_value ("__DJGPP",2);   \
+	b

[PING] [PATCH] Add POST_LINK_SPEC for adding possibility of additional steps after linking

2013-11-16 Thread Andris Pavenis

On 11/05/2013 02:09 PM, Andris Pavenis wrote:

Attached patch adds a possibility to add additional build steps after linking.
Without this patch only possibility is to redefine entire LINK_COMMAND_SPEC.
Currently only DJGPP seems to need it

2013-11-05Andris Pavenis andris.pave...@iki.fi

* gcc/gcc.c: Add macro POST_LINK SPEC for specifying additional steps
to invoke after linking
* gcc/doc/tm.texi.in: (POST_LINK_SPEC): new
* gcc/doc/tm.texi: regenerate

Bootstrapped and tested on Linux x86_64 (Fedora 19)

Andris



Original post

http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00367.html

Andris




[PATCH] Add POST_LINK_SPEC for adding possibility of additional steps after linking

2013-11-05 Thread Andris Pavenis

Attached patch adds a possibility to add additional build steps after linking.
Without this patch only possibility is to redefine entire LINK_COMMAND_SPEC.
Currently only DJGPP seems to need it

2013-11-05Andris Pavenis andris.pave...@iki.fi

* gcc/gcc.c: Add macro POST_LINK SPEC for specifying additional steps
to invoke after linking
* gcc/doc/tm.texi.in: (POST_LINK_SPEC): new
* gcc/doc/tm.texi: regenerate

Bootstrapped and tested on Linux x86_64 (Fedora 19)

Andris


From 3dd27dc54f3fd38d2b1e9b7fb53938be4df8da7c Mon Sep 17 00:00:00 2001
From: Andris Pavenis andris.pave...@iki.fi
Date: Tue, 5 Nov 2013 11:52:17 +0200
Subject: [PATCH] POST_LINK_SPEC: new define for additional steps after linking

This allows to avoid redefining LINK_COMMAND_SPEC when
additional steps are needed after linking

An example: invoking stubify after linking for DJGPP
---
 gcc/doc/tm.texi| 6 ++
 gcc/doc/tm.texi.in | 6 ++
 gcc/gcc.c  | 8 +++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 72daf09..692f675 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -402,6 +402,12 @@ the target makefile fragment or if none of the options listed in
 @xref{Target Fragment}.
 @end defmac
 
+@defmac POST_LINK_SPEC
+A C string constant giving complete commands needed to execute after linker.
+This macro allows to avoid redefining LINK_COMMAND_SPEC when additional
+steps are needed after invoking linker. The default value is empty string.
+@end defmac
+
 @defmac RELATIVE_PREFIX_NOT_LINKDIR
 Define this macro to tell @command{gcc} that it should only translate
 a @option{-B} prefix into a @option{-L} linker option if the prefix
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 2828361..edc2b9d 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -400,6 +400,12 @@ the target makefile fragment or if none of the options listed in
 @xref{Target Fragment}.
 @end defmac
 
+@defmac POST_LINK_SPEC
+A C string constant giving complete commands needed to execute after linker.
+This macro allows to avoid redefining LINK_COMMAND_SPEC when additional
+steps are needed after invoking linker. The default value is empty string.
+@end defmac
+
 @defmac RELATIVE_PREFIX_NOT_LINKDIR
 Define this macro to tell @command{gcc} that it should only translate
 a @option{-B} prefix into a @option{-L} linker option if the prefix
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 2298249..cc0ac29 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -745,6 +745,10 @@ proper position among the other output files.  */
 %{fvtable-verify=preinit: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}}
 #endif
 
+#ifndef POST_LINK_SPEC
+#define POST_LINK_SPEC 
+#endif
+
 /* -u* was put back because both BSD and SysV seem to support it.  */
 /* %{static:} simply prevents an error message if the target machine
doesn't handle -static.  */
@@ -770,7 +774,7 @@ proper position among the other output files.  */
 %(mflib)  STACK_SPLIT_SPEC \
 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}  SANITIZER_SPEC  \
 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
-%{!nostdlib:%{!nostartfiles:%E}} %{T*} }}
+%{!nostdlib:%{!nostartfiles:%E}} %{T*}  \n%(post_link) }}
 #endif
 
 #ifndef LINK_LIBGCC_SPEC
@@ -812,6 +816,7 @@ static const char *linker_name_spec = LINKER_NAME;
 static const char *linker_plugin_file_spec = ;
 static const char *lto_wrapper_spec = ;
 static const char *lto_gcc_spec = ;
+static const char *post_link_spec = POST_LINK_SPEC;
 static const char *link_command_spec = LINK_COMMAND_SPEC;
 static const char *link_libgcc_spec = LINK_LIBGCC_SPEC;
 static const char *startfile_prefix_spec = STARTFILE_PREFIX_SPEC;
@@ -1304,6 +1309,7 @@ static struct spec_list static_specs[] =
   INIT_STATIC_SPEC (linker_plugin_file,	linker_plugin_file_spec),
   INIT_STATIC_SPEC (lto_wrapper,		lto_wrapper_spec),
   INIT_STATIC_SPEC (lto_gcc,			lto_gcc_spec),
+  INIT_STATIC_SPEC (post_link,post_link_spec),
   INIT_STATIC_SPEC (link_libgcc,		link_libgcc_spec),
   INIT_STATIC_SPEC (md_exec_prefix,		md_exec_prefix),
   INIT_STATIC_SPEC (md_startfile_prefix,	md_startfile_prefix),
-- 
1.8.3.1



Re: GCC 4.7.3 Status Report (2012-09-20)

2012-09-21 Thread Andris Pavenis

On 09/20/2012 06:33 PM, Jakub Jelinek wrote:

Status
==

The GCC 4.7.2 release tarballs have been created and were uploaded
to ftp.gnu.org.  The GCC 4.7 branch is thus open again for
regression and documentation fixes.



Shouldn't be change

http://gcc.gnu.org/viewcvs/trunk/gcc/gcc.c?r1=188102r2=189918

Invoke GCC_DRIVER_HOST_INITIALIZATION after diagnostic_initialize

* gcc.c (main): Move GCC_DRIVER_HOST_INITIALIZATION after
diagnostic_initialize.

backported to gcc-4.7 branch?

Andris




Re: [PATCH, C] Mixed pointer types in call to streamer_tree_cache_lookup() in gcc/lto-streamer-out.c

2012-09-03 Thread Andris Pavenis

On 09/03/2012 03:27 PM, Richard Guenther wrote:

On Sat, Sep 1, 2012 at 2:21 PM, Andris Pavenis andris.pave...@iki.fi wrote:

uint32_t * is used as a 3rd parameter in call to
streamer_tree_cache_lookup()
in 2 places in gcc/lto-streamer-out.c when the procedure prototype have
unsigned *. They are not guaranteed to be the same for all targets
(I got error when building for DJGPP)


Ok.


I do not have SVN write access, so I cannot commit myself

Andris



Thanks,
Richard.


Andris

ChangeLog entry

2012-09-01  Andris Pavenis andris.pave...@iki.fi

 * lto-streamer-out.c (write_global_references,
lto_output_decl_state_refs):
 Fix parameter type in call to streamer_tree_cache_lookup






[PATCH, C] Mixed pointer types in call to streamer_tree_cache_lookup() in gcc/lto-streamer-out.c

2012-09-01 Thread Andris Pavenis

uint32_t * is used as a 3rd parameter in call to streamer_tree_cache_lookup()
in 2 places in gcc/lto-streamer-out.c when the procedure prototype have
unsigned *. They are not guaranteed to be the same for all targets
(I got error when building for DJGPP)

Andris

ChangeLog entry

2012-09-01  Andris Pavenis andris.pave...@iki.fi

* lto-streamer-out.c (write_global_references, 
lto_output_decl_state_refs):
Fix parameter type in call to streamer_tree_cache_lookup
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 2adae74..12335c5 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1098,7 +1098,7 @@ write_global_references (struct output_block *ob,
 
   for (index = 0; index  size; index++)
 {
-  uint32_t slot_num;
+  unsigned slot_num;
 
   t = lto_tree_ref_encoder_get_tree (encoder, index);
   streamer_tree_cache_lookup (ob-writer_cache, t, slot_num);
@@ -1131,7 +1131,7 @@ lto_output_decl_state_refs (struct output_block *ob,
 			struct lto_out_decl_state *state)
 {
   unsigned i;
-  uint32_t ref;
+  unsigned ref;
   tree decl;
 
   /* Write reference to FUNCTION_DECL.  If there is not function,


Re: [PATCH] Missing change from gcc/ada/system.ads

2012-08-03 Thread Andris Pavenis

On 08/03/2012 09:32 AM, Arnaud Charlet wrote:

Revision http://gcc.gnu.org/viewcvs?view=revisionrevision=189772
added constant Support_Atomic_Primitives to the target specific
system-*.ads files. The default system.ads was not updated.

The included patch
- adds the missing constant
- removes constants not present in other system-*.ads files any more

This patch is NOT ok, system.ads is a special version, used for bootstraping
the compiler, and as such, has different constraints.

There is nothing to change here.

It is however used when building libada if target specific version is not 
specified
in gcc/ada/gcc_interface/Makefile.in. In that case building libada fails due to 
missing
Support_Atomic_Primitives.

Andris



[PATCH] Missing change from gcc/ada/system.ads

2012-08-02 Thread Andris Pavenis

Revision http://gcc.gnu.org/viewcvs?view=revisionrevision=189772
added constant Support_Atomic_Primitives to the target specific
system-*.ads files. The default system.ads was not updated.

The included patch
- adds the missing constant
- removes constants not present in other system-*.ads files any more

Andris

2012-08-03  andris.pave...@iki.fi  andris.pave...@iki.fi

* system.ads:  Support_Atomic_Primitives set to False,
Remove outdated constants

From e63ea85554db9c652070280161cd55a861d3b2db Mon Sep 17 00:00:00 2001
From: Andris Pavenis andris.pave...@iki.fi
Date: Thu, 2 Aug 2012 21:18:39 +0300
Subject: [PATCH] Add constant Support_Atomic_Primitives to system.ads

Additionally remove contants not present for target
specific versions.
---
 gcc/ada/system.ads | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/gcc/ada/system.ads b/gcc/ada/system.ads
index d38a533..9cca2d5 100644
--- a/gcc/ada/system.ads
+++ b/gcc/ada/system.ads
@@ -136,7 +136,6 @@ private
--  parameters is not too critical for the compiler version (e.g. we
--  do not use floating-point anyway in the compiler).
 
-   AAMP  : constant Boolean := False;
Backend_Divide_Checks : constant Boolean := False;
Backend_Overflow_Checks   : constant Boolean := False;
Command_Line_Args : constant Boolean := True;
@@ -148,13 +147,13 @@ private
Frontend_Layout   : constant Boolean := False;
Machine_Overflows : constant Boolean := False;
Machine_Rounds: constant Boolean := True;
-   OpenVMS   : constant Boolean := False;
Preallocated_Stacks   : constant Boolean := False;
Signed_Zeros  : constant Boolean := True;
Stack_Check_Default   : constant Boolean := False;
Stack_Check_Probes: constant Boolean := False;
Stack_Check_Limits: constant Boolean := False;
Support_Aggregates: constant Boolean := True;
+   Support_Atomic_Primitives : constant Boolean := False;
Support_Composite_Assign  : constant Boolean := True;
Support_Composite_Compare : constant Boolean := True;
Support_Long_Shifts   : constant Boolean := True;
@@ -163,13 +162,4 @@ private
Use_Ada_Main_Program_Name : constant Boolean := False;
ZCX_By_Default: constant Boolean := False;
 
-   --  Obsolete entries, to be removed eventually (bootstrap issues!)
-
-   Front_End_ZCX_Support : constant Boolean := False;
-   High_Integrity_Mode   : constant Boolean := False;
-   Long_Shifts_Inlined   : constant Boolean := True;
-   Functions_Return_By_DSP   : constant Boolean := False;
-   Support_64_Bit_Divides: constant Boolean := True;
-   GCC_ZCX_Support   : constant Boolean := False;
-
 end System;
-- 
1.7.11.2



Re: Configuring gcc without symlink support

2012-02-01 Thread Andris Pavenis

On 02/02/2012 12:41 AM, Earl Chew wrote:

Some environments don't support symbolic links :-(


If ln -s is not supported, configure can figure it out, and as a last resort 
uses:

LN_S = cp -p

I've found two problems with this.

The first problem is that LN_S is not propagated past the top-level Makefile. 
This
can manifest as strange GCC_NO_EXECUTABLES messages:

Link tests are not allowed after GCC_NO_EXECUTABLES

The patch (against an older gcc 4.2.4) addresses this first problem.


The second is that:

cp -p $1 $2  mimics  ln -s $1 $2

only if $1 is an absolute path, or $2 does not contain any path separators.
This is not always true. For example:

gcc/gcc/config/t-slibgcc-elf-ver:   $(LN_S) $(SHLIB_SONAME) 
$(SHLIB_DIR)/$(SHLIB_SOLINK)

There doesn't seem to be any straightforward way around this
except diligence:

cd $(SHLIB_DIR)  $(LN_S) $(SHLIB_SONAME) $(SHLIB_SOLINK)


Additionally building in directory libada requires symlinking 
directories, so 'cp -p' in not enough. I have tried to use there

'cp -pR' instead.

Andris

PS. I have not tested with 4.7 yet, but with 4.6 it was so