[PATCH] D69759: [BPF] Add preserve_access_index attribute for record definition
Yonghong Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 8 10:26:40 PST 2019
yonghong-song added a comment.
For question
> Is there a use case to apply that attribute to inner types automatically ?
It is possible, but I feel make attribute per record is better. For example,
struct s1 {
int foo;
};
struct s2 {
struct s1 *ptr;
} __reloc__ *s2;
If we implicitly mark struct `s1` as __reloc__, later user may have
another code like
struct s1 *p;
p->foo
he may be surprised by relocation.
If this is user intention to have relocation for struct `s1`,
I think explicit attribute is better.
Another question would be during IR generation can we magically generate relocation for `ptr->foo` in `s2->ptr->foo`? Without marking the record, this will require pass context sensitive information along code generation, which could be error prone as when to clear such context sensitive information. I would prefer explicit marking. If user uses vmlinux.h, all struct/unions in vmlinux.h could have this attribute. If user defines their own structures for later relocation, I expect this should not be a huge amount and some manual work by users should be okay.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69759/new/
https://reviews.llvm.org/D69759
More information about the cfe-commits
mailing list