This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Add to the libgfortran/newlib bodge to "detect" ftruncate support in ARM/AArch64/SH


Hi,

Steve's patch in 2013 [1] to fix the MIPS newlib/libgfortran build
causes subtle issues for an ARM/AArch64 newlib/libgfortran build. The
problem is that ARM/AArch64 (and SH) define a stub function for
ftruncate, which we would previously have auto-detected, but which is not
part of the hardwiring Steve added.

Continuing the tradition of building bodge on bodge on bodge, this patch
hardwires HAVE_FTRUNCATE on for ARM/AArch64/SH, which does fix the issue
I was seeing.

If this patch is acceptable for trunk, I'd also like to backport it to the
5.x and 4.9.x release branches.

I'm not quite sure how to effectively verify this patch. I've looked at
the generated config.h for aarch64-none-elf, arm-none-eabi and those come
out with HAVE_FTRUNCATE defined. I wanted to check mips-none-elf, but I
had no success there - the configure failed earlier when trying to link
executables.

I'd appreciate your help Steve to check that this patch works with
your build system.

Thanks,
James

[1]: https://gcc.gnu.org/ml/fortran/2013-09/msg00050.html

---

2015-08-14  James Greenhalgh  <james.greenhalgh@arm.com>

	* configure.ac: Define HAVE_FTRUNCATE for ARM/AArch64/SH newlib
	builds.
	* configure: Regenerate.

diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 35a8b39..adafb3f 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -295,6 +295,13 @@ if test "x${with_newlib}" = "xyes"; then
    if test x"long_double_math_on_this_cpu" = x"yes"; then
      AC_DEFINE(HAVE_STRTOLD, 1, [Define if you have strtold.])
    fi
+
+  # ARM, AArch64 and SH also provide ftruncate.
+  case "${host}" in
+     arm* | aarch64* | sh*)
+       AC_DEFINE(HAVE_FTRUNCATE, 1, [Define if you have ftruncate.])
+       ;;
+  esac
 else
    AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \
    ftruncate chsize chdir getlogin gethostname kill link symlink sleep ttyname \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]