gc
gc copied to clipboard
DATA and BSS sections with DYLD linker
The current solution to determine the DATA and BSS sections (initialized & uninitialized global variables) is invalid for Darwin dynamic linker (DYLD). We assume a memory layout that is a de-facto standard on UNIX (the TEXT section is immediately followed by the DATA section then the BSS section) that is unsupported with DYLD as explained in the get_end(3) manpage. We should instead use the dyld(3) functions to retrieve the actual regions for the DATA and BSS sections.