[PATCH] D69393: [RFC][DebugInfo] emit user specified address_space in dwarf

Yonghong Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 31 23:21:18 PDT 2019


yonghong-song added a comment.

During experimenting with linux kernel codes, I found that clang does not allow address_space attribute for function pointers, specifically, in `clang/lib/Sema/SemaType.cpp`,

  // ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "A function type shall not be
  // qualified by an address-space qualifier."
  if (Type->isFunctionType()) {
    S.Diag(Attr.getLoc(), diag::err_attribute_address_function_type);
    Attr.setInvalid();
    return;
  }

But linux kernel tries to annotate signal handling function pointer with address space to indicate it is accessing user space.

  typedef __signalfn_t __user *__sighandler_t;
  typedef __restorefn_t __user *__sigrestore_t;

Such attribute makes sense for linux since indeed the signal handler code resides in user space and the kernel pointer
merely points to user memory here.

But such attributes are not allowed for function pointers.

Maybe somebody can give some context about this particular ISO/IEC TR 18037 specification? cc @probinson


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69393/new/

https://reviews.llvm.org/D69393





More information about the cfe-commits mailing list