This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 5/5] gold/s390: Fixes
- From: Marcin KoÅcielnicki <koriakin at 0x04 dot net>
- To: binutils at sourceware dot org
- Cc: Marcin KoÅcielnicki <koriakin at 0x04 dot net>
- Date: Thu, 17 Sep 2015 03:56:47 +0200
- Subject: [PATCH 5/5] gold/s390: Fixes
- Authentication-results: sourceware.org; auth=none
- References: <1442225482-10856-1-git-send-email-koriakin at 0x04 dot net>
- Add do_code_fill
- Fix R_390_*20 relocations
- 32-bit target includes PLT relocations in DT_RELA.
---
Here come the fixes from testing. Now I have only the following test failures:
- on 31-bit: debug_msg test shows wrong line for SometimesInlined in
odr_violation2.cc (29 instead of 27). It seems gcc emits two .loc
directives at the beginning of the function, for line 27 and then 29.
gold's DWARF parser picks the second one (29), while addr2line picks
the first (27). I'm not sure what to do about this one - should we
align gold's algorithm to match addr2line? Or make the test suite
accept line 29 as a correct result?
- on 64-bit: 5 tests (the ones that involve linker scripts) fail due
to bug 18975.
gold/s390.cc | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/gold/s390.cc b/gold/s390.cc
index 437fdcc..560dd1f 100644
--- a/gold/s390.cc
+++ b/gold/s390.cc
@@ -348,6 +348,10 @@ class Target_s390 : public Sized_target<size, true>
const unsigned char* plocal_symbols,
Relocatable_relocs*);
+ // Return a string used to fill a code section with nops.
+ std::string
+ do_code_fill(section_size_type length) const;
+
// Emit relocations for a section.
void
relocate_relocs(
@@ -730,7 +734,7 @@ Target::Target_info Target_s390<32>::s390_info =
elfcpp::EM_S390, // machine_code
false, // has_make_symbol
false, // has_resolve
- false, // has_code_fill
+ true, // has_code_fill
true, // is_default_stack_executable
true, // can_icf_inline_merge_sections
'\0', // wrap_char
@@ -758,7 +762,7 @@ Target::Target_info Target_s390<64>::s390_info =
elfcpp::EM_S390, // machine_code
false, // has_make_symbol
false, // has_resolve
- false, // has_code_fill
+ true, // has_code_fill
true, // is_default_stack_executable
true, // can_icf_inline_merge_sections
'\0', // wrap_char
@@ -862,7 +866,8 @@ public:
{
if (This::template has_overflow_signed<20>(value))
return STATUS_OVERFLOW;
- This::template rela<32>(view, 0x0fffff00, value << 8);
+ This::template rela<16>(view, 0x0fff, value);
+ This::template rela<16>(view + 2, 0xff00, value >> (12 - 8));
return STATUS_OK;
}
@@ -1615,6 +1620,11 @@ Target_s390<size>::make_plt_section(Symbol_table* symtab, Layout* layout)
// Create the GOT sections first.
this->got_section(symtab, layout);
+ // Ensure that .rela.dyn always appears before .rela.plt This is
+ // necessary due to how, on 32-bit S/390 and some other targets,
+ // .rela.dyn needs to include .rela.plt in it's range.
+ this->rela_dyn_section(layout);
+
this->plt_ = new Output_data_plt_s390<size>(layout,
this->got_, this->got_plt_, this->got_irelative_);
@@ -3187,6 +3197,7 @@ Target_s390<size>::Relocate::relocate(
case elfcpp::R_390_TLS_LDO32:
case elfcpp::R_390_TLS_LDO64:
case elfcpp::R_390_TLS_GOTIE12: // Initial-exec
+ case elfcpp::R_390_TLS_GOTIE20:
case elfcpp::R_390_TLS_GOTIE32:
case elfcpp::R_390_TLS_GOTIE64:
case elfcpp::R_390_TLS_IE32:
@@ -3860,7 +3871,7 @@ Target_s390<size>::do_finalize_sections(
? NULL
: this->plt_->rela_plt());
layout->add_target_dynamic_tags(false, this->got_plt_, rel_plt,
- this->rela_dyn_, true, false);
+ this->rela_dyn_, true, size == 32);
this->layout_ = layout;
@@ -4134,6 +4145,18 @@ Target_s390<size>::do_dynsym_value(const Symbol* gsym) const
return this->plt_address_for_global(gsym);
}
+// Return a string used to fill a code section with nops to take up
+// the specified length.
+
+template<int size>
+std::string
+Target_s390<size>::do_code_fill(section_size_type length) const
+{
+ if (length & 1)
+ gold_warning(_("S/390 code fill of odd length requested"));
+ return std::string(length, static_cast<char>(0x07));
+}
+
// Relocate section data.
template<int size>
--
2.5.1