Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline assembly in range_decoder.h is incompatible with old Binutils #121

Closed
wmjb opened this issue May 18, 2024 · 12 comments
Closed

Inline assembly in range_decoder.h is incompatible with old Binutils #121

wmjb opened this issue May 18, 2024 · 12 comments

Comments

@wmjb
Copy link

wmjb commented May 18, 2024

I just wanted to compile the latest src for xz

in the absence of clear instructions on the opening page of the git repo, and the INSTALL file being a TLDR nightmare, after years of experience of compiling stuff, i used my intuition to try to compile it

so i git clone https://github.com/tukaani-project/xz --depth=1

(--depth=1, because i don't want to download all the commit history, which should not be necessary to build)

then i ran ./autogen.sh
and then ran ./configure
then ran make

(pretty standard universal compile steps, that work with most src using cmake/make)

then i got this error

lzma/lzma_decoder.c: Assembler messages:
lzma/lzma_decoder.c:371: Error: no such instruction: movzw 2(%r15),%esi' lzma/lzma_decoder.c:373: Error: no such instruction: movzw 4(%r15),%edi'
lzma/lzma_decoder.c:388: Error: no such instruction: movzw 6(%r15),%edx' lzma/lzma_decoder.c:398: Error: no such instruction: movzw (%r15,%r14,4),%esi'
lzma/lzma_decoder.c:413: Error: no such instruction: movzw 2(%r15,%r14,4),%edx' lzma/lzma_decoder.c:424: Error: no such instruction: movzw (%r15,%r14,4),%edi'
lzma/lzma_decoder.c:439: Error: no such instruction: movzw 2(%r15,%r14,4),%edx' lzma/lzma_decoder.c:450: Error: no such instruction: movzw (%r15,%r14,4),%esi'
lzma/lzma_decoder.c:465: Error: no such instruction: movzw 2(%r15,%r14,4),%edx' lzma/lzma_decoder.c:476: Error: no such instruction: movzw (%r15,%r14,4),%edi'
lzma/lzma_decoder.c:491: Error: no such instruction: movzw 2(%r15,%r14,4),%edx' lzma/lzma_decoder.c:502: Error: no such instruction: movzw (%r15,%r14,4),%esi'
lzma/lzma_decoder.c:517: Error: no such instruction: movzw 2(%r15,%r14,4),%edx' lzma/lzma_decoder.c:528: Error: no such instruction: movzw (%r15,%r14,4),%edi'
lzma/lzma_decoder.c:543: Error: no such instruction: movzw 2(%r15,%r14,4),%edx' lzma/lzma_decoder.c:421: Error: no such instruction: movzw 2(%rax),%edi'
lzma/lzma_decoder.c:423: Error: no such instruction: movzw 4(%rax),%r10d' lzma/lzma_decoder.c:438: Error: no such instruction: movzw 6(%rax),%ecx'
lzma/lzma_decoder.c:448: Error: no such instruction: movzw (%rax,%rdx,4),%edi' lzma/lzma_decoder.c:463: Error: no such instruction: movzw 2(%rax,%rdx,4),%ecx'
lzma/lzma_decoder.c:430: Error: no such instruction: movzw 2(%r15),%esi' lzma/lzma_decoder.c:432: Error: no such instruction: movzw 4(%r15),%edi'
lzma/lzma_decoder.c:447: Error: no such instruction: movzw 6(%r15),%eax' lzma/lzma_decoder.c:457: Error: no such instruction: movzw (%r15,%rdx,4),%esi'
lzma/lzma_decoder.c:472: Error: no such instruction: movzw 2(%r15,%rdx,4),%eax' lzma/lzma_decoder.c:483: Error: no such instruction: movzw (%r15,%rdx,4),%edi'
lzma/lzma_decoder.c:498: Error: no such instruction: movzw 2(%r15,%rdx,4),%eax' lzma/lzma_decoder.c:509: Error: no such instruction: movzw (%r15,%rdx,4),%esi'
lzma/lzma_decoder.c:524: Error: no such instruction: movzw 2(%r15,%rdx,4),%eax' lzma/lzma_decoder.c:535: Error: no such instruction: movzw (%r15,%rdx,4),%edi'
lzma/lzma_decoder.c:550: Error: no such instruction: movzw 2(%r15,%rdx,4),%eax' lzma/lzma_decoder.c:487: Error: no such instruction: movzw (%r15,%rdi,2),%r13d'
lzma/lzma_decoder.c:379: Error: no such instruction: movzw (%r15,%r14,2),%r10d' lzma/lzma_decoder.c:411: Error: no such instruction: movzw (%r15,%r14,2),%r10d'
lzma/lzma_decoder.c:443: Error: no such instruction: movzw (%r15,%r14,2),%r10d' lzma/lzma_decoder.c:475: Error: no such instruction: movzw (%r15,%r14,2),%r10d'
lzma/lzma_decoder.c:507: Error: no such instruction: movzw (%r15,%r14,2),%r10d' lzma/lzma_decoder.c:539: Error: no such instruction: movzw (%r15,%r14,2),%r10d'
lzma/lzma_decoder.c:571: Error: no such instruction: movzw (%r15,%r14,2),%r10d' lzma/lzma_decoder.c:603: Error: no such instruction: movzw (%r15,%r14,2),%r10d'
lzma/lzma_decoder.c:421: Error: no such instruction: movzw 2(%rax),%edi' lzma/lzma_decoder.c:423: Error: no such instruction: movzw 4(%rax),%r10d'
lzma/lzma_decoder.c:438: Error: no such instruction: movzw 6(%rax),%ecx' lzma/lzma_decoder.c:448: Error: no such instruction: movzw (%rax,%rdx,4),%edi'
lzma/lzma_decoder.c:463: Error: no such instruction: movzw 2(%rax,%rdx,4),%ecx' lzma/lzma_decoder.c:627: Error: no such instruction: movzw 2(%rax),%esi'
lzma/lzma_decoder.c:629: Error: no such instruction: movzw 4(%rax),%edi' lzma/lzma_decoder.c:644: Error: no such instruction: movzw 6(%rax),%edx'
lzma/lzma_decoder.c:654: Error: no such instruction: movzw (%rax,%r14,4),%esi' lzma/lzma_decoder.c:669: Error: no such instruction: movzw 2(%rax,%r14,4),%edx'
lzma/lzma_decoder.c:627: Error: no such instruction: movzw 2(%rax),%esi' lzma/lzma_decoder.c:629: Error: no such instruction: movzw 4(%rax),%edi'
lzma/lzma_decoder.c:644: Error: no such instruction: movzw 6(%rax),%edx' lzma/lzma_decoder.c:654: Error: no such instruction: movzw (%rax,%r14,4),%esi'
lzma/lzma_decoder.c:669: Error: no such instruction: movzw 2(%rax,%r14,4),%edx' lzma/lzma_decoder.c:506: Error: no such instruction: movzw 2(%r10),%esi'
lzma/lzma_decoder.c:508: Error: no such instruction: movzw 4(%r10),%edi' lzma/lzma_decoder.c:523: Error: no such instruction: movzw 6(%r10),%edx'
lzma/lzma_decoder.c:533: Error: no such instruction: movzw 8(%r10,%r14,2),%esi' lzma/lzma_decoder.c:548: Error: no such instruction: movzw 12(%r10,%r14,2),%edx'
lzma/lzma_decoder.c:559: Error: no such instruction: movzw 16(%r10,%r14,2),%edi' lzma/lzma_decoder.c:574: Error: no such instruction: movzw 24(%r10,%r14,2),%edx'
lzma/lzma_decoder.c:421: Error: no such instruction: movzw 2(%rcx),%edi' lzma/lzma_decoder.c:423: Error: no such instruction: movzw 4(%rcx),%r10d'
lzma/lzma_decoder.c:438: Error: no such instruction: movzw 6(%rcx),%edx' lzma/lzma_decoder.c:448: Error: no such instruction: movzw (%rcx,%rax,4),%edi'
lzma/lzma_decoder.c:463: Error: no such instruction: movzw 2(%rcx,%rax,4),%edx' lzma/lzma_decoder.c:474: Error: no such instruction: movzw (%rcx,%rax,4),%r10d'
lzma/lzma_decoder.c:489: Error: no such instruction: movzw 2(%rcx,%rax,4),%edx' lzma/lzma_decoder.c:500: Error: no such instruction: movzw (%rcx,%rax,4),%edi'
lzma/lzma_decoder.c:515: Error: no such instruction: movzw 2(%rcx,%rax,4),%edx' lzma/lzma_decoder.c:526: Error: no such instruction: movzw (%rcx,%rax,4),%r10d'
lzma/lzma_decoder.c:541: Error: no such instruction: movzw 2(%rcx,%rax,4),%edx' lzma/lzma_decoder.c:552: Error: no such instruction: movzw (%rcx,%rax,4),%edi'
lzma/lzma_decoder.c:567: Error: no such instruction: movzw 2(%rcx,%rax,4),%edx' lzma/lzma_decoder.c:578: Error: no such instruction: movzw (%rcx,%rax,4),%r10d'
lzma/lzma_decoder.c:593: Error: no such instruction: movzw 2(%rcx,%rax,4),%edx' lzma/lzma_decoder.c:627: Error: no such instruction: movzw 2(%rdi),%ecx'
lzma/lzma_decoder.c:629: Error: no such instruction: movzw 4(%rdi),%esi' lzma/lzma_decoder.c:644: Error: no such instruction: movzw 6(%rdi),%eax'
lzma/lzma_decoder.c:654: Error: no such instruction: movzw (%rdi,%r14,4),%ecx' lzma/lzma_decoder.c:669: Error: no such instruction: movzw 2(%rdi,%r14,4),%eax'
lzma/lzma_decoder.c:680: Error: no such instruction: movzw (%rdi,%r14,4),%esi' lzma/lzma_decoder.c:695: Error: no such instruction: movzw 2(%rdi,%r14,4),%eax'
lzma/lzma_decoder.c:706: Error: no such instruction: movzw (%rdi,%r14,4),%ecx' lzma/lzma_decoder.c:721: Error: no such instruction: movzw 2(%rdi,%r14,4),%eax'
lzma/lzma_decoder.c:732: Error: no such instruction: movzw (%rdi,%r14,4),%esi' lzma/lzma_decoder.c:747: Error: no such instruction: movzw 2(%rdi,%r14,4),%eax'
lzma/lzma_decoder.c:758: Error: no such instruction: movzw (%rdi,%r14,4),%ecx' lzma/lzma_decoder.c:773: Error: no such instruction: movzw 2(%rdi,%r14,4),%eax'
lzma/lzma_decoder.c:784: Error: no such instruction: movzw (%rdi,%r14,4),%esi' lzma/lzma_decoder.c:799: Error: no such instruction: movzw 2(%rdi,%r14,4),%eax'
Makefile:1482: recipe for target 'liblzma_la-lzma_decoder.lo' failed

what am i doing wrong and why are there no compile instructions on the main page?

i suggest you stick some basic compile instructions instead of that wall of text on the main page.

@thesamesam
Copy link
Member

Please focus on the actual issue (failure to compile). The steps you laid out for a regular autotools project should work here. They didn't for you, so let's try figure out why:

  • Please share config.log
  • Ideally share the output of ./configure too, although it can be derived from config.log
  • Please share what platform you're on, including toolchain versions

Suggestions for improving documentation are welcome, but "it shouldn't be this hard" would apply to anyone who hits an issue. It doesn't add anything here. Anyone who files a bug ever could vent their frustration therein but it doesn't get anyone anywhere.

@Larhzu
Copy link
Member

Larhzu commented May 18, 2024

in the absence of clear instructions on the opening page of the git repo, and the INSTALL file being a TLDR nightmare

I'm sorry that the experience has been negative. As you may have noticed, the home page of XZ Utils is currently quite empty but it's one of things I've been working on recently (GitHub is not the home page, it's just a place to host the repository). That happens to include writing new instructions on how to build from the Git repository. It will include more information than just running ./autogen.sh to generate configure so hopefully it won't be too long.

It is also true that some of the docs in the package (and thus Git repository) could be improved as some of the content is quite old and possibly a bit outdated. For example, README and INSTALL were written in a time where most would download a release tarball and build from that, and Git repository was for the few who knew how to handle it anyway. In any case I'm aware that content of the docs could be improved, it's just that there are many other things to do too. This is a hobby project, after all.

then i ran ./autogen.sh
and then ran ./configure
then ran make

In any case, you have already correctly determined the commands to use. These are indeed quite universal steps with packages that build with Autotools. However, it seems that it didn't work. This means that it is possible that you have found a bug in XZ Utils. Thank you for reporting it!

Unfortunately you didn't include the basic information:

  • Hardware type (like x86-64)
  • Operating system
  • Compiler and version

I understand it's easy to forget those. (Previously there were (too) fancy issue templates which asked a bunch of questions. When the other maintainer disappeared, I deleted those templates as I thought it would be easy to ask in case a bug reporter doesn't mention them in their first post.)

As @thesamesam wrote, the contents of config.log could be useful too, but getting just the above three things should help quite a bit.

then i got this error

The inline assembly is used when compiling with GCC or Clang for x86-64. However, some compilers pretend to be GCC or Clang and that could be one reason for the problem. Perhaps it's possible that a compiler pretends to target x86-64 but actually doesn't and then things go wrong too. It's not useful for me guess further until you provide the hardware, OS, and compiler information.

Thanks!

@Larhzu Larhzu added the question Further information is requested label May 29, 2024
@Larhzu
Copy link
Member

Larhzu commented May 29, 2024

Please re-open if more information is available.

@Larhzu Larhzu closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
@biergaizi
Copy link
Contributor

I'm now experiencing the same problem today during an attempt to bootstrap Gentoo prefix (non RAP) on an old system. It fails in stage 2 for package app-arch/xz-utils-5.6.2-r1. This system has GCC 5.3.0 and Binutils 2.25, so my guess is that these assembly instructions generated by GCC are incompatible with very old sys-devel/binutils or sys-devel/gcc.

After a Web search, I suspect (but can't confirm) it's related one of these issues:

Strangely enough, I don't see any inline assembly in liblzma, it seems to be code generated by GCC. But even if I use GCC 4.9, the problem still occurs.

A Ubuntu 16.04.7 LTS user also reported this problem to liblzma: kobolabs/liblzma#4

/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c: Assembler messages:
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:371: Error: no such instruction: `movzw 2(%r11),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:373: Error: no such instruction: `movzw 4(%r11),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:388: Error: no such instruction: `movzw 6(%r11),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:398: Error: no such instruction: `movzw (%r11,%r14,4),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:413: Error: no such instruction: `movzw 2(%r11,%r14,4),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:424: Error: no such instruction: `movzw (%r11,%r14,4),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:439: Error: no such instruction: `movzw 2(%r11,%r14,4),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:450: Error: no such instruction: `movzw (%r11,%r14,4),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:465: Error: no such instruction: `movzw 2(%r11,%r14,4),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:476: Error: no such instruction: `movzw (%r11,%r14,4),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:491: Error: no such instruction: `movzw 2(%r11,%r14,4),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:502: Error: no such instruction: `movzw (%r11,%r14,4),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:517: Error: no such instruction: `movzw 2(%r11,%r14,4),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:528: Error: no such instruction: `movzw (%r11,%r14,4),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:543: Error: no such instruction: `movzw 2(%r11,%r14,4),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:421: Error: no such instruction: `movzw 2(%rax),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:423: Error: no such instruction: `movzw 4(%rax),%r9d'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:438: Error: no such instruction: `movzw 6(%rax),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:448: Error: no such instruction: `movzw (%rax,%rdx,4),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:463: Error: no such instruction: `movzw 2(%rax,%rdx,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:430: Error: no such instruction: `movzw 2(%r11),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:432: Error: no such instruction: `movzw 4(%r11),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:447: Error: no such instruction: `movzw 6(%r11),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:457: Error: no such instruction: `movzw (%r11,%rdx,4),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:472: Error: no such instruction: `movzw 2(%r11,%rdx,4),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:483: Error: no such instruction: `movzw (%r11,%rdx,4),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:498: Error: no such instruction: `movzw 2(%r11,%rdx,4),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:509: Error: no such instruction: `movzw (%r11,%rdx,4),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:524: Error: no such instruction: `movzw 2(%r11,%rdx,4),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:535: Error: no such instruction: `movzw (%r11,%rdx,4),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:550: Error: no such instruction: `movzw 2(%r11,%rdx,4),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:487: Error: no such instruction: `movzw (%r11,%rdi,2),%r13d'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:379: Error: no such instruction: `movzw (%r11,%r14,2),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:411: Error: no such instruction: `movzw (%r11,%r14,2),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:443: Error: no such instruction: `movzw (%r11,%r14,2),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:475: Error: no such instruction: `movzw (%r11,%r14,2),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:507: Error: no such instruction: `movzw (%r11,%r14,2),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:539: Error: no such instruction: `movzw (%r11,%r14,2),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:571: Error: no such instruction: `movzw (%r11,%r14,2),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:603: Error: no such instruction: `movzw (%r11,%r14,2),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:421: Error: no such instruction: `movzw 2(%rax),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:423: Error: no such instruction: `movzw 4(%rax),%r9d'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:438: Error: no such instruction: `movzw 6(%rax),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:448: Error: no such instruction: `movzw (%rax,%rdx,4),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:463: Error: no such instruction: `movzw 2(%rax,%rdx,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:627: Error: no such instruction: `movzw 2(%rdi),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:629: Error: no such instruction: `movzw 4(%rdi),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:644: Error: no such instruction: `movzw 6(%rdi),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:654: Error: no such instruction: `movzw (%rdi,%r14,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:669: Error: no such instruction: `movzw 2(%rdi,%r14,4),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:627: Error: no such instruction: `movzw 2(%rax),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:629: Error: no such instruction: `movzw 4(%rax),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:644: Error: no such instruction: `movzw 6(%rax),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:654: Error: no such instruction: `movzw (%rax,%r14,4),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:669: Error: no such instruction: `movzw 2(%rax,%r14,4),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:506: Error: no such instruction: `movzw 2(%r9),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:508: Error: no such instruction: `movzw 4(%r9),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:523: Error: no such instruction: `movzw 6(%r9),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:533: Error: no such instruction: `movzw 8(%r9,%r14,2),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:548: Error: no such instruction: `movzw 12(%r9,%r14,2),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:559: Error: no such instruction: `movzw 16(%r9,%r14,2),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:574: Error: no such instruction: `movzw 24(%r9,%r14,2),%edx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:421: Error: no such instruction: `movzw 2(%rax),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:423: Error: no such instruction: `movzw 4(%rax),%r9d'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:438: Error: no such instruction: `movzw 6(%rax),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:448: Error: no such instruction: `movzw (%rax,%rdx,4),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:463: Error: no such instruction: `movzw 2(%rax,%rdx,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:474: Error: no such instruction: `movzw (%rax,%rdx,4),%r9d'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:489: Error: no such instruction: `movzw 2(%rax,%rdx,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:500: Error: no such instruction: `movzw (%rax,%rdx,4),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:515: Error: no such instruction: `movzw 2(%rax,%rdx,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:526: Error: no such instruction: `movzw (%rax,%rdx,4),%r9d'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:541: Error: no such instruction: `movzw 2(%rax,%rdx,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:552: Error: no such instruction: `movzw (%rax,%rdx,4),%edi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:567: Error: no such instruction: `movzw 2(%rax,%rdx,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:578: Error: no such instruction: `movzw (%rax,%rdx,4),%r9d'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:593: Error: no such instruction: `movzw 2(%rax,%rdx,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:627: Error: no such instruction: `movzw 2(%rdi),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:629: Error: no such instruction: `movzw 4(%rdi),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:644: Error: no such instruction: `movzw 6(%rdi),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:654: Error: no such instruction: `movzw (%rdi,%r14,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:669: Error: no such instruction: `movzw 2(%rdi,%r14,4),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:680: Error: no such instruction: `movzw (%rdi,%r14,4),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:695: Error: no such instruction: `movzw 2(%rdi,%r14,4),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:706: Error: no such instruction: `movzw (%rdi,%r14,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:721: Error: no such instruction: `movzw 2(%rdi,%r14,4),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:732: Error: no such instruction: `movzw (%rdi,%r14,4),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:747: Error: no such instruction: `movzw 2(%rdi,%r14,4),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:758: Error: no such instruction: `movzw (%rdi,%r14,4),%ecx'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:773: Error: no such instruction: `movzw 2(%rdi,%r14,4),%eax'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:784: Error: no such instruction: `movzw (%rdi,%r14,4),%esi'
/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2/src/liblzma/lzma/lzma_decoder.c:799: Error: no such instruction: `movzw 2(%rdi,%r14,4),%eax'
Makefile:1582: recipe for target 'liblzma_la-lzma_decoder.lo' failed
make[4]: *** [liblzma_la-lzma_decoder.lo] Error 1
make[4]: Leaving directory '/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2-abi_x86_64.amd64/src/liblzma'
Makefile:1758: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2-abi_x86_64.amd64/src/liblzma'
Makefile:427: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2-abi_x86_64.amd64/src'
Makefile:596: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2-abi_x86_64.amd64'
Makefile:486: recipe for target 'all' failed
make: *** [all] Error 2
 * ERROR: app-arch/xz-utils-5.6.2-r1::gentoo_prefix failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=app-arch/xz-utils-5.6.2-r1::gentoo_prefix'`,
 * the complete build log and the output of `emerge -pqv '=app-arch/xz-utils-5.6.2-r1::gentoo_prefix'`.
 * The complete build log is located at '/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/temp/build.log'.
 * The ebuild environment file is located at '/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/temp/environment'.
 * Working directory: '/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2-abi_x86_64.amd64'
 * S: '/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/work/xz-5.6.2'

>>> Failed to emerge app-arch/xz-utils-5.6.2-r1, Log file:

>>>  '/mnt/backup/gentoo-rescue/tmp/var/tmp/portage/app-arch/xz-utils-5.6.2-r1/temp/build.log'

@biergaizi
Copy link
Contributor

Strangely enough, I don't see any inline assembly in liblzma, it seems to be code generated by GCC

Ah, I see, the offending inline assembly is included from src/liblzma/rangecoder/range_decoder.h

@biergaizi
Copy link
Contributor

Please reopen the bug, and change the title to:

  • Inline Assembly Syntax in range_decoder.h is Incompatible With Old Binutils

@thesamesam
Copy link
Member

thesamesam commented Aug 21, 2024

Thanks, nice work. I can't change the title so I'll let @Larhzu do that.

A Ubuntu 16.04.7 LTS user also reported this problem to liblzma: kobolabs/liblzma#4

Note that we are liblzma. That's just a random repo.

@thesamesam thesamesam reopened this Aug 21, 2024
@thesamesam thesamesam removed the question Further information is requested label Aug 21, 2024
@biergaizi
Copy link
Contributor

Right now I'm using this hack to disable inline assembly, and I can confirm it fixed the build.

diff -upr xz-5.6.2/src/liblzma/rangecoder/range_decoder.h xz-5.6.2.patch/src/liblzma/rangecoder/range_decoder.h
--- xz-5.6.2/src/liblzma/rangecoder/range_decoder.h     2024-08-21 03:46:32.511055344 +0000
+++ xz-5.6.2.patch/src/liblzma/rangecoder/range_decoder.h       2024-08-21 03:47:47.072749239 +0000
@@ -52,6 +52,11 @@
 #              define LZMA_RANGE_DECODER_CONFIG 0
 #      endif
 #endif
+// XXX: assembly instruction "movzw" syntax incompatible with old
+// binutils (e.g. 2.25), so disable inline assembly until we find a
+// workaround.
+// https://github.com/tukaani-project/xz/issues/121
+#define LZMA_RANGE_DECODER_CONFIG 0
 
 
 // Negative RC_BIT_MODEL_TOTAL but the lowest RC_MOVE_BITS are flipped.

For a complete fix we need to figure out exactly what kind of syntax is accepted by old binutils... Or at least add an autotools check that disables this feature on unsupported system. xz is a core system tool, being able to build it even on old system is crucial, as end users may want to bootstrap a newer environment.

@Larhzu Larhzu changed the title it shouldn't be this hard. Inline assembly in range_decoder.h is incompatible with old Binutils Aug 21, 2024
@Larhzu
Copy link
Member

Larhzu commented Aug 21, 2024

[PATCH] x86: allow suffix-less movzw and 64-bit movzb

Aha! Does it work if you search-and-replace movzw with movzwl?

@biergaizi
Copy link
Contributor

Yes, it works with the following patch. Thanks for the quick reply.

diff --git a/src/liblzma/rangecoder/range_decoder.h b/src/liblzma/rangecoder/range_decoder.h
index 31a58d1..a8aca90 100644
--- a/src/liblzma/rangecoder/range_decoder.h
+++ b/src/liblzma/rangecoder/range_decoder.h
@@ -592,13 +592,13 @@ do { \
 // *_only = rc_asm_y or _n to include or exclude code marked with them
 #define rc_asm_bittree(a, b, first_only, middle_only, last_only) \
 	first_only( \
-		"movzw	2(%[probs_base]), %[prob" #a "]\n\t" \
+		"movzwl	2(%[probs_base]), %[prob" #a "]\n\t" \
 		"mov	$2, %[symbol]\n\t" \
-		"movzw	4(%[probs_base]), %[prob" #b "]\n\t" \
+		"movzwl	4(%[probs_base]), %[prob" #b "]\n\t" \
 	) \
 	middle_only( \
 		/* Note the scaling of 4 instead of 2: */ \
-		"movzw	(%[probs_base], %q[symbol], 4), %[prob" #b "]\n\t" \
+		"movzwl	(%[probs_base], %q[symbol], 4), %[prob" #b "]\n\t" \
 	) \
 	last_only( \
 		"add	%[symbol], %[symbol]\n\t" \
@@ -610,11 +610,11 @@ do { \
 		"cmovae	%[t0], %[range]\n\t" \
 		\
 	first_only( \
-		"movzw	6(%[probs_base]), %[t0]\n\t" \
+		"movzwl	6(%[probs_base]), %[t0]\n\t" \
 		"cmovae	%[t0], %[prob" #b "]\n\t" \
 	) \
 	middle_only( \
-		"movzw	2(%[probs_base], %q[symbol], 4), %[t0]\n\t" \
+		"movzwl	2(%[probs_base], %q[symbol], 4), %[t0]\n\t" \
 		"lea	(%q[symbol], %q[symbol]), %[symbol]\n\t" \
 		"cmovae	%[t0], %[prob" #b "]\n\t" \
 	) \
@@ -716,12 +716,12 @@ do { \
 #define rc_asm_bittree_rev(a, b, add, dcur, dnext0, dnext1, \
 		first_only, middle_only, last_only) \
 	first_only( \
-		"movzw	2(%[probs_base]), %[prob" #a "]\n\t" \
+		"movzwl	2(%[probs_base]), %[prob" #a "]\n\t" \
 		"xor	%[symbol], %[symbol]\n\t" \
-		"movzw	4(%[probs_base]), %[prob" #b "]\n\t" \
+		"movzwl	4(%[probs_base]), %[prob" #b "]\n\t" \
 	) \
 	middle_only( \
-		"movzw	" #dnext0 "(%[probs_base], %q[symbol], 2), " \
+		"movzwl	" #dnext0 "(%[probs_base], %q[symbol], 2), " \
 			"%[prob" #b "]\n\t" \
 	) \
 		\
@@ -731,11 +731,11 @@ do { \
 		"cmovae	%[t0], %[range]\n\t" \
 		\
 	first_only( \
-		"movzw	6(%[probs_base]), %[t0]\n\t" \
+		"movzwl	6(%[probs_base]), %[t0]\n\t" \
 		"cmovae	%[t0], %[prob" #b "]\n\t" \
 	) \
 	middle_only( \
-		"movzw	" #dnext1 "(%[probs_base], %q[symbol], 2), %[t0]\n\t" \
+		"movzwl	" #dnext1 "(%[probs_base], %q[symbol], 2), %[t0]\n\t" \
 		"cmovae	%[t0], %[prob" #b "]\n\t" \
 	) \
 		\
@@ -788,7 +788,7 @@ do { \
 	uint32_t t_index; \
 	\
 	__asm__( \
-		"movzw	(%[probs_base], %q[symbol], 2), %[prob]\n\t" \
+		"movzwl	(%[probs_base], %q[symbol], 2), %[prob]\n\t" \
 		"mov	%[symbol], %[index]\n\t" \
 		\
 		"add	%[dest], %[t2]\n\t" \
@@ -844,7 +844,7 @@ do { \
 		"and	%[offset], %[match_bit]\n\t" \
 		"add	%[match_bit], %[symbol]\n\t" \
 		\
-		"movzw	(%[probs_base], %q[symbol], 2), %[prob]\n\t" \
+		"movzwl	(%[probs_base], %q[symbol], 2), %[prob]\n\t" \
 		\
 		"add	%[symbol], %[symbol]\n\t" \
 		\

biergaizi added a commit to biergaizi/xz that referenced this issue Aug 22, 2024
…oject#121.

Support for instruction "movzw" without suffix in "GNU as" was
added in commit [1] and stabilized in binutils 2.27, released
in August 2016. Earlier systems don't accept this instruction
without a suffix, making range_decoder.h's inline assembly
unable to build on old systems such as Ubuntu 16.04, creating
error messages like:

    lzma_decoder.c: Assembler messages:
    lzma_decoder.c:371: Error: no such instruction: `movzw 2(%r11),%esi'
    lzma_decoder.c:373: Error: no such instruction: `movzw 4(%r11),%edi'
    lzma_decoder.c:388: Error: no such instruction: `movzw 6(%r11),%edx'
    lzma_decoder.c:398: Error: no such instruction: `movzw (%r11,%r14,4),%esi'

This has been reported by at least 3 different users. Since xz
and liblzma are base system tools and are often required in system
upgrades themselves, compatibility with old systems shall be kept.
This commit changes "movzw" to "movzwl" for compatibility.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c07315e0c610e0e3317b4c02266f81793df253d2

Suggested-By: Lasse Collin <[email protected]>
Tested-By: Yifeng Li <[email protected]>
Signed-off-by: Yifeng Li <[email protected]>
@biergaizi
Copy link
Contributor

I just opened Pull Request #136 with the patch attached.

biergaizi added a commit to biergaizi/xz that referenced this issue Aug 22, 2024
…oject#121.

Support for instruction "movzw" without suffix in "GNU as" was
added in commit [1] and stabilized in binutils 2.27, released
in August 2016. Earlier systems don't accept this instruction
without a suffix, making range_decoder.h's inline assembly
unable to build on old systems such as Ubuntu 16.04, creating
error messages like:

    lzma_decoder.c: Assembler messages:
    lzma_decoder.c:371: Error: no such instruction: `movzw 2(%r11),%esi'
    lzma_decoder.c:373: Error: no such instruction: `movzw 4(%r11),%edi'
    lzma_decoder.c:388: Error: no such instruction: `movzw 6(%r11),%edx'
    lzma_decoder.c:398: Error: no such instruction: `movzw (%r11,%r14,4),%esi'

This has been reported by at least 3 different users. Since xz
and liblzma are base system tools and are often required in system
upgrades themselves, compatibility with old systems shall be kept.
This commit changes "movzw" to "movzwl" for compatibility.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c07315e0c610e0e3317b4c02266f81793df253d2

Suggested-by: Lasse Collin <[email protected]>
Tested-by: Yifeng Li <[email protected]>
Signed-off-by: Yifeng Li <[email protected]>
@Larhzu Larhzu closed this as completed in 6cd7c86 Aug 22, 2024
@Larhzu
Copy link
Member

Larhzu commented Aug 22, 2024

xz is a core system tool, being able to build it even on old system is crucial, as end users may want to bootstrap a newer environment.

Yes. I occasionally test on Slackware 10.1 (from 2005) which has GCC 3.3.2. (Easy with Autotools but I haven't gotten CMake or Meson+Ninja to run.) That's 32-bit x86 though.

I hadn't realized that there are this kind of code compatibility issues at x86-64 side nowadays too. Ubuntu 16 is almost fresh still. ;-) Somehow binutils compatibility didn't cross my mind when this issue was created (perhaps something in the first message of this thread distracted me).

I just opened Pull Request #136 with the patch attached.

I edited the commit message slightly and merged it. I verified that your diff to the code was identical to what I had prepared locally yesterday.

Thanks!

Larhzu pushed a commit that referenced this issue Sep 6, 2024
Support for instruction "movzw" without suffix in "GNU as" was
added in commit [1] and stabilized in binutils 2.27, released
in August 2016. Earlier systems don't accept this instruction
without a suffix, making range_decoder.h's inline assembly
unable to build on old systems such as Ubuntu 16.04, creating
error messages like:

    lzma_decoder.c: Assembler messages:
    lzma_decoder.c:371: Error: no such instruction: `movzw 2(%r11),%esi'
    lzma_decoder.c:373: Error: no such instruction: `movzw 4(%r11),%edi'
    lzma_decoder.c:388: Error: no such instruction: `movzw 6(%r11),%edx'
    lzma_decoder.c:398: Error: no such instruction: `movzw (%r11,%r14,4),%esi'

Change "movzw" to "movzwl" for compatibility.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c07315e0c610e0e3317b4c02266f81793df253d2

Suggested-by: Lasse Collin <[email protected]>
Tested-by: Yifeng Li <[email protected]>
Signed-off-by: Yifeng Li <[email protected]>
Fixes: 3182a33
Fixes: #121
Closes: #136
(cherry picked from commit 6cd7c86)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants