aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/attrs.go
Commit message (Collapse)AuthorAgeFilesLines
* pkg/compiler: handle string syscall attributesFlorent Revest2024-12-091-0/+3
|
* pkg/compiler: support if[expr] attributesAleksandr Nogikh2024-02-191-8/+26
| | | | | | | | | | | | | | | | | | | The expression may either include integers/consts or reference other fields in the structure via value[field1:field2:field3]. The fields on this path must all belong to structures and must not have any if conditions themselves. For unions, mandate that the last field has no conditions (it will be the default one). For structs, convert conditional fields into fields of a union type of the following form: anonymous_union [ value T (if[expression]) void void ]
* compiler: remove dead code around structFieldAttrsPaul Chaignon2023-11-291-1/+3
| | | | | | | | structFieldAttrs is filled with empty attrDesc structs and is never changed at runtime. structFieldAttrs[X].CheckConsts is therefore always nil. Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
* pkg/compiler: support (in) for union fieldsAleksandr Nogikh2023-10-061-0/+1
| | | | | | | | | | | | | We had a problem -- using inout ANYUNION leads to syzkaller generating copyout instructions for fmt[X, resource] types. Add a validation rule to detect this during tests. Fix this by supporting (in) for union fields. Previously, all union field direction attributes were banned as they were making things more complicated. The (in) attribute is definitely safe and allows for more flexibility.
* pkg/compiler: prohibit use of direction attribute on union fieldsDmitry Vyukov2022-01-111-4/+4
| | | | | | Direction attributes on unions work in a confusing way and don't do what users may think they do. Now we have out_overlay attribute for structs that allows to have overlapping input and output fields.
* pkg/compiler: add out_overlay field attributeDmitry Vyukov2022-01-111-8/+9
|
* pkg, prog: add per-field direction attributeNecip Fazil Yildiran2020-08-131-0/+4
|
* prog: introduce call attributesDmitry Vyukov2020-04-191-0/+22
| | | | | | Add common infrastructure for syscall attributes. Add few attributes we want, but they are not implemented for now (don't affect behavior, this will follow).
* pkg/compiler: refactor attribute handlingDmitry Vyukov2020-04-191-0/+62
Introduce common infrastructure for describing and parsing attribute instead of custom per-attribute code scattered across several locations. Change align attribute syntax from the weird align_N to align[N]. This also allows to use literal constants as N. Introduce notion of builtin constants. Currently we have only PTR_SIZE, which is needed to replace align_ptr with align[PTR_SIZE].