diff options
author | Cary Coutant <ccoutant@gmail.com> | 2017-01-31 16:32:59 -0800 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2017-01-31 16:33:58 -0800 |
commit | ed35cc4a1cb76fd9ac53ad19efb97ee2caffbae9 (patch) | |
tree | c10ec94ecb20e9c9c3196d63a074368c86cd7d1c /gold/x86_64.cc | |
parent | 15a00b13aedc6300732d0b3b6b9daefa361ced6f (diff) | |
download | gdb-ed35cc4a1cb76fd9ac53ad19efb97ee2caffbae9.zip gdb-ed35cc4a1cb76fd9ac53ad19efb97ee2caffbae9.tar.gz gdb-ed35cc4a1cb76fd9ac53ad19efb97ee2caffbae9.tar.bz2 |
Don't allow mov-to-lea optimization for __ehdr_start.
gold/
PR gold/21090
* x86_64.cc (Target_x86_64::can_convert_mov_to_lea): Add check
for predefined symbol.
(Target_x86_64::Relocate::relocate): Fix formatting.
Diffstat (limited to 'gold/x86_64.cc')
-rw-r--r-- | gold/x86_64.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gold/x86_64.cc b/gold/x86_64.cc index ffa8761..d21c268 100644 --- a/gold/x86_64.cc +++ b/gold/x86_64.cc @@ -1046,8 +1046,11 @@ class Target_x86_64 : public Sized_target<size, false> return false; // We cannot convert references to IFUNC symbols, or to symbols that // are not local to the current module. + // We can't do predefined symbols because they may become undefined + // (e.g., __ehdr_start when the headers aren't mapped to a segment). if (gsym->type() == elfcpp::STT_GNU_IFUNC - || gsym->is_undefined () + || gsym->is_undefined() + || gsym->is_predefined() || gsym->is_from_dynobj() || gsym->is_preemptible()) return false; @@ -4244,12 +4247,14 @@ Target_x86_64<size>::Relocate::relocate( if (gsym != NULL) { gold_assert(gsym->has_got_offset(GOT_TYPE_STANDARD)); - got_offset = gsym->got_offset(GOT_TYPE_STANDARD) - target->got_size(); + got_offset = (gsym->got_offset(GOT_TYPE_STANDARD) + - target->got_size()); } else { unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info()); - gold_assert(object->local_has_got_offset(r_sym, GOT_TYPE_STANDARD)); + gold_assert(object->local_has_got_offset(r_sym, + GOT_TYPE_STANDARD)); got_offset = (object->local_got_offset(r_sym, GOT_TYPE_STANDARD) - target->got_size()); } |