[Bug fortran/83340] New: Libgfortran.a (downloaded) is not PIC compiled...

2017-12-08 Thread cgw at alum dot mit.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83340

Bug ID: 83340
   Summary: Libgfortran.a (downloaded) is not PIC compiled...
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cgw at alum dot mit.edu
  Target Milestone: ---

Trying to build a Python extension with -static-libgcc fails with 

/usr/bin/ld:
/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../lib64/libgfortran.a(compile_options.o):
relocation R_X86_64_32 against `.rodata._gfortrani_backtrace_handler.str1.1'
can not be used when making a shared object; recompile with -fPIC

This was brought up in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35014
Note comment 1, where it is mentioned that it would make sense to offer a
PIC-compiled libgfortran.a.  The overhead of PIC is not substantial.

Please consider reopening bug 35014.

Thank you.

[Bug libfortran/35014] Libgfortran.a (downloaded) is not PIC compiled...

2017-12-11 Thread cgw at alum dot mit.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35014

--- Comment #5 from cgw at alum dot mit.edu ---
Why not?

Our use case is building a Python module (an .so file loaded by Python) which
wraps some Fortran code.

We would like to reduce the external dependencies that this module has.  There
have been some hard-to-track-down runtime errors resulting from libgcc.so
version  mismatches and we would like to remove this source of errors.

We found that libgfortran.so itself depends on libgcc.so, but had hoped that by
using the options `-static-libgfortran -static-libgcc' we could eliminate the
runtime dependency on libgcc.so completely

[Bug libfortran/35014] Libgfortran.a (downloaded) is not PIC compiled...

2017-12-23 Thread cgw at alum dot mit.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35014

--- Comment #7 from cgw at alum dot mit.edu ---
Thanks for the suggestion.  I will give it a try.

However, we're using a gcc from the distribution - either Ubuntu or Anaconda,
depending on the platform.  We are not configuring and building our own gcc.

Configuring our own gcc is possible, but a lot of extra overhead.  However,
we'd like our end-users to be able to modify the code and recompile it.  Asking
end-users to configure and build gcc in order to compile our package is not
really an option for us.

[Bug libfortran/94625] New: documentation of _gfortran_set_options does not match implementation

2020-04-16 Thread cgw at alum dot mit.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94625

Bug ID: 94625
   Summary: documentation of _gfortran_set_options  does not match
implementation
   Product: gcc
   Version: 9.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libfortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cgw at alum dot mit.edu
  Target Milestone: ---

In gcc/fortran/gfortran.texi the documentation for _libgfortran_set_options
describes the OPTIONS argument as follows:


 OPTION[0]   Allowed standard; can give run-time errors if
 e.g.  an input-output edit descriptor is invalid
 in a given standard.  Possible values are
 (bitwise or-ed) 'GFC_STD_F77' (1),
 'GFC_STD_F95_OBS' (2), 'GFC_STD_F95_DEL' (4),
 'GFC_STD_F95' (8), 'GFC_STD_F2003' (16),
 'GFC_STD_GNU' (32), 'GFC_STD_LEGACY' (64),
 'GFC_STD_F2008' (128), 'GFC_STD_F2008_OBS'
 (256), 'GFC_STD_F2008_TS' (512), 'GFC_STD_F2018'
 (1024), 'GFC_STD_F2018_OBS' (2048), and
 'GFC_STD=F2018_DEL' (4096).  Default:
 'GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F95
 | GFC_STD_F2003 | GFC_STD_F2008 |
 GFC_STD_F2008_TS | GFC_STD_F2008_OBS |
 GFC_STD_F77 | GFC_STD_F2018 | GFC_STD_F2018_OBS
 | GFC_STD_F2018_DEL | GFC_STD_GNU |
 GFC_STD_LEGACY'.
 OPTION[1]   Standard-warning flag; prints a warning to
 standard error.  Default: 'GFC_STD_F95_DEL |
 GFC_STD_LEGACY'.
 OPTION[2]   If non zero, enable pedantic checking.  Default:
 off.
 OPTION[3]   Unused.
 OPTION[4]   If non zero, enable backtracing on run-time
 errors.  Default: off.  (Default in the
 compiler: on.)  Note: Installs a signal handler
 and requires command-line initialization using
 '_gfortran_set_args'.
 OPTION[5]   If non zero, supports signed zeros.  Default:
 enabled.
 OPTION[6]   Enables run-time checking.  Possible values are
 (bitwise or-ed): GFC_RTCHECK_BOUNDS (1),
 GFC_RTCHECK_ARRAY_TEMPS (2),
 GFC_RTCHECK_RECURSION (4), GFC_RTCHECK_DO (16),
 GFC_RTCHECK_POINTER (32).  Default: disabled.
 OPTION[7]   Unused.
 OPTION[8]   Show a warning when invoking 'STOP' and 'ERROR
 STOP' if a floating-point exception occurred.
 Possible values are (bitwise or-ed)
 'GFC_FPE_INVALID' (1), 'GFC_FPE_DENORMAL' (2),
 'GFC_FPE_ZERO' (4), 'GFC_FPE_OVERFLOW' (8),
 'GFC_FPE_UNDERFLOW' (16), 'GFC_FPE_INEXACT'
 (32).  Default: None (0).  (Default in the
 compiler: 'GFC_FPE_INVALID | GFC_FPE_DENORMAL |
 GFC_FPE_ZERO | GFC_FPE_OVERFLOW |
 GFC_FPE_UNDERFLOW'.)

Unless I'm misunderstanding, _libgfortran_set_options is the public name for a
function defined as set_options in libgfortran/runtime/compile_options.c

void
set_options (int num, int options[])
{
  if (num >= 1)
compile_options.warn_std = options[0];
  if (num >= 2)
compile_options.allow_std = options[1];
  if (num >= 3)
compile_options.pedantic = options[2];
  if (num >= 4)
compile_options.backtrace = options[3];
  if (num >= 5)
compile_options.sign_zero = options[4];
  if (num >= 6)
compile_options.bounds_check = options[5];
  if (num >= 7)
compile_options.fpe_summary = options[6];


Note that the the first two options - `warn` and `allow` - seem to be reversed,
and unused elements 3 and 7 seem to have been removed, as also borne out by

libgfortran/ChangeLog-2016: * runtime/compile_options.c (set_options):
Remove unused elements.