summaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorFangrui Song <[email protected]>2019-09-16 07:44:05 -0700
committerFangrui Song <[email protected]>2019-09-21 17:55:14 -0700
commit7f044341f9f5c227d7c13c9c8ac2e9b00c8ed287 (patch)
tree23f8f74bdf6c3a172fde8cd6d390030aede4cb82 /doc
parent8db7dfb5c41fcb52d1a571823147589ab2a03a6c (diff)
downloadmruby-7f044341f9f5c227d7c13c9c8ac2e9b00c8ed287.tar.gz
mruby-7f044341f9f5c227d7c13c9c8ac2e9b00c8ed287.zip
Rename MRB_USE_ETEXT_EDATA to MRB_USE_LINK_TIME_RO_DATA_P and support lld linked programs
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.
Diffstat (limited to 'doc')
-rw-r--r--doc/guides/mrbconf.md17
1 files changed, 6 insertions, 11 deletions
diff --git a/doc/guides/mrbconf.md b/doc/guides/mrbconf.md
index 4f5349e77..2f81776df 100644
--- a/doc/guides/mrbconf.md
+++ b/doc/guides/mrbconf.md
@@ -134,21 +134,16 @@ largest value of required alignment.
## Reduce heap memory configuration.
-`MRB_USE_ETEXT_EDATA`
+`MRB_USE_LINK_TIME_RO_DATA_P`
+* Only available on ELF platforms.
* If you specify the address of a read-only section when creating a symbol or string, that string will be used as it is.
* Heap memory can be saved.
-* Uses `_etext` and `__init_array_start`.
-* It must be `_etext < data_addr < &__init_array_start`.
-
-`MRB_NO_INIT_ARRAY_START`
-* Ignored if `MRB_USE_ETEXT_EDATA` is not defined.
-* Please try if `__init_array_start` is not available.
-* Uses `_etext` and `_edata`.
-* It must be `_etext < data_addr < _edata`.
+* Uses `__ehdr_start` and `__init_array_start`.
+* It must be `__ehdr_start < data_addr < __init_array_start`.
`MRB_USE_CUSTOM_RO_DATA_P`
-* Takes precedence over `MRB_USE_ETEXT_EDATA`.
-* Please try if both `MRB_USE_ETEXT_EDATA` and `MRB_NO_INIT_ARRAY_START` are not available.
+* Takes precedence over `MRB_USE_LINK_TIME_RO_DATA_P`.
+* Please try if `MRB_USE_LINK_TIME_RO_DATA_P` is not available.
* The `mrb_ro_data_p()` function is implemented by the user in an arbitrary file.
* The prototype declaration is `mrb_bool mrb_ro_data_p(const char *ptr)`.
* Return `TRUE` if `ptr` is in read-only section, otherwise return `FALSE`.