Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 915060 - dev-libs/libgcrypt-1.10.2: compile on i686 with -Og fails with error: 'asm' operand has impossible constraints
Summary: dev-libs/libgcrypt-1.10.2: compile on i686 with -Og fails with error: 'asm' o...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-02 01:18 UTC by tedheadster
Modified: 2024-03-04 02:38 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,5.47 KB, text/plain)
2023-10-03 02:34 UTC, tedheadster
Details
libgcrypt build.log (libgcrypt-build.log,45.96 KB, text/x-log)
2023-10-03 02:35 UTC, tedheadster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tedheadster 2023-10-02 01:18:58 UTC
While installing the latest stage3-i686-systemd-20230925T170144Z build, attempting to rebuild from source caused a compile time error. The file being compiled was:

libgcrypt-1.10.2/mpi/ec-nist.c:34:
ec-nist.c: In function '_gcry_mpi_ec_nist256_mod:
libgcrypt-1.10.2/mpi/ec-inline.h:701:3: error: 'asm' operand has impossible constraints:

701: __asm__ ("subl %11, %3\n" \

(apologies for hand typing, all I had was a console session)

This was a completely fresh i686 install with just debugging information enabled for compiler flags.


Reproducible: Always

Steps to Reproduce:
1. Do a new install
2. emerge --buildpkg --emptytree @world

And the build fails on dev-libs/libgcrypt-1.10.2

Actual Results:  
emerge stops

Expected Results:  
emerge should run to completion on a new install


/etc/portage/env/debugsyms:
# start
CFLAGS="${CFLAGS} -ggdb"
CXXFLAGS="${CXXFLAGS} -ggdb"
FEATURES="${FEATURES} splitdebug compressdebug -nostrip"
# end

/etc/portage/env/installsources:
# start
FEATURES="${FEATURES} installsources"
# end

/etc/portage/package.env:
# start
*/* debugsyms installsources
# end

Packages added in addition to stage3 base:

dev-libs/elfutils dev-libs/nspr dev-lang/tcl dev-db/sqlite dev-libs/nss dev-util/debugedit dev-vcs/git app-misc/screen app-portage/gentoolkit app-portage/eix sys-devel/bc sys-kernel/genkernel
Comment 1 tedheadster 2023-10-03 02:34:38 UTC
Created attachment 872066 [details]
emerge --info
Comment 2 tedheadster 2023-10-03 02:35:01 UTC
Created attachment 872067 [details]
libgcrypt build.log
Comment 3 tedheadster 2023-12-10 20:16:50 UTC
What is the status of this bug?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-10 20:17:58 UTC
It means open, I hadn't seen it at the time. Is 1.10.3 any better?
Comment 5 tedheadster 2023-12-10 20:27:00 UTC
No change in 1.10.3, it fails with the same error.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-15 05:53:15 UTC
-O2 is fine but -Og fails for me too.

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3/mpi -I.. -I../src -I/var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3/src -Og -march=i686 -fvisibility=hidden -fno-delete-null-pointer-checks -Wall -c /var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3/mpi/ec-nist.c  -fPIC -DPIC -o .libs/ec-nist.o
In file included from /var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3/mpi/ec-nist.c:34:
/var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3/mpi/ec-nist.c: In function '_gcry_mpi_ec_nist256_mod':
/var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3/mpi/ec-inline.h:701:3: error: 'asm' operand has impossible constraints
  701 |   __asm__ ("subl %11, %3\n" \
      |   ^~~~~~~
/var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3/mpi/ec-inline.h:894:9: note: in expansion of macro 'SUB4_LIMB32'
  894 |         SUB4_LIMB32(A1.hi, A1.lo, A0.hi, A0.lo, \
      |         ^~~~~~~~~~~
/var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3/mpi/ec-inline.h:1009:5: note: in expansion of macro 'SUB2_LIMB64'
 1009 |     SUB2_LIMB64(A4, A3, B4, B3, C4, C3); \
      |     ^~~~~~~~~~~
/var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3/mpi/ec-nist.c:474:3: note: in expansion of macro 'SUB5_LIMB64'
  474 |   SUB5_LIMB64 (s[4], s[3], s[2], s[1], s[0],
      |   ^~~~~~~~~~~
make[2]: *** [Makefile:664: ec-nist.lo] Error 1
make[2]: Leaving directory '/var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3-abi_x86_32.x86/mpi'
make[1]: *** [Makefile:505: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/dev-libs/libgcrypt-1.10.3/work/libgcrypt-1.10.3-abi_x86_32.x86'
make: *** [Makefile:437: all] Error 2
 * ERROR: dev-libs/libgcrypt-1.10.3::gentoo failed (compile phase):
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-15 06:11:17 UTC
Reported upstream at https://dev.gnupg.org/T6892. As a workaround, use -O2.
Comment 8 tedheadster 2023-12-20 13:51:01 UTC
Should we enlist help from the compiler group?
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-20 13:53:37 UTC
(In reply to tedheadster from comment #8)
> Should we enlist help from the compiler group?

It's already being discussed upstream (see the link). If you mean the compiler/toolchain group in Gentoo, we could, but: 1) I'm one of them; 2) upstream are already working on it, so what's the point?

Ultimately, as mentioned on the upstream bug, less optimisation is often quite challenging on (32-bit) x86 because of the small number of GPRs. Anything which might result in an extra register being needed (because of a missed/skipped optimisation) can have quite a big impact.

I don't really see the need for any intervention.
Comment 10 Larry the Git Cow gentoo-dev 2024-03-04 02:38:04 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=361b44c3bbbb24c615c26b5ba36cc84a80968f33

commit 361b44c3bbbb24c615c26b5ba36cc84a80968f33
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-03-04 02:37:32 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-04 02:37:32 +0000

    dev-libs/libgcrypt: backport asm fixes
    
    * Backport fixes for x86 with less/no optimisation
    * Backport HPPA asm fix
    
    Closes: https://bugs.gentoo.org/915060
    Closes: https://bugs.gentoo.org/925284
    Signed-off-by: Sam James <sam@gentoo.org>

 .../libgcrypt/files/libgcrypt-1.10.3-hppa.patch    | 110 ++++++
 .../files/libgcrypt-1.10.3-x86-refactor.patch      | 428 +++++++++++++++++++++
 .../libgcrypt/files/libgcrypt-1.10.3-x86.patch     |  94 +++++
 dev-libs/libgcrypt/libgcrypt-1.10.3-r2.ebuild      | 178 +++++++++
 4 files changed, 810 insertions(+)