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

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 1 09:29:31 PDT 2019


probinson added a subscriber: rsmith.
probinson added a comment.

In D69393#1729772 <https://reviews.llvm.org/D69393#1729772>, @yonghong-song wrote:

> 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


I have no insight into the standards committees.  @rsmith is your guru here.


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