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

            Bug ID: 81446
           Summary: Building Ada on Linux m68k fails due to missing
                    No_Elaboration_Code_All
           Product: gcc
           Version: 7.1.0
               URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=8629
                    27
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glaubitz at physik dot fu-berlin.de
                CC: jrtc27 at jrtc27 dot com, schwab at gcc dot gnu.org
  Target Milestone: ---
            Target: m68k-*-*

Trying to cross-build gnat for Linux m68k fails with:

/<<PKGBUILDDIR>>/gcc/build/./gcc/xgcc -B/<<PKGBUILDDIR>>/gcc/build/./gcc/
-B/usr/m68k-linux-gnu/bin/ -B/usr/m68k-linux-gnu/lib/ -isystem
/usr/m68k-linux-gnu/include -isystem /usr/m68k-linux-gnu/sys-include -isystem
/<<PKGBUILDDIR>>/gcc/build/sys-include    -c -g -O2   -W -Wall -gnatpg
-nostdinc  -gnatn  s-maccod.ads -o s-maccod.o
/<<PKGBUILDDIR>>/gcc/build/./gcc/xgcc -B/<<PKGBUILDDIR>>/gcc/build/./gcc/
-B/usr/m68k-linux-gnu/bin/ -B/usr/m68k-linux-gnu/lib/ -isystem
/usr/m68k-linux-gnu/include -isystem /usr/m68k-linux-gnu/sys-include -isystem
/<<PKGBUILDDIR>>/gcc/build/sys-include    -c -g -O2   -W -Wall -gnatpg
-nostdinc  -gnatn  s-mantis.adb -o s-mantis.o
/<<PKGBUILDDIR>>/gcc/build/./gcc/xgcc -B/<<PKGBUILDDIR>>/gcc/build/./gcc/
-B/usr/m68k-linux-gnu/bin/ -B/usr/m68k-linux-gnu/lib/ -isystem
/usr/m68k-linux-gnu/include -isystem /usr/m68k-linux-gnu/sys-include -isystem
/<<PKGBUILDDIR>>/gcc/build/sys-include    -c -g -O2   -W -Wall -gnatpg
-nostdinc  -gnatn  s-mastop.adb -o s-mastop.o
/<<PKGBUILDDIR>>/gcc/build/./gcc/xgcc -B/<<PKGBUILDDIR>>/gcc/build/./gcc/
-B/usr/m68k-linux-gnu/bin/ -B/usr/m68k-linux-gnu/lib/ -isystem
/usr/m68k-linux-gnu/include -isystem /usr/m68k-linux-gnu/sys-include -isystem
/<<PKGBUILDDIR>>/gcc/build/sys-include    -c -g -O2   -W -Wall -gnatpg
-nostdinc  -gnatn  s-memcop.ads -o s-memcop.o
/<<PKGBUILDDIR>>/gcc/build/./gcc/xgcc -B/<<PKGBUILDDIR>>/gcc/build/./gcc/
-B/usr/m68k-linux-gnu/bin/ -B/usr/m68k-linux-gnu/lib/ -isystem
/usr/m68k-linux-gnu/include -isystem /usr/m68k-linux-gnu/sys-include -isystem
/<<PKGBUILDDIR>>/gcc/build/sys-include    -c -g -O2   -W -Wall -gnatpg
-nostdinc  -gnatn -fno-optimize-sibling-calls  \
      s-memory.adb -o s-memory.o
/<<PKGBUILDDIR>>/gcc/build/./gcc/xgcc -B/<<PKGBUILDDIR>>/gcc/build/./gcc/
-B/usr/m68k-linux-gnu/bin/ -B/usr/m68k-linux-gnu/lib/ -isystem
/usr/m68k-linux-gnu/include -isystem /usr/m68k-linux-gnu/sys-include -isystem
/<<PKGBUILDDIR>>/gcc/build/sys-include    -c -g -O2   -W -Wall -gnatpg
-nostdinc  -gnatn  s-multip.adb -o s-multip.o
yes
s-maccod.ads:36:15: violation of No_Elaboration_Code_All at line 37
s-maccod.ads:36:15: unit "System" does not have No_Elaboration_Code_All
../gcc-interface/Makefile:299: recipe for target 's-maccod.o' failed
make[9]: *** [s-maccod.o] Error 1
make[9]: *** Waiting for unfinished jobs....

Comparing system-linux-m68k.ads with the equivalent code for other
architectures on Linux, it seems the following changes is necessary:

diff --git a/gcc/ada/system-linux-m68k.ads b/gcc/ada/system-linux-m68k.ads
index 9aa6143f262..2de957cfd9f 100644
--- a/gcc/ada/system-linux-m68k.ads                                             
+++ b/gcc/ada/system-linux-m68k.ads                                             
@@ -40,6 +40,9 @@ package System is                                             
    --  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;

@@ -126,7 +129,7 @@ private
    --  of the individual switch values.

    Backend_Divide_Checks     : constant Boolean := False;
-   Backend_Overflow_Checks   : constant Boolean := False;
+   Backend_Overflow_Checks   : constant Boolean := True;
    Command_Line_Args         : constant Boolean := True;
    Configurable_Run_Time     : constant Boolean := False;
    Denorm                    : constant Boolean := True;

I'm currently testing this patch and will report back once I have a result.

Reply via email to