Message ID | 1440059519-25600-1-git-send-email-james.greenhalgh@arm.com |
---|---|
State | New |
Headers | show |
On 20 August 2015 at 09:31, James Greenhalgh <james.greenhalgh@arm.com> wrote: > > 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. This is the second breakage I'm aware of due to the introduction of this hardwire code, the first being related to strtold. My recollection is that it is only the mips target that requires the newlib API hardwiring. Ideally we should rely only on the AC_CHECK_FUNCS_ONCE probe code and avoid the hardwire entirely. Perhaps a better approach for trunk would be something along the lines of: case "${host}--x${with_newlib}" in mips*--xyes) hardwire_newlib=1;; esac if test "${hardwire_newlib:-0}" -eq 1; then ... existing AC_DEFINES hardwire code else ... existing AC_CHECK_FUNCS_ONCE probe code fi In effect limiting the hardwire to just the target which is unable to probe. For backport to 4.9 and 5 I think James' more conservative patch is probably more appropriate. What do folks think? Cheers /Marcus
On Thu, 2015-08-20 at 09:31 +0100, James Greenhalgh wrote: > I'd appreciate your help Steve to check that this patch works with > your build system. > > Thanks, > James Yes, this patch works fine with my builds for MIPS. Steve Ellcey sellcey@imgtec.com
On Thu, Aug 20, 2015 at 10:50:47AM +0100, Marcus Shawcroft wrote: > On 20 August 2015 at 09:31, James Greenhalgh <james.greenhalgh@arm.com> wrote: > > > > 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. > > This is the second breakage I'm aware of due to the introduction of > this hardwire code, the first being related to strtold. My > recollection is that it is only the mips target that requires the > newlib API hardwiring. Ideally we should rely only on the > AC_CHECK_FUNCS_ONCE probe code and avoid the hardwire entirely. > > Perhaps a better approach for trunk would be something along the lines of: > > case "${host}--x${with_newlib}" in > mips*--xyes) > hardwire_newlib=1;; > esac > if test "${hardwire_newlib:-0}" -eq 1; then > ... existing AC_DEFINES hardwire code > else > ... existing AC_CHECK_FUNCS_ONCE probe code > fi > > In effect limiting the hardwire to just the target which is unable to > probe. For backport to 4.9 and 5 I think James' more conservative > patch is probably more appropriate. > > What do folks think? (+CC fortran@gcc.gnu.org - who I should have CCed from the start). This runs in to issues with a newlib build [1] (newlib provides a 'kill' symbol for linking, but does not provide a declaration in signal.h, so we take a -Werror=implicit-function-declaration). I think that is something that we should think about fixing in newlib, and I have a patch in the works that I'd like to start working through with the newlib community. In the mean time, I'd like to stick with this patch for trunk, GCC 5, and GCC 4.9 (with a promise that I'll revisit it once I've worked through what newlib wants to do). Is the patch I proposed OK as a "FORNOW" for trunk, and as a full-time bodge on 5, and 4.9? Thanks, James --- [1]: https://sourceware.org/ml/newlib/2015/msg00630.html
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 \