Commit 7d5f744
committed
rtld: Check for -1 as an-end-of-section marker instead of 1
rtld calls functions in the .init_array section one at a time, until
it finds a distinguished sentinel value. The C runtime does the same
thing (in crtend.c). However, that checks for the sentinel -1 and not
1. If one is using a linker that unifies .ctors and .init_array, then
rtld will miss the sentinel value. I believe the author of this code
intended to write -1 instead of 1. Indeed, changing the branch to
check for -1 prevents rtld from attempting to call a non-existent
function. The same is true of .dtors and .fini_array.
Signed-off-by: Daniel Levin <daniellevin2607@gmail.com>1 parent 6d53619 commit 7d5f744
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3166 | 3166 | | |
3167 | 3167 | | |
3168 | 3168 | | |
3169 | | - | |
| 3169 | + | |
3170 | 3170 | | |
3171 | 3171 | | |
3172 | 3172 | | |
| |||
3272 | 3272 | | |
3273 | 3273 | | |
3274 | 3274 | | |
3275 | | - | |
| 3275 | + | |
3276 | 3276 | | |
3277 | 3277 | | |
3278 | 3278 | | |
| |||
0 commit comments