Skip to content

Commit e68d66a

Browse files
[compiler-rt] Make __EH_FRAME_LIST__ const to avoid RW .eh_frame mapping (#155764) (#155955)
In crtbegin.c, `__EH_FRAME_LIST__` was previously declared as a writable array of pointers. This caused the linker to place .eh_frame into a segment with read-write permissions, leading to larger virtual memory footprint at runtime (e.g. .eh_frame mapped into both LOAD and RELRO). Changing it to `static void * const __EH_FRAME_LIST__[]` ensures that the section is treated as read-only, matching GCC’s behavior with `__EH_FRAME_BEGIN__`. This prevents unnecessary RW mappings of .eh_frame while preserving the intended semantics. Fixes: #155764
1 parent 4d21f66 commit e68d66a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler-rt/lib/builtins/crtbegin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
__attribute__((visibility("hidden"))) void *__dso_handle = &__dso_handle;
2020

2121
#ifdef EH_USE_FRAME_REGISTRY
22-
__extension__ static void *__EH_FRAME_LIST__[]
22+
__extension__ static void *const __EH_FRAME_LIST__[]
2323
__attribute__((section(".eh_frame"), aligned(sizeof(void *)))) = {};
2424

2525
extern void __register_frame_info(const void *, void *) __attribute__((weak));

0 commit comments

Comments
 (0)