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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits