mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-23 06:12:22 -08:00
implement /OPT:ICF
Add identical COMDAT folding using a color-refinement over foldable read-only sections. Hash section contents, relocation targets, and target colors until partitions stabilize, then redirect folded COMDAT symlinks and discard duplicate sections. Honor .llvm_addrsig via /LLVM_ADDRSIG so address-significant sections are not folded, keep separate color space for code, unwind info, and MSVC vftables, and update COMDAT symbol/section mapping after folding. Add linker tests covering function folding, relocation-sensitive folds, alignment, color-space separation, symlink chains, .llvm_addrsig, pdata/xdata, and C++ ICF cases.
This commit is contained in:
1 parent
1ea9fae835
commit
d34e1a7802
11 files changed
+1869
-153
No files matched your search
+9
-5
@@ -74,6 +74,7 @@ typedef struct LNK_Inputer
|
||||
#define LNK_NULL_SYMBOL "*** RAD_NULL_SYMBOL ***"
|
||||
|
||||
#define LNK_SECTION_FLAG_DEBUG (1 << 0)
|
||||
#define LNK_SECTION_FLAG_NOICF (1 << 1)
|
||||
|
||||
typedef U8 LNK_LibMemberFlags;
|
||||
enum
|
||||
@@ -215,10 +216,12 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LNK_SymbolTable *symtab;
|
||||
LNK_Config *config;
|
||||
LNK_ObjList objs;
|
||||
} LNK_OptRefTask;
|
||||
LNK_SymbolTable *symtab;
|
||||
LNK_Config *config;
|
||||
LNK_Obj **objs;
|
||||
U64 objs_count;
|
||||
U32Array *obj_indices;
|
||||
} LNK_OptTask;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -390,7 +393,8 @@ internal LNK_LinkResult lnk_link_image (TP_Context *tp, TP_Arena *arena, LNK_Con
|
||||
|
||||
// --- Optimizations -----------------------------------------------------------
|
||||
|
||||
internal void lnk_opt_ref(TP_Context *tp, LNK_SymbolTable *symtab, LNK_Config *config, LNK_ObjList objs);
|
||||
internal void lnk_opt_ref(TP_Context *tp, LNK_SymbolTable *symtab, LNK_Config *config, LNK_Obj **objs, U64 objs_count);
|
||||
internal void lnk_opt_icf(TP_Context *tp, LNK_SymbolTable *symtab, LNK_Config *config, LNK_Obj **objs, U64 objs_count);
|
||||
|
||||
// --- Win32 Image -------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in new issue
Block a user