[llvm-bugs] [Bug 26665] New: Not extending i8 return values (r260133) broke Chromium on Darwin <= 10.9

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 18 10:02:31 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26665

            Bug ID: 26665
           Summary: Not extending i8 return values (r260133) broke
                    Chromium on Darwin <= 10.9
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvm-bugs at lists.llvm.org, nicolasweber at gmx.de,
                    rjmccall at apple.com
    Classification: Unclassified

r260133 changed LLVM to no longer extend i8/i16 return values to 32-bits, as
that is not required by the ABI and neither GCC or MSVC does it.

However, we found code in the wild relying on Clang's old behaviour,
specifically in the AppKit framework on Mac OS X <= 10.9 (we tested 10.8, 10.9,
10.10 and 10.14):


After LLVM r260133, the following Objective-C method in Chromium would no
longer extend its BOOL (signed char) return value:

browser_tests`-[NativeWidgetMacNSWindow canBecomeMainWindow]:
[...]
   0x1017e3c68:  movq   %rbx, %rdi
   0x1017e3c6b:  callq  0x1018284c0               ;
views::NativeWidgetMac::GetBridgeForNativeWindow(NSWindow*)
   0x1017e3c70:  cmpq   $0x0, 0x98(%rax)
   0x1017e3c78:  sete   %al
   0x1017e3c7b:  jmp    0x1017e3c83               ; -[NativeWidgetMacNSWindow
canBecomeMainWindow] + 83
[...]
   0x1017e3c83:  addq   $0x8, %rsp
   0x1017e3c87:  popq   %rbx
   0x1017e3c88:  popq   %rbp
   0x1017e3c89:  ret


However, that function would get called by AppKit like this:

AppKit`-[NSApplication makeWindowsPerform:inOrder:]:
[...]
   0x7fff8b5e770d:  movq   %rbx, %rdi
   0x7fff8b5e7710:  movq   -0x187e90a7(%rip), %rsi   ; "performSelector:"
   0x7fff8b5e7717:  movq   -0x40(%rbp), %rdx
   0x7fff8b5e771b:  callq  *-0x18931e99(%rip)        ; (void
*)0x00007fff81b6b240: objc_msgSend
-> 0x7fff8b5e7721:  testq  %rax, %rax


Note that the caller is expecting the return value to have been extended to the
full width of %rax.

I'm not sure what the AppKit code is doing or what "performSelector" is, but
presumably there's some mismatch in the expected return type.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160218/3199dfd7/attachment.html>


More information about the llvm-bugs mailing list