<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 30 Mar 2023, 08:31 Andrea Righi, <<a href="mailto:andrea.righi@canonical.com">andrea.righi@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Mar 29, 2023 at 03:13:56PM +0100, Andrei Gherzan wrote:<br>
> BugLink: <a href="https://bugs.launchpad.net/bugs/2013209" rel="noreferrer noreferrer" target="_blank">https://bugs.launchpad.net/bugs/2013209</a><br>
> <br>
> The Jammy kernel enabled CONFIG_EXPOLINE_EXTERN for s390x. While this<br>
> works as expected on Jammy, it won't work on some derivatives of it: for<br>
> example focal:hwe-5.15. On Focal, this config can't be enabled due to<br>
> the GCC version it comes with. CONFIG_EXPOLINE_EXTERN requires >= 110200<br>
> while Focal comes with 90400.<br>
> <br>
> This change adds a config check when packaging of the expoline.o.<br>
> <br>
> Signed-off-by: Andrei Gherzan <<a href="mailto:andrei.gherzan@canonical.com" target="_blank" rel="noreferrer">andrei.gherzan@canonical.com</a>><br>
> ---<br>
>  debian/rules.d/<a href="http://2-binary-arch.mk" rel="noreferrer noreferrer" target="_blank">2-binary-arch.mk</a> | 6 ++++--<br>
>  1 file changed, 4 insertions(+), 2 deletions(-)<br>
> <br>
> diff --git a/debian/rules.d/<a href="http://2-binary-arch.mk" rel="noreferrer noreferrer" target="_blank">2-binary-arch.mk</a> b/debian/rules.d/<a href="http://2-binary-arch.mk" rel="noreferrer noreferrer" target="_blank">2-binary-arch.mk</a><br>
> index 8e053f832b06..4fd528b0d7fd 100644<br>
> --- a/debian/rules.d/<a href="http://2-binary-arch.mk" rel="noreferrer noreferrer" target="_blank">2-binary-arch.mk</a><br>
> +++ b/debian/rules.d/<a href="http://2-binary-arch.mk" rel="noreferrer noreferrer" target="_blank">2-binary-arch.mk</a><br>
> @@ -335,8 +335,10 @@ ifeq ($(build_arch),powerpc)<br>
>       cp $(builddir)/build-$*/arch/powerpc/lib/*.o $(hdrdir)/arch/powerpc/lib<br>
>  endif<br>
>  ifeq ($(build_arch),s390)<br>
> -     mkdir -p $(hdrdir)/arch/s390/lib/expoline/<br>
> -     cp $(builddir)/build-$*/arch/s390/lib/expoline/*.o $(hdrdir)/arch/s390/lib/expoline/<br>
> +     if grep -q CONFIG_EXPOLINE_EXTERN=y $(builddir)/build-$*/.config; then \<br>
> +             mkdir -p $(hdrdir)/arch/s390/lib/expoline/; \<br>
> +             cp $(builddir)/build-$*/arch/s390/lib/expoline/*.o $(hdrdir)/arch/s390/lib/expoline/; \<br>
> +     fi<br>
<br>
We are implicitly assuming that CONFIG_EXPOLINE_EXTERN=y will always<br>
generate the *.o files that want to copy, how about checking for the<br>
presence of these files instead?<br>
<br>
In this way everything will continue to work even if the config option<br>
is renamed/removed or if it changes its behavior.<br>
<br>
Maybe something like this (untested):<br>
<br>
 # If there's at least one *.o file in the expoline build directory, copy<br>
 # it/them to $(hdrdir)/arch/s390/lib/expoline/<br>
 if [ -n "$(find $(builddir)/build-$*/arch/s390/lib/expoline/ -maxdepth 1 -name '*.o' -print -quit)" ]; then<br>
        mkdir -p $(hdrdir)/arch/s390/lib/expoline/; \<br>
        cp $(builddir)/build-$*/arch/s390/lib/expoline/*.o $(hdrdir)/arch/s390/lib/expoline/; \<br>
 fi<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I have considered this when fixing it. If we suspect that the config</div><div dir="auto">rename/change is probable, I equally considered that the path/etc</div><div dir="auto">might also change. But what skewed me into dealing with this at the</div><div dir="auto">config level is that there are cases in the same mk file where this is done similarly.</div><div dir="auto"><br></div><div dir="auto">On second thought, the advantage I see now with doing the check</div><div dir="auto">at the file/path level, is the fact that we don't tie a dependency between the</div><div dir="auto">annotation/config files and the rules (for this specific fix).</div><div dir="auto"><br></div><div dir="auto">I'll send a V2 tested with the check at the file/path level.</div><div dir="auto"><br></div><div dir="auto">Andrei</div></div>