https://bugs.kde.org/show_bug.cgi?id=522533

            Bug ID: 522533
           Summary: Valgrind can't handle some encoding from gas trunk
                    with -Wa,-O2
    Classification: Developer tools
           Product: valgrind
      Version First 3.24 GIT
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: vex
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

As discussed on IRC a little earlier.

`hello` here is just GNU Hello:
```
~/build/valgrind-3.27.1-good $ (export CFLAGS="-O2" ; ./configure ; make)
~/build/valgrind-3.27.1-good $ ./vg-in-place -q hello
Hello, world!
```

vs
```
~/build/valgrind-3.27.1-bad $ (export CFLAGS="-O2 -Wa,-O2" ; ./configure ;
make)
~/build/valgrind-3.27.1-bad $ ./vg-in-place hello
==568970== Memcheck, a memory error detector
==568970== Copyright (C) 2002-2026, and GNU GPL'd, by Julian Seward et al.
==568970== Using Valgrind-3.27.1 and LibVEX; rerun with -h for copyright info
==568970== Command: hello
==568970==
vex amd64->IR: unhandled instruction bytes: 0x48 0xC1 0xC7 0x3 0x48 0xC1 0xC7
0xD 0x48 0xC1
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==568970== valgrind: Unrecognised instruction at address 0x484f1e9.
==568970==    at 0x484F1E9: _vgnU_ifunc_wrapper (vg_preloaded.c:129)
==568970==    by 0x401F999: elf_machine_rela (dl-machine.h:473)
==568970==    by 0x401F999: elf_dynamic_do_Rela (do-rel.h:161)
==568970==    by 0x401F999: _dl_relocate_object_no_relro (dl-reloc.c:296)
==568970==    by 0x4022718: _dl_relocate_object (dl-reloc.c:346)
==568970==    by 0x4033FED: dl_main (rtld.c:2259)
==568970==    by 0x40307EE: _dl_sysdep_start (dl-sysdep.c:140)
==568970==    by 0x4031ECF: _dl_start_final (rtld.c:496)
==568970==    by 0x4031ECF: _dl_start (rtld.c:581)
==568970==    by 0x4030D87: ??? (in /usr/lib64/ld-linux-x86-64.so.2)
==568970== Your program just tried to execute an instruction that Valgrind
==568970== did not recognise.  There are two possible reasons for this.
==568970== 1. Your program has a bug and erroneously jumped to a non-code
==568970==    location.  If you are running Memcheck and you just saw a
==568970==    warning about a bad jump, it's probably your program's fault.
==568970== 2. The instruction is legitimate but Valgrind doesn't handle it,
==568970==    i.e. it's Valgrind's fault.  If you think this is the case or
==568970==    you are not sure, please let us know and we'll try to fix it.
==568970== Either way, Valgrind will now raise a SIGILL signal which will
==568970== probably kill your program.
==568970==
==568970== Process terminating with default action of signal 4 (SIGILL):
dumping core
==568970==  Illegal opcode at address 0x484F1E9
==568970==    at 0x484F1E9: _vgnU_ifunc_wrapper (vg_preloaded.c:129)
==568970==    by 0x401F999: elf_machine_rela (dl-machine.h:473)
==568970==    by 0x401F999: elf_dynamic_do_Rela (do-rel.h:161)
==568970==    by 0x401F999: _dl_relocate_object_no_relro (dl-reloc.c:296)
==568970==    by 0x4022718: _dl_relocate_object (dl-reloc.c:346)
==568970==    by 0x4033FED: dl_main (rtld.c:2259)
==568970==    by 0x40307EE: _dl_sysdep_start (dl-sysdep.c:140)
==568970==    by 0x4031ECF: _dl_start_final (rtld.c:496)
==568970==    by 0x4031ECF: _dl_start (rtld.c:581)
==568970==    by 0x4030D87: ??? (in /usr/lib64/ld-linux-x86-64.so.2)
==568970==
==568970== HEAP SUMMARY:
==568970==     in use at exit: 0 bytes in 0 blocks
==568970==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==568970==
==568970== All heap blocks were freed -- no leaks are possible
==568970==
==568970== For lists of detected and suppressed errors, rerun with: -s
==568970== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Illegal instruction        (core dumped) ./vg-in-place hello
```

```
$ gcc --version | head -1
gcc (Gentoo Hardened 17.0.9999 p, commit
1d5d7ba8298dfe22a6137e26ef47bad534aa1d92) 17.0.0 20260628 (experimental)
997a7e79258e7209718c5366b6a1d3be31c76b8b
$ as --version | head -1
GNU assembler (Gentoo 9999 p1) 2.46.50.20260701
$ ld.so --version | head -1
ld.so (Gentoo 2.43.9999 (patchset 1)) stable release version 2.43.
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to