diff mbox series

[Ada] Fix PR ada/99264

Message ID 2340977.15qcfLIRQH@fomalhaut
State New
Headers show
Series [Ada] Fix PR ada/99264 | expand

Commit Message

Eric Botcazou March 5, 2021, 11:45 a.m. UTC
This fixes the build breakage introduced by the latest glibc release.

Tested on x86-64/Linux, applied on mainline, 10 and 9 branches.


2021-03-05  Eric Botcazou  <ebotcazou@adacore.com>

	PR ada/99264
	* init.c (__gnat_alternate_sta) [Linux]: Remove preprocessor test on
	MINSIGSTKSZ and bump size to 32KB.
	* libgnarl/s-osinte__linux.ads (Alternate_Stack_Size): Bump to 32KB.

Comments

Matthias Klose March 12, 2021, 9:58 a.m. UTC | #1
Jakub reported that for glibc 2.34 (trunk, unreleased), Richard said it was
working for glibc 2.33 (latest release), your commit says "Fix build breakage
with latest glibc release" (which is 2.33). What is correct?

The change also caused CI test failures in Debian and Ubuntu as seen at
https://ci.debian.net/data/autopkgtest/unstable/amd64/a/ahven/10908933/log.gz
fail libgnat-10 10.2.1-21 (experimental)
https://ci.debian.net/data/autopkgtest/unstable/amd64/a/ahven/10908997/log.gz
pass libgnat-10 10.2.1-6 (unstable)

Citing Nicolas,

"""
The symptom
"/usr/lib/x86_64-linux-gnu/ada/adalib/ahven/ahven-framework.ali" is obsolete and
read-only
looks exactly like the scenario described by the Debian Ada Policy.
https://people.debian.org/~lbrenta/debian-ada-policy.html

Example with a simple dependency chain:
  libahven depends on libgnat
  ahven-tests depend on libahven
libahven contains, in ahven-framework.ali, a checksum of each source
it depends upon, including some libgnat sources.
When libgnat changes, libahven must be rebuilt before ahven-tests.
Else…
The error above is reported when building ahven-tests.
It mentions ahven-framework.ali from the libahven-dev package.
It actually originates in a change in libgnat.

The Debian Ada policy requires that such dependencies are encoded in
-dev package names so that dpkg later automatically prevents
inconsistent sets of .ali files and related cryptic messages.

In the special case of libgnat, built by GCC, there is only one
libgnatMAJOR package, containing the files usually expected in
libgnatSO and libgnatALI-dev. The sources are not expected to change
for a given MAJOR inside unstable.
"""


Assuming that the change is only required for glibc trunk (2.34), I'll revert
that for Debian's package builds for the gcc branches. I'll see what to do if I
still need gnat-10 when glibc 2.34 is in use.  Otoh, the patch could be
conditional on the glibc version detected.

Matthias


On 3/5/21 12:45 PM, Eric Botcazou wrote:
> This fixes the build breakage introduced by the latest glibc release.
> 
> Tested on x86-64/Linux, applied on mainline, 10 and 9 branches.
> 
> 
> 2021-03-05  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	PR ada/99264
> 	* init.c (__gnat_alternate_sta) [Linux]: Remove preprocessor test on
> 	MINSIGSTKSZ and bump size to 32KB.
> 	* libgnarl/s-osinte__linux.ads (Alternate_Stack_Size): Bump to 32KB.
>
Eric Botcazou March 12, 2021, 11 a.m. UTC | #2
> Jakub reported that for glibc 2.34 (trunk, unreleased), Richard said it was
> working for glibc 2.33 (latest release), your commit says "Fix build
> breakage with latest glibc release" (which is 2.33). What is correct?

Both I guess, mine is just a bit more forward-looking. ;-)

> The symptom
> "/usr/lib/x86_64-linux-gnu/ada/adalib/ahven/ahven-framework.ali" is obsolete
> and read-only
> looks exactly like the scenario described by the Debian Ada Policy.
> https://people.debian.org/~lbrenta/debian-ada-policy.html
> 
> Example with a simple dependency chain:
>   libahven depends on libgnat
>   ahven-tests depend on libahven
> libahven contains, in ahven-framework.ali, a checksum of each source
> it depends upon, including some libgnat sources.
> When libgnat changes, libahven must be rebuilt before ahven-tests.
> Else…
> The error above is reported when building ahven-tests.
> It mentions ahven-framework.ali from the libahven-dev package.
> It actually originates in a change in libgnat.
> 
> The Debian Ada policy requires that such dependencies are encoded in
> -dev package names so that dpkg later automatically prevents
> inconsistent sets of .ali files and related cryptic messages.
> 
> In the special case of libgnat, built by GCC, there is only one
> libgnatMAJOR package, containing the files usually expected in
> libgnatSO and libgnatALI-dev. The sources are not expected to change
> for a given MAJOR inside unstable.

The change is supposed to be binary compatible so not sure what this means.

> Assuming that the change is only required for glibc trunk (2.34), I'll
> revert that for Debian's package builds for the gcc branches. I'll see what
> to do if I still need gnat-10 when glibc 2.34 is in use.  Otoh, the patch
> could be conditional on the glibc version detected.

Too much hassle.  Please pester the glibc folks if you have any complaint.
Nicolas Boulenguez March 14, 2021, 5:56 p.m. UTC | #3
> The change is supposed to be binary compatible so not sure what this
> means.

Our problem is related with distribution, not with a specific library
or its ABI.  Imagine that:

$VENDOR1 builds GNAT without the fix.
$VENDOR2 builds libfoo against GNAT.
$administrator installs both.

I write bar.adb using foo.adb.

$VENDOR1 rebuilds GNAT with the fix modifying s-osinte__linux.ads and
s-osinte.ali.
$administrator updates GNAT.

My next attempt to rebuild bar.adb fails.

GNAT (correctly) reports that foo.ali is obsolete and should be
rebuilt against the updated s-osinte.ali.

I don’t understand the problem because I have never heard of
s-osinte.ali.  The error happens while building bar.adb, the message
mentions libfoo, but the problem originates in an unrelated GNAT
update.

Even if I did, I could not apply the right fix ($VENDOR2 should
rebuild libfoo fory all users).

Here VENDOR1=VENDOR2=administrator=Debian wants to prevent this
scenario for end users.  We must choose to revert the patch or rebuild
most Ada packages (the error may affects any recursive dependency of
libgnat…).  Currently, a stable release is in preparation so the
second option has a much higher price.
diff mbox series

Patch

diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index e76aa79c5a8..3ceb1a31b02 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -579,12 +579,8 @@  __gnat_error_handler (int sig, siginfo_t *si ATTRIBUTE_UNUSED, void *ucontext)
 
 #ifndef __ia64__
 #define HAVE_GNAT_ALTERNATE_STACK 1
-/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size.
-   It must be larger than MINSIGSTKSZ and hopefully near 2 * SIGSTKSZ.  */
-# if 16 * 1024 < MINSIGSTKSZ
-#  error "__gnat_alternate_stack too small"
-# endif
-char __gnat_alternate_stack[16 * 1024];
+/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size.  */
+char __gnat_alternate_stack[32 * 1024];
 #endif
 
 #ifdef __XENO__
diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads
index f7af00bf5e2..2272f83d68d 100644
--- a/gcc/ada/libgnarl/s-osinte__linux.ads
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads
@@ -328,7 +328,7 @@  package System.OS_Interface is
       oss : access stack_t) return int;
    pragma Import (C, sigaltstack, "sigaltstack");
 
-   Alternate_Stack_Size : constant := 16 * 1024;
+   Alternate_Stack_Size : constant := 32 * 1024;
    --  This must be in keeping with init.c:__gnat_alternate_stack
 
    Alternate_Stack : aliased char_array (1 .. Alternate_Stack_Size);