[Bug ada/56616] gnatmake builds SAL incorrectly if library_kind is "static"

simon at pushface dot org gcc-bugzilla@gcc.gnu.org
Wed Apr 27 13:58:00 GMT 2016


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

--- Comment #3 from simon at pushface dot org ---
This PR was down to a lack of appreciation of the resources available.

If you provide a Library_Interface and you're building a dynamic
library, gprbuild populates the include Library_Src_Dir directory with
the library interface units and builds a dynamic library with
auto-initialization.

If you provide a Library_Interface and you're building a static library,
gprbuild uses the same rule to populate the include directory; but this
mey be wrong if the non-visible units require elaboration (e.g. they
call in the tasking runtime).

The patch I provided meant that if you provided a Library_Interface for
a static library, the include directory would be populated with all the
units regardless of whether they were actually listed; I now see that
using Interfaces and naming all the source files achieves the same
effect! so no need for a patch (but maybe a blog posting?)

For the BCs this would mean

   case Library_Type is
      when "relocatable" =>
         for Library_Src_Dir use "./include";
         for Library_Interface use Source_Units;
      when "static" =>
         for Library_Src_Dir use "./include";
         for Interfaces use Sources;
   end case;

where I already have

   Source_Units :=
     (
      "BC.Containers.Bags.Bounded",
      "BC.Containers.Bags.Dynamic",
      ...

and

   Sources :=
     (
      "bc-containers-bags-bounded.adb",
      "bc-containers-bags-bounded.ads",
      "bc-containers-bags-dynamic.adb",
      "bc-containers-bags-dynamic.ads",
      ...


More information about the Gcc-bugs mailing list