]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86_64: Use TESTB instead of TESTL in CHECK_INVALID_LONGJMP
authorUros Bizjak <ubizjak@gmail.com>
Mon, 18 Aug 2025 09:18:55 +0000 (11:18 +0200)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 20 Aug 2025 18:47:53 +0000 (11:47 -0700)
There is no need to use TESTL when checking the least-significant bit
with a TEST instruction. Use TESTB, which is three bytes shorter:

   f6 44 24 f0 01          testb  $0x1,-0x10(%rsp)

vs:

   f7 44 24 f0 01 00 00    testl  $0x1,-0x10(%rsp)
   00

for the same effect.

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S

index b73a18bdb87afd7c6dcacfdb8347d5f58f249cf5..3bcdd6a87cf4d0785236c8db40ebe55cf376a9c8 100644 (file)
@@ -44,7 +44,7 @@ longjmp_msg:
        /* Without working sigaltstack we cannot perform the test.  */  \
        testl   %eax, %eax;                                             \
        jne     .Lok2;                                                  \
-       testl   $1, (-sizeSS + oSS_FLAGS)(%rsp);                        \
+       testb   $1, (-sizeSS + oSS_FLAGS)(%rsp);                        \
        jz      .Lfail;                                                 \
        mov     (-sizeSS + oSS_SP)(%rsp), %RAX_LP;                      \
        add     (-sizeSS + oSS_SIZE)(%rsp), %RAX_LP;                    \