• Fangrui Song's avatar
    Rename MRB_USE_ETEXT_EDATA to MRB_USE_LINK_TIME_RO_DATA_P and support lld linked programs · 7f044341
    Fangrui Song authored
    In lld linked programs, .rodata comes before .text, thus mrb_ro_data_p
    will return false for strings in .rodata. Change the lower bound from
    _etext to __ehdr_start to catch these cases. This works for ld.bfd, gold
    and lld, and it does not have false positives even if .init_array does
    not exist.
    
    Remove the branch that uses _edata: strings in .data can be modified so
    this is semantically incorrect. Delete the __APPLE__ branch (its
    manpages say get_etext() and get_edata() are strongly discouraged).
    .init_array has been adopted by most ELF platforms to supersede .ctors.
    
    Neither _etext nor _edata is used, so rename MRB_USE_ETEXT_EDATA to
    MRB_USE_EHDR_START.
    7f044341
mrbconf.h 5.35 KB