diff options
| author | Ulrich Drepper <[email protected]> | 2005-12-04 16:47:24 +0000 |
|---|---|---|
| committer | Ulrich Drepper <[email protected]> | 2005-12-04 16:47:24 +0000 |
| commit | 038129b11ac71a13ccaf9029122be86d6c532990 (patch) | |
| tree | a9b2c6d0e09e7b36a56ef041f04517f55ca36293 /src | |
| parent | 607e05466d3fef5e3ad90aa200d3bba1950cf982 (diff) | |
More relaxation for unloaded reloc sections.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/elflint.c | 50 |
2 files changed, 33 insertions, 23 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4c668c23..e03f056d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2005-12-04 Ulrich Drepper <[email protected]> + + * elflint.c (check_one_reloc): If relocation section is not loaded, + don't check whether the relocations modify read-only sections or + loaded and unloaded sections. + 2005-11-28 Ulrich Drepper <[email protected]> * elflint.c (check_one_reloc): Take additional parameters. Use diff --git a/src/elflint.c b/src/elflint.c index 227a463c..32d52976 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -1205,37 +1205,41 @@ section [%2d] '%s': relocation %zu: offset out of bounds\n"), buf, sizeof (buf))); } - bool in_loaded_seg = false; - while (loaded != NULL) + if ((ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN) + || (relshdr->sh_flags & SHF_ALLOC) != 0) { - if (r_offset < loaded->to - && r_offset + (sym == NULL ? 0 : sym->st_size) >= loaded->from) + bool in_loaded_seg = false; + while (loaded != NULL) { - /* The symbol is in this segment. */ - if (loaded->read_only) + if (r_offset < loaded->to + && r_offset + (sym == NULL ? 0 : sym->st_size) >= loaded->from) { - if (textrel) - needed_textrel = true; - else - ERROR (gettext ("section [%2d] '%s': relocation %zu: read-only section modified but text relocation flag not set\n"), - idx, section_name (ebl, idx), cnt); + /* The symbol is in this segment. */ + if (loaded->read_only) + { + if (textrel) + needed_textrel = true; + else + ERROR (gettext ("section [%2d] '%s': relocation %zu: read-only section modified but text relocation flag not set\n"), + idx, section_name (ebl, idx), cnt); + } + + in_loaded_seg = true; } - in_loaded_seg = true; + loaded = loaded->next; } - loaded = loaded->next; - } - - if (*statep == state_undecided) - *statep = in_loaded_seg ? state_loaded : state_unloaded; - else if ((*statep == state_unloaded && in_loaded_seg) - || (*statep == state_loaded && !in_loaded_seg)) - { - ERROR (gettext ("\ + if (*statep == state_undecided) + *statep = in_loaded_seg ? state_loaded : state_unloaded; + else if ((*statep == state_unloaded && in_loaded_seg) + || (*statep == state_loaded && !in_loaded_seg)) + { + ERROR (gettext ("\ section [%2d] '%s': relocations are against loaded and unloaded data\n"), - idx, section_name (ebl, idx)); - *statep = state_error; + idx, section_name (ebl, idx)); + *statep = state_error; + } } } |
