| 1 | pub const PE = packed struct(u8) { |
| 2 | type: Type, |
| 3 | rel: Rel, |
| 4 | /// Undocumented GCC extension |
| 5 | indirect: bool = false, |
| 6 | |
| 7 | /// This is a special encoding which does not correspond to named `type`/`rel` values. |
| 8 | pub const omit: PE = @bitCast(@as(u8, 0xFF)); |
| 9 | |
| 10 | pub const Type = enum(u4) { |
| 11 | absptr = 0x0, |
| 12 | uleb128 = 0x1, |
| 13 | udata2 = 0x2, |
| 14 | udata4 = 0x3, |
| 15 | udata8 = 0x4, |
| 16 | sleb128 = 0x9, |
| 17 | sdata2 = 0xA, |
| 18 | sdata4 = 0xB, |
| 19 | sdata8 = 0xC, |
| 20 | _, |
| 21 | }; |
| 22 | |
| 23 | /// The specification considers this a `u4`, but the GCC `indirect` field extension conflicts |
| 24 | /// with that, so we consider it a `u3` instead. |
| 25 | pub const Rel = enum(u3) { |
| 26 | abs = 0x0, |
| 27 | pcrel = 0x1, |
| 28 | textrel = 0x2, |
| 29 | datarel = 0x3, |
| 30 | funcrel = 0x4, |
| 31 | aligned = 0x5, |
| 32 | _, |
| 33 | }; |
| 34 | }; |