diff --git a/gcc/ada/libgnarl/a-exetim__posix.adb b/gcc/ada/libgnarl/a-exetim__posix.adb
index 05c55c567fa..6f3eecb2fe6 100644
--- a/gcc/ada/libgnarl/a-exetim__posix.adb
+++ b/gcc/ada/libgnarl/a-exetim__posix.adb
@@ -113,14 +113,14 @@ package body Ada.Execution_Time is
       function clock_gettime
         (clock_id : Interfaces.C.int;
          tp       : access timespec)
-         return int;
+         return Interfaces.C.int;
       pragma Import (C, clock_gettime, "clock_gettime");
       --  Function from the POSIX.1b Realtime Extensions library
 
       function pthread_getcpuclockid
         (tid       : Thread_Id;
          clock_id  : access Interfaces.C.int)
-         return int;
+         return Interfaces.C.int;
       pragma Import (C, pthread_getcpuclockid, "pthread_getcpuclockid");
       --  Function from the Thread CPU-Time Clocks option
 
diff --git a/gcc/ada/libgnat/a-direct.adb b/gcc/ada/libgnat/a-direct.adb
index adff12277e8..fbf249cd35e 100644
--- a/gcc/ada/libgnat/a-direct.adb
+++ b/gcc/ada/libgnat/a-direct.adb
@@ -1292,7 +1292,7 @@ package body Ada.Directories is
       Dir_Pointer      : Dir_Type_Value;
       File_Name_Addr   : Address;
       File_Name_Len    : aliased Integer;
-      Pattern_Regex    : Regexp;
+      Pattern_Regex    : System.Regexp.Regexp;
 
       Call_Result      : Integer;
       pragma Warnings (Off, Call_Result);
@@ -1377,7 +1377,7 @@ package body Ada.Directories is
                              Compose (Directory, File_Name) & ASCII.NUL;
                   Path   : String renames
                              Path_C (Path_C'First .. Path_C'Last - 1);
-                  Attr   : aliased File_Attributes;
+                  Attr   : aliased System.File_Attributes.File_Attributes;
                   Exists : Integer;
                   Error  : Integer;
 
diff --git a/gcc/ada/libgnat/a-nbnbin.adb b/gcc/ada/libgnat/a-nbnbin.adb
index 91074cfbc5c..2d140a49e53 100644
--- a/gcc/ada/libgnat/a-nbnbin.adb
+++ b/gcc/ada/libgnat/a-nbnbin.adb
@@ -69,7 +69,8 @@ package body Ada.Numerics.Big_Numbers.Big_Integers is
    package Bignums is new System.Generic_Bignums
      (Bignum, Allocate_Bignum, Free_Bignum, To_Bignum);
 
-   use Bignums, System;
+   use System, Bignums;
+   subtype Bignum is Bignums.Bignum;
 
    function Get_Bignum (Arg : Big_Integer) return Bignum is
      (if Arg.Value.C = System.Null_Address
diff --git a/gcc/ada/libgnat/a-timoio.adb b/gcc/ada/libgnat/a-timoio.adb
index 65222c1ea0d..eec92e3959a 100644
--- a/gcc/ada/libgnat/a-timoio.adb
+++ b/gcc/ada/libgnat/a-timoio.adb
@@ -36,11 +36,14 @@ with System.Img_LLB; use System.Img_LLB;
 with System.Img_LLU; use System.Img_LLU;
 with System.Img_LLW; use System.Img_LLW;
 with System.Img_WIU; use System.Img_WIU;
+with System.Unsigned_Types;
 with System.Val_Uns; use System.Val_Uns;
 with System.Val_LLU; use System.Val_LLU;
 
 package body Ada.Text_IO.Modular_IO is
 
+   subtype Unsigned is System.Unsigned_Types.Unsigned;
+
    package Aux_Uns is new
      Ada.Text_IO.Integer_Aux
        (Unsigned,
@@ -49,6 +52,8 @@ package body Ada.Text_IO.Modular_IO is
         Set_Image_Width_Unsigned,
         Set_Image_Based_Unsigned);
 
+   subtype Long_Long_Unsigned is System.Unsigned_Types.Long_Long_Unsigned;
+
    package Aux_LLU is new
      Ada.Text_IO.Integer_Aux
        (Long_Long_Unsigned,
diff --git a/gcc/ada/libgnat/a-timoio__128.adb b/gcc/ada/libgnat/a-timoio__128.adb
index fbf31cf8035..d85fb059ce6 100644
--- a/gcc/ada/libgnat/a-timoio__128.adb
+++ b/gcc/ada/libgnat/a-timoio__128.adb
@@ -39,12 +39,15 @@ with System.Img_LLLB; use System.Img_LLLB;
 with System.Img_LLLU; use System.Img_LLLU;
 with System.Img_LLLW; use System.Img_LLLW;
 with System.Img_WIU;  use System.Img_WIU;
+with System.Unsigned_Types;
 with System.Val_Uns;  use System.Val_Uns;
 with System.Val_LLU;  use System.Val_LLU;
 with System.Val_LLLU; use System.Val_LLLU;
 
 package body Ada.Text_IO.Modular_IO is
 
+   subtype Unsigned is System.Unsigned_Types.Unsigned;
+
    package Aux_Uns is new
      Ada.Text_IO.Integer_Aux
        (Unsigned,
@@ -53,6 +56,8 @@ package body Ada.Text_IO.Modular_IO is
         Set_Image_Width_Unsigned,
         Set_Image_Based_Unsigned);
 
+   subtype Long_Long_Unsigned is System.Unsigned_Types.Long_Long_Unsigned;
+
    package Aux_LLU is new
      Ada.Text_IO.Integer_Aux
        (Long_Long_Unsigned,
@@ -61,6 +66,9 @@ package body Ada.Text_IO.Modular_IO is
         Set_Image_Width_Long_Long_Unsigned,
         Set_Image_Based_Long_Long_Unsigned);
 
+   subtype Long_Long_Long_Unsigned is
+     System.Unsigned_Types.Long_Long_Long_Unsigned;
+
    package Aux_LLLU is new
      Ada.Text_IO.Integer_Aux
        (Long_Long_Long_Unsigned,
diff --git a/gcc/ada/libgnat/a-wtmoio.adb b/gcc/ada/libgnat/a-wtmoio.adb
index 6f50bf590b0..f83bb700773 100644
--- a/gcc/ada/libgnat/a-wtmoio.adb
+++ b/gcc/ada/libgnat/a-wtmoio.adb
@@ -36,6 +36,7 @@ with System.Img_LLB; use System.Img_LLB;
 with System.Img_LLU; use System.Img_LLU;
 with System.Img_LLW; use System.Img_LLW;
 with System.Img_WIU; use System.Img_WIU;
+with System.Unsigned_Types;
 with System.Val_Uns; use System.Val_Uns;
 with System.Val_LLU; use System.Val_LLU;
 with System.WCh_Con; use System.WCh_Con;
@@ -43,6 +44,8 @@ with System.WCh_WtS; use System.WCh_WtS;
 
 package body Ada.Wide_Text_IO.Modular_IO is
 
+   subtype Unsigned is System.Unsigned_Types.Unsigned;
+
    package Aux_Uns is new
      Ada.Wide_Text_IO.Integer_Aux
        (Unsigned,
@@ -51,6 +54,8 @@ package body Ada.Wide_Text_IO.Modular_IO is
         Set_Image_Width_Unsigned,
         Set_Image_Based_Unsigned);
 
+   subtype Long_Long_Unsigned is System.Unsigned_Types.Long_Long_Unsigned;
+
    package Aux_LLU is new
      Ada.Wide_Text_IO.Integer_Aux
        (Long_Long_Unsigned,
diff --git a/gcc/ada/libgnat/a-wtmoio__128.adb b/gcc/ada/libgnat/a-wtmoio__128.adb
index 1a11aeea615..83ab19d2965 100644
--- a/gcc/ada/libgnat/a-wtmoio__128.adb
+++ b/gcc/ada/libgnat/a-wtmoio__128.adb
@@ -39,6 +39,7 @@ with System.Img_LLLB; use System.Img_LLLB;
 with System.Img_LLLU; use System.Img_LLLU;
 with System.Img_LLLW; use System.Img_LLLW;
 with System.Img_WIU;  use System.Img_WIU;
+with System.Unsigned_Types;
 with System.Val_Uns;  use System.Val_Uns;
 with System.Val_LLU;  use System.Val_LLU;
 with System.Val_LLLU; use System.Val_LLLU;
@@ -47,6 +48,8 @@ with System.WCh_WtS;  use System.WCh_WtS;
 
 package body Ada.Wide_Text_IO.Modular_IO is
 
+   subtype Unsigned is System.Unsigned_Types.Unsigned;
+
    package Aux_Uns is new
      Ada.Wide_Text_IO.Integer_Aux
        (Unsigned,
@@ -55,6 +58,8 @@ package body Ada.Wide_Text_IO.Modular_IO is
         Set_Image_Width_Unsigned,
         Set_Image_Based_Unsigned);
 
+   subtype Long_Long_Unsigned is System.Unsigned_Types.Long_Long_Unsigned;
+
    package Aux_LLU is new
      Ada.Wide_Text_IO.Integer_Aux
        (Long_Long_Unsigned,
@@ -63,6 +68,9 @@ package body Ada.Wide_Text_IO.Modular_IO is
         Set_Image_Width_Long_Long_Unsigned,
         Set_Image_Based_Long_Long_Unsigned);
 
+   subtype Long_Long_Long_Unsigned is
+     System.Unsigned_Types.Long_Long_Long_Unsigned;
+
    package Aux_LLLU is new
      Ada.Wide_Text_IO.Integer_Aux
        (Long_Long_Long_Unsigned,
diff --git a/gcc/ada/libgnat/a-ztmoio.adb b/gcc/ada/libgnat/a-ztmoio.adb
index 512cd803f13..6f39e533167 100644
--- a/gcc/ada/libgnat/a-ztmoio.adb
+++ b/gcc/ada/libgnat/a-ztmoio.adb
@@ -36,6 +36,7 @@ with System.Img_LLB; use System.Img_LLB;
 with System.Img_LLU; use System.Img_LLU;
 with System.Img_LLW; use System.Img_LLW;
 with System.Img_WIU; use System.Img_WIU;
+with System.Unsigned_Types;
 with System.Val_Uns; use System.Val_Uns;
 with System.Val_LLU; use System.Val_LLU;
 with System.WCh_Con; use System.WCh_Con;
@@ -43,6 +44,8 @@ with System.WCh_WtS; use System.WCh_WtS;
 
 package body Ada.Wide_Wide_Text_IO.Modular_IO is
 
+   subtype Unsigned is System.Unsigned_Types.Unsigned;
+
    package Aux_Uns is new
      Ada.Wide_Wide_Text_IO.Integer_Aux
        (Unsigned,
@@ -51,6 +54,8 @@ package body Ada.Wide_Wide_Text_IO.Modular_IO is
         Set_Image_Width_Unsigned,
         Set_Image_Based_Unsigned);
 
+   subtype Long_Long_Unsigned is System.Unsigned_Types.Long_Long_Unsigned;
+
    package Aux_LLU is new
      Ada.Wide_Wide_Text_IO.Integer_Aux
        (Long_Long_Unsigned,
diff --git a/gcc/ada/libgnat/a-ztmoio__128.adb b/gcc/ada/libgnat/a-ztmoio__128.adb
index b62a41dccc7..3410513aded 100644
--- a/gcc/ada/libgnat/a-ztmoio__128.adb
+++ b/gcc/ada/libgnat/a-ztmoio__128.adb
@@ -39,6 +39,7 @@ with System.Img_LLLB; use System.Img_LLLB;
 with System.Img_LLLU; use System.Img_LLLU;
 with System.Img_LLLW; use System.Img_LLLW;
 with System.Img_WIU;  use System.Img_WIU;
+with System.Unsigned_Types;
 with System.Val_Uns;  use System.Val_Uns;
 with System.Val_LLU;  use System.Val_LLU;
 with System.Val_LLLU; use System.Val_LLLU;
@@ -47,6 +48,8 @@ with System.WCh_WtS;  use System.WCh_WtS;
 
 package body Ada.Wide_Wide_Text_IO.Modular_IO is
 
+   subtype Unsigned is System.Unsigned_Types.Unsigned;
+
    package Aux_Uns is new
      Ada.Wide_Wide_Text_IO.Integer_Aux
        (Unsigned,
@@ -55,6 +58,8 @@ package body Ada.Wide_Wide_Text_IO.Modular_IO is
         Set_Image_Width_Unsigned,
         Set_Image_Based_Unsigned);
 
+   subtype Long_Long_Unsigned is System.Unsigned_Types.Long_Long_Unsigned;
+
    package Aux_LLU is new
      Ada.Wide_Wide_Text_IO.Integer_Aux
        (Long_Long_Unsigned,
@@ -63,6 +68,9 @@ package body Ada.Wide_Wide_Text_IO.Modular_IO is
         Set_Image_Width_Long_Long_Unsigned,
         Set_Image_Based_Long_Long_Unsigned);
 
+   subtype Long_Long_Long_Unsigned is
+     System.Unsigned_Types.Long_Long_Long_Unsigned;
+
    package Aux_LLLU is new
      Ada.Wide_Wide_Text_IO.Integer_Aux
        (Long_Long_Long_Unsigned,
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index c77a69e5118..99060061471 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -6323,7 +6323,9 @@ package body Sem_Ch8 is
                Nvis_Messages;
                goto Done;
 
-            elsif Is_Predefined_Unit (Current_Sem_Unit) then
+            elsif Is_Predefined_Unit (Current_Sem_Unit)
+              and then not Is_Predefined_Unit (Main_Unit)
+            then
                --  A use clause in the body of a system file creates conflict
                --  with some entity in a user scope, while rtsfind is active.
                --  Keep only the entity coming from another predefined unit.
