| 1 | diff --git a/src/core/memory.d b/src/core/memory.d |
| 2 | index 0a427055..28408cb7 100644 |
| 3 | --- a/src/core/memory.d |
| 4 | +++ b/runtime/druntime/src/core/memory.d |
| 5 | @@ -38,7 +38,7 @@ |
| 6 | * |
| 7 | * Notes_to_implementors: |
| 8 | * $(UL |
| 9 | - * $(LI On POSIX systems, the signals SIGUSR1 and SIGUSR2 are reserved |
| 10 | + * $(LI On POSIX systems, the signals `SIGRTMIN` and `SIGRTMIN + 1` are reserved |
| 11 | * by this module for use in the garbage collector implementation. |
| 12 | * Typically, they will be used to stop and resume other threads |
| 13 | * when performing a collection, but an implementation may choose |
| 14 | diff --git a/src/core/thread.d b/src/core/thread.d |
| 15 | index 64e6dc18..2c08e6db 100644 |
| 16 | --- a/src/core/thread.d |
| 17 | +++ b/runtime/druntime/src/core/thread.d |
| 18 | @@ -1922,7 +1922,7 @@ version( CoreDdoc ) |
| 19 | { |
| 20 | /** |
| 21 | * Instruct the thread module, when initialized, to use a different set of |
| 22 | - * signals besides SIGUSR1 and SIGUSR2 for suspension and resumption of threads. |
| 23 | + * signals besides `SIGRTMIN` and `SIGRTMIN + 1` for suspension and resumption of threads. |
| 24 | * This function should be called at most once, prior to thread_init(). |
| 25 | * This function is Posix-only. |
| 26 | */ |
| 27 | @@ -1980,12 +1980,13 @@ extern (C) void thread_init() |
| 28 | { |
| 29 | if( suspendSignalNumber == 0 ) |
| 30 | { |
| 31 | - suspendSignalNumber = SIGUSR1; |
| 32 | + suspendSignalNumber = SIGRTMIN; |
| 33 | } |
| 34 | |
| 35 | if( resumeSignalNumber == 0 ) |
| 36 | { |
| 37 | - resumeSignalNumber = SIGUSR2; |
| 38 | + resumeSignalNumber = SIGRTMIN + 1; |
| 39 | + assert(resumeSignalNumber <= SIGRTMAX); |
| 40 | } |
| 41 | |
| 42 | int status; |
| 43 | @@ -3975,6 +3976,10 @@ version( LDC ) |
| 44 | version( X86 ) version = CheckFiberMigration; |
| 45 | version( X86_64 ) version = CheckFiberMigration; |
| 46 | } |
| 47 | + version( Android ) |
| 48 | + { |
| 49 | + version( ARM ) version = CheckFiberMigration; |
| 50 | + } |
| 51 | } |
| 52 | |
| 53 | // Fiber support for SjLj style exceptions |
| 54 | diff --git a/src/rt/sections_android.d b/src/rt/sections_android.d |
| 55 | index 60ca9a9a..a662887d 100644 |
| 56 | --- a/src/rt/sections_android.d |
| 57 | +++ b/runtime/druntime/src/rt/sections_android.d |
| 58 | @@ -62,12 +62,9 @@ private: |
| 59 | void initSections() |
| 60 | { |
| 61 | pthread_key_create(&_tlsKey, null); |
| 62 | + _sections.moduleGroup = ModuleGroup(getModuleInfos()); |
| 63 | |
| 64 | - auto mbeg = cast(immutable ModuleInfo**)&__start_minfo; |
| 65 | - auto mend = cast(immutable ModuleInfo**)&__stop_minfo; |
| 66 | - _sections.moduleGroup = ModuleGroup(mbeg[0 .. mend - mbeg]); |
| 67 | - |
| 68 | - auto pbeg = cast(void*)&_tls_end; |
| 69 | + auto pbeg = cast(void*)&_tlsend; |
| 70 | auto pend = cast(void*)&__bss_end__; |
| 71 | _sections._gcRanges[0] = pbeg[0 .. pend - pbeg]; |
| 72 | } |
| 73 | @@ -167,6 +164,38 @@ ref void[] getTLSBlockAlloc() |
| 74 | |
| 75 | __gshared SectionGroup _sections; |
| 76 | |
| 77 | +// This linked list is created by a compiler generated function inserted |
| 78 | +// into the .ctor list by the compiler. |
| 79 | +struct ModuleReference |
| 80 | +{ |
| 81 | + ModuleReference* next; |
| 82 | + ModuleInfo* mod; |
| 83 | +} |
| 84 | + |
| 85 | +extern (C) __gshared immutable(ModuleReference*) _Dmodule_ref; // start of linked list |
| 86 | + |
| 87 | +immutable(ModuleInfo*)[] getModuleInfos() |
| 88 | +out (result) |
| 89 | +{ |
| 90 | + foreach(m; result) |
| 91 | + assert(m !is null); |
| 92 | +} |
| 93 | +body |
| 94 | +{ |
| 95 | + size_t len; |
| 96 | + immutable(ModuleReference)* mr; |
| 97 | + |
| 98 | + for (mr = _Dmodule_ref; mr; mr = mr.next) |
| 99 | + len++; |
| 100 | + auto result = (cast(immutable(ModuleInfo)**).malloc(len * size_t.sizeof))[0 .. len]; |
| 101 | + len = 0; |
| 102 | + for (mr = _Dmodule_ref; mr; mr = mr.next) |
| 103 | + { result[len] = mr.mod; |
| 104 | + len++; |
| 105 | + } |
| 106 | + return cast(immutable)result; |
| 107 | +} |
| 108 | + |
| 109 | extern(C) |
| 110 | { |
| 111 | /* Symbols created by the compiler/linker and inserted into the |
| 112 | @@ -174,10 +203,8 @@ extern(C) |
| 113 | */ |
| 114 | extern __gshared |
| 115 | { |
| 116 | - void* __start_deh; |
| 117 | - void* __stop_deh; |
| 118 | - void* __start_minfo; |
| 119 | - void* __stop_minfo; |
| 120 | + void* _deh_beg; |
| 121 | + void* _deh_end; |
| 122 | |
| 123 | size_t __bss_end__; |
| 124 | |