[all-commits] [llvm/llvm-project] c8b2f3: [ObjC] type method metadata `_imp`, messenger rout...

Matt Jacobson via All-commits all-commits at lists.llvm.org
Thu Aug 4 02:42:44 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c8b2f3f51bd923afbf9d3ebd0823bce895629630
  Author: Matt Jacobson <mhjacobson at me.com>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

  Changed paths:
    M clang/lib/CodeGen/CGObjCMac.cpp
    M clang/lib/CodeGen/CGObjCRuntime.cpp
    A clang/test/CodeGen/avr/objc-method.m

  Log Message:
  [ObjC] type method metadata `_imp`, messenger routine at callsite with program address space

On targets with non-default program address space (e.g., Harvard
architectures), clang crashes when emitting Objective-C method metadata,
because the address of the method IMP cannot be bitcast to i8*. It similarly
crashes at messenger callsite with a failed bitcast.

Define the _imp field instead as i8 addrspace(1)* (or whatever the target's
program address space is). And in getMessageSendInfo(), create signatureType by
specifying the program address space.

Add a regression test using the AVR target. Test failed previously and passes
now. Checked codegen of the test for x86_64-apple-darwin19.6.0 and saw no
difference, as expected.

Reviewed By: rjmccall, dylanmckay

Differential Revision: https://reviews.llvm.org/D112113

More information about the All-commits mailing list