From 17f2ac67d638aa9501cb63e193a2921f5807133d Mon Sep 17 00:00:00 2001 From: York Jasper Niebuhr Date: Mon, 13 Oct 2025 13:48:32 +0200 Subject: [PATCH] Writeup --- writeup.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 writeup.txt diff --git a/writeup.txt b/writeup.txt new file mode 100644 index 0000000..2346d70 --- /dev/null +++ b/writeup.txt @@ -0,0 +1,15 @@ +offsetof is resolved very early in gcc, only INTEGER_CST is left but no type information in gimple + -> define __builtin_offsetof as __spslr_offsetof("type", "member", __builtin_offsetof(type, member)) + -> gcc does not know what to do with __spslr_offsetof so it remains in tree during gimple + -> plugin can extract type and member name and then replace the call with just the INTEGER_CST + +precise per-instruction labels are required at RTL level + single gimple statement can cause multiple RTL instructions + only out-of-the-box mapping is location (line, file, ...) + multiple gimple statements can share single location + gimple optimizations can merge statements from different locations + -> build logic tree at gimple but after gimple optimizations (right before conversion to RTL) + -> at RTL, pattern match sets of RTL instructions with same location to pattern of gimple statements + -> attach notes to any RTL instruction that accesses relevant structs + -> notes are propagated throughout RTL optimizations + -> at the very end of RTL handling, discover notes and add assembly labels