* [Patch][Gold] BE8 for ARM
@ 2016-07-07 23:25 Bharathi Seshadri (bseshadr)
2016-08-09 9:57 ` Richard Earnshaw (lists)
0 siblings, 1 reply; 17+ messages in thread
From: Bharathi Seshadri (bseshadr) @ 2016-07-07 23:25 UTC (permalink / raw)
To: binutils; +Cc: ccoutant
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
Hi,
This patch implements the BE8 support for ARM in the gold linker. It has been tested on a non-trivial large program (size ~120MB).
Thanks to Cary Coutant for his initial review.
gold/ChangeLog
2016-07-07 Bharathi Seshadri <bseshadr@cisco.com>
* options.h (General_options): Add --be8 option.
* arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
(Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
(Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
(Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
(Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
Regards,
Bharathi
[-- Attachment #2: be8_arm_patch.txt --]
[-- Type: text/plain, Size: 6977 bytes --]
diff --git a/gold/arm.cc b/gold/arm.cc
index c47b002..4b0f85f 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -6639,6 +6639,60 @@ Arm_relobj<big_endian>::do_relocate_sections(
section_address,
section_size);
}
+
+ // BE8 swapping
+ if (parameters->options().user_set_be8())
+ {
+ section_size_type span_start, span_end;
+ elfcpp::Shdr<32, big_endian>
+ shdr(pshdrs + i * elfcpp::Elf_sizes<32>::shdr_size);
+ Mapping_symbol_position section_start(i, 0);
+ typename Mapping_symbols_info::const_iterator p =
+ this->mapping_symbols_info_.lower_bound(section_start);
+ unsigned char* view = (*pviews)[i].view;
+ Arm_address view_address = (*pviews)[i].address;
+ section_size_type view_size = (*pviews)[i].view_size;
+ while (p != this->mapping_symbols_info_.end() && p->first.first == i)
+ {
+ typename Mapping_symbols_info::const_iterator next =
+ this->mapping_symbols_info_.upper_bound(p->first);
+
+ // Only swap arm code.
+ if (p->second == 'a')
+ {
+ Output_section* os = this->output_section(i);
+ gold_assert(os != NULL);
+ Arm_address section_address =
+ this->simple_input_section_output_address(i, os);
+ span_start = convert_to_section_size_type(p->first.second);
+ if (next != this->mapping_symbols_info_.end()
+ && next->first.first == i)
+ span_end = convert_to_section_size_type(next->first.second);
+ else
+ span_end = convert_to_section_size_type(shdr.get_sh_size());
+ unsigned char* section_view =
+ view + (section_address - view_address);
+ uint64_t section_size = this->section_size(i);
+
+ gold_assert(section_address >= view_address
+ && ((section_address + section_size)
+ <= (view_address + view_size)));
+
+ // Set Output view for swapping
+ unsigned char *oview = section_view + span_start;
+ unsigned int index = 0;
+ while (index + 3 < (span_end - span_start))
+ {
+ typedef typename elfcpp::Swap<32, big_endian>::Valtype Valtype;
+ Valtype* wv = reinterpret_cast<Valtype*>(oview+index);
+ uint32_t val = elfcpp::Swap<32, false>::readval(wv);
+ elfcpp::Swap<32, true>::writeval(wv, val);
+ index += 4;
+ }
+ }
+ p = next;
+ }
+ }
}
}
@@ -7785,9 +7839,16 @@ Output_data_plt_arm_standard<big_endian>::do_fill_first_plt_entry(
const size_t num_first_plt_words = (sizeof(first_plt_entry)
/ sizeof(first_plt_entry[0]));
for (size_t i = 0; i < num_first_plt_words - 1; i++)
- elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
+ if (parameters->options().user_set_be8())
+ elfcpp::Swap<32, false>::writeval(pov + i * 4, first_plt_entry[i]);
+ else
+ elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
// Last word in first PLT entry is &GOT[0] - .
- elfcpp::Swap<32, big_endian>::writeval(pov + 16,
+ if (parameters->options().user_set_be8())
+ elfcpp::Swap<32, false>::writeval(pov + 16,
+ got_address - (plt_address + 16));
+ else
+ elfcpp::Swap<32, big_endian>::writeval(pov + 16,
got_address - (plt_address + 16));
}
@@ -7846,11 +7907,20 @@ Output_data_plt_arm_short<big_endian>::do_fill_plt_entry(
gold_error(_("PLT offset too large, try linking with --long-plt"));
uint32_t plt_insn0 = plt_entry[0] | ((offset >> 20) & 0xff);
- elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
uint32_t plt_insn1 = plt_entry[1] | ((offset >> 12) & 0xff);
- elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
uint32_t plt_insn2 = plt_entry[2] | (offset & 0xfff);
- elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
+ if (parameters->options().user_set_be8())
+ {
+ elfcpp::Swap<32, false>::writeval(pov, plt_insn0);
+ elfcpp::Swap<32, false>::writeval(pov + 4, plt_insn1);
+ elfcpp::Swap<32, false>::writeval(pov + 8, plt_insn2);
+ }
+ else
+ {
+ elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
+ }
}
// This class generates long (16-byte) entries, for arbitrary displacements.
@@ -7906,13 +7976,23 @@ Output_data_plt_arm_long<big_endian>::do_fill_plt_entry(
- (plt_address + plt_offset + 8));
uint32_t plt_insn0 = plt_entry[0] | (offset >> 28);
- elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
uint32_t plt_insn1 = plt_entry[1] | ((offset >> 20) & 0xff);
- elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
uint32_t plt_insn2 = plt_entry[2] | ((offset >> 12) & 0xff);
- elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
uint32_t plt_insn3 = plt_entry[3] | (offset & 0xfff);
- elfcpp::Swap<32, big_endian>::writeval(pov + 12, plt_insn3);
+ if (parameters->options().user_set_be8())
+ {
+ elfcpp::Swap<32, false>::writeval(pov, plt_insn0);
+ elfcpp::Swap<32, false>::writeval(pov + 4, plt_insn1);
+ elfcpp::Swap<32, false>::writeval(pov + 8, plt_insn2);
+ elfcpp::Swap<32, false>::writeval(pov + 12, plt_insn3);
+ }
+ else
+ {
+ elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 12, plt_insn3);
+ }
}
// Write out the PLT. This uses the hand-coded instructions above,
@@ -10683,7 +10763,14 @@ Target_arm<big_endian>::do_adjust_elf_header(
e_ident[elfcpp::EI_OSABI] = 0;
e_ident[elfcpp::EI_ABIVERSION] = 0;
- // FIXME: Do EF_ARM_BE8 adjustment.
+ // Do EF_ARM_BE8 adjustment.
+ if (parameters->options().user_set_be8() && !big_endian)
+ gold_error("BE8 images only valid in big-endian mode.");
+ if (parameters->options().user_set_be8())
+ {
+ flags |= elfcpp::EF_ARM_BE8;
+ this->set_processor_specific_flags(flags);
+ }
// If we're working in EABI_VER5, set the hard/soft float ABI flags
// as appropriate.
diff --git a/gold/options.h b/gold/options.h
index 23c9658..7260c41 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -674,6 +674,9 @@ class General_options
DEFINE_bool_alias(dn, Bdynamic, options::ONE_DASH, '\0',
N_("alias for -Bstatic"), NULL, true);
+ DEFINE_bool(be8,options::TWO_DASHES, '\0', false,
+ N_("(ARM only) be8 -byte invariant addressing."), NULL);
+
DEFINE_bool(Bgroup, options::ONE_DASH, '\0', false,
N_("Use group name lookup rules for shared library"), NULL);
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2016-07-07 23:25 [Patch][Gold] BE8 for ARM Bharathi Seshadri (bseshadr)
@ 2016-08-09 9:57 ` Richard Earnshaw (lists)
2016-08-12 15:22 ` Cary Coutant
0 siblings, 1 reply; 17+ messages in thread
From: Richard Earnshaw (lists) @ 2016-08-09 9:57 UTC (permalink / raw)
To: Bharathi Seshadri (bseshadr), binutils; +Cc: ccoutant
On 08/07/16 00:25, Bharathi Seshadri (bseshadr) wrote:
> Hi,
>
> This patch implements the BE8 support for ARM in the gold linker. It has been tested on a non-trivial large program (size ~120MB).
> Thanks to Cary Coutant for his initial review.
>
> gold/ChangeLog
> 2016-07-07 Bharathi Seshadri <bseshadr@cisco.com>
>
> * options.h (General_options): Add --be8 option.
> * arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
> (Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
> (Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
> (Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
> (Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
>
> Regards,
> Bharathi
>
Why are you only swapping ARM code? Thumb is just the same, but in
granules of 2 bytes rather than 4.
R.
>
> be8_arm_patch.txt
>
>
> diff --git a/gold/arm.cc b/gold/arm.cc
> index c47b002..4b0f85f 100644
> --- a/gold/arm.cc
> +++ b/gold/arm.cc
> @@ -6639,6 +6639,60 @@ Arm_relobj<big_endian>::do_relocate_sections(
> section_address,
> section_size);
> }
> +
> + // BE8 swapping
> + if (parameters->options().user_set_be8())
> + {
> + section_size_type span_start, span_end;
> + elfcpp::Shdr<32, big_endian>
> + shdr(pshdrs + i * elfcpp::Elf_sizes<32>::shdr_size);
> + Mapping_symbol_position section_start(i, 0);
> + typename Mapping_symbols_info::const_iterator p =
> + this->mapping_symbols_info_.lower_bound(section_start);
> + unsigned char* view = (*pviews)[i].view;
> + Arm_address view_address = (*pviews)[i].address;
> + section_size_type view_size = (*pviews)[i].view_size;
> + while (p != this->mapping_symbols_info_.end() && p->first.first == i)
> + {
> + typename Mapping_symbols_info::const_iterator next =
> + this->mapping_symbols_info_.upper_bound(p->first);
> +
> + // Only swap arm code.
> + if (p->second == 'a')
> + {
> + Output_section* os = this->output_section(i);
> + gold_assert(os != NULL);
> + Arm_address section_address =
> + this->simple_input_section_output_address(i, os);
> + span_start = convert_to_section_size_type(p->first.second);
> + if (next != this->mapping_symbols_info_.end()
> + && next->first.first == i)
> + span_end = convert_to_section_size_type(next->first.second);
> + else
> + span_end = convert_to_section_size_type(shdr.get_sh_size());
> + unsigned char* section_view =
> + view + (section_address - view_address);
> + uint64_t section_size = this->section_size(i);
> +
> + gold_assert(section_address >= view_address
> + && ((section_address + section_size)
> + <= (view_address + view_size)));
> +
> + // Set Output view for swapping
> + unsigned char *oview = section_view + span_start;
> + unsigned int index = 0;
> + while (index + 3 < (span_end - span_start))
> + {
> + typedef typename elfcpp::Swap<32, big_endian>::Valtype Valtype;
> + Valtype* wv = reinterpret_cast<Valtype*>(oview+index);
> + uint32_t val = elfcpp::Swap<32, false>::readval(wv);
> + elfcpp::Swap<32, true>::writeval(wv, val);
> + index += 4;
> + }
> + }
> + p = next;
> + }
> + }
> }
> }
>
> @@ -7785,9 +7839,16 @@ Output_data_plt_arm_standard<big_endian>::do_fill_first_plt_entry(
> const size_t num_first_plt_words = (sizeof(first_plt_entry)
> / sizeof(first_plt_entry[0]));
> for (size_t i = 0; i < num_first_plt_words - 1; i++)
> - elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
> + if (parameters->options().user_set_be8())
> + elfcpp::Swap<32, false>::writeval(pov + i * 4, first_plt_entry[i]);
> + else
> + elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
> // Last word in first PLT entry is &GOT[0] - .
> - elfcpp::Swap<32, big_endian>::writeval(pov + 16,
> + if (parameters->options().user_set_be8())
> + elfcpp::Swap<32, false>::writeval(pov + 16,
> + got_address - (plt_address + 16));
> + else
> + elfcpp::Swap<32, big_endian>::writeval(pov + 16,
> got_address - (plt_address + 16));
> }
>
> @@ -7846,11 +7907,20 @@ Output_data_plt_arm_short<big_endian>::do_fill_plt_entry(
> gold_error(_("PLT offset too large, try linking with --long-plt"));
>
> uint32_t plt_insn0 = plt_entry[0] | ((offset >> 20) & 0xff);
> - elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
> uint32_t plt_insn1 = plt_entry[1] | ((offset >> 12) & 0xff);
> - elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
> uint32_t plt_insn2 = plt_entry[2] | (offset & 0xfff);
> - elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
> + if (parameters->options().user_set_be8())
> + {
> + elfcpp::Swap<32, false>::writeval(pov, plt_insn0);
> + elfcpp::Swap<32, false>::writeval(pov + 4, plt_insn1);
> + elfcpp::Swap<32, false>::writeval(pov + 8, plt_insn2);
> + }
> + else
> + {
> + elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
> + elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
> + elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
> + }
> }
>
> // This class generates long (16-byte) entries, for arbitrary displacements.
> @@ -7906,13 +7976,23 @@ Output_data_plt_arm_long<big_endian>::do_fill_plt_entry(
> - (plt_address + plt_offset + 8));
>
> uint32_t plt_insn0 = plt_entry[0] | (offset >> 28);
> - elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
> uint32_t plt_insn1 = plt_entry[1] | ((offset >> 20) & 0xff);
> - elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
> uint32_t plt_insn2 = plt_entry[2] | ((offset >> 12) & 0xff);
> - elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
> uint32_t plt_insn3 = plt_entry[3] | (offset & 0xfff);
> - elfcpp::Swap<32, big_endian>::writeval(pov + 12, plt_insn3);
> + if (parameters->options().user_set_be8())
> + {
> + elfcpp::Swap<32, false>::writeval(pov, plt_insn0);
> + elfcpp::Swap<32, false>::writeval(pov + 4, plt_insn1);
> + elfcpp::Swap<32, false>::writeval(pov + 8, plt_insn2);
> + elfcpp::Swap<32, false>::writeval(pov + 12, plt_insn3);
> + }
> + else
> + {
> + elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
> + elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
> + elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
> + elfcpp::Swap<32, big_endian>::writeval(pov + 12, plt_insn3);
> + }
> }
>
> // Write out the PLT. This uses the hand-coded instructions above,
> @@ -10683,7 +10763,14 @@ Target_arm<big_endian>::do_adjust_elf_header(
> e_ident[elfcpp::EI_OSABI] = 0;
> e_ident[elfcpp::EI_ABIVERSION] = 0;
>
> - // FIXME: Do EF_ARM_BE8 adjustment.
> + // Do EF_ARM_BE8 adjustment.
> + if (parameters->options().user_set_be8() && !big_endian)
> + gold_error("BE8 images only valid in big-endian mode.");
> + if (parameters->options().user_set_be8())
> + {
> + flags |= elfcpp::EF_ARM_BE8;
> + this->set_processor_specific_flags(flags);
> + }
>
> // If we're working in EABI_VER5, set the hard/soft float ABI flags
> // as appropriate.
> diff --git a/gold/options.h b/gold/options.h
> index 23c9658..7260c41 100644
> --- a/gold/options.h
> +++ b/gold/options.h
> @@ -674,6 +674,9 @@ class General_options
> DEFINE_bool_alias(dn, Bdynamic, options::ONE_DASH, '\0',
> N_("alias for -Bstatic"), NULL, true);
>
> + DEFINE_bool(be8,options::TWO_DASHES, '\0', false,
> + N_("(ARM only) be8 -byte invariant addressing."), NULL);
> +
> DEFINE_bool(Bgroup, options::ONE_DASH, '\0', false,
> N_("Use group name lookup rules for shared library"), NULL);
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2016-08-09 9:57 ` Richard Earnshaw (lists)
@ 2016-08-12 15:22 ` Cary Coutant
2016-08-12 15:36 ` Bharathi Seshadri (bseshadr)
0 siblings, 1 reply; 17+ messages in thread
From: Cary Coutant @ 2016-08-12 15:22 UTC (permalink / raw)
To: Richard Earnshaw (lists); +Cc: Bharathi Seshadri (bseshadr), binutils
> Why are you only swapping ARM code? Thumb is just the same, but in
> granules of 2 bytes rather than 4.
>
> R.
Bharathi,
I'm waiting for an answer to Richard's question. Aside from that,
there are only a few minor formatting issues that I'll fix before
committing.
-cary
^ permalink raw reply [flat|nested] 17+ messages in thread
* RE: [Patch][Gold] BE8 for ARM
2016-08-12 15:22 ` Cary Coutant
@ 2016-08-12 15:36 ` Bharathi Seshadri (bseshadr)
2016-08-12 16:35 ` Cary Coutant
0 siblings, 1 reply; 17+ messages in thread
From: Bharathi Seshadri (bseshadr) @ 2016-08-12 15:36 UTC (permalink / raw)
To: Cary Coutant, Richard Earnshaw (lists); +Cc: binutils
Hi Richard, Cary,
My application is arm only and non-thumb, so I did not include the thumb patch in the initial implementation. I'm now extending it to cover thumb. I'll post the patch when I'm done with testing.
Thanks,
Bharathi
-----Original Message-----
From: Cary Coutant [mailto:ccoutant@gmail.com]
Sent: Friday, August 12, 2016 8:22 AM
To: Richard Earnshaw (lists)
Cc: Bharathi Seshadri (bseshadr); binutils@sourceware.org
Subject: Re: [Patch][Gold] BE8 for ARM
> Why are you only swapping ARM code? Thumb is just the same, but in
> granules of 2 bytes rather than 4.
>
> R.
Bharathi,
I'm waiting for an answer to Richard's question. Aside from that, there are only a few minor formatting issues that I'll fix before committing.
-cary
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2016-08-12 15:36 ` Bharathi Seshadri (bseshadr)
@ 2016-08-12 16:35 ` Cary Coutant
2016-08-15 18:05 ` Bharathi Seshadri (bseshadr)
0 siblings, 1 reply; 17+ messages in thread
From: Cary Coutant @ 2016-08-12 16:35 UTC (permalink / raw)
To: Bharathi Seshadri (bseshadr); +Cc: Richard Earnshaw (lists), binutils
> My application is arm only and non-thumb, so I did not include the thumb patch in the initial implementation. I'm now extending it to cover thumb. I'll post the patch when I'm done with testing.
OK, thanks! Here are my comments on the formatting...
+ gold_assert(section_address >= view_address
+ && ((section_address + section_size)
+ <= (view_address + view_size)));
The indentation isn't right here. The "<=" should line up with the
second '(' in the line above.
for (size_t i = 0; i < num_first_plt_words - 1; i++)
- elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
+ if (parameters->options().user_set_be8())
+ elfcpp::Swap<32, false>::writeval(pov + i * 4, first_plt_entry[i]);
+ else
+ elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
(Two places.) I'd prefer to see braces around the body of the for loop
here, since it's a more complex statement.
+ if (parameters->options().user_set_be8())
+ elfcpp::Swap<32, false>::writeval(pov + 16,
+ got_address - (plt_address + 16));
+ else
+ elfcpp::Swap<32, big_endian>::writeval(pov + 16,
got_address - (plt_address + 16));
(Two places.) The indentation is off here, too. In each case,
"got_address" should line up under "pov".
+ if (parameters->options().user_set_be8())
Instead of "user_set_be8", you should probably be using just "be8".
The difference is that if --be8 is ever turned on by default,
user_set_be8() will still be true only if the option is explicitly
specified on the command line. (I do see a few other places in arm.cc
where the same argument applies; those should probably get cleaned up
someday.)
+ DEFINE_bool(be8,options::TWO_DASHES, '\0', false,
+ N_("(ARM only) be8 -byte invariant addressing."), NULL);
The hyphen in front of "byte" seems wrong. (For comparison, ld's help
text is simply "Output BE8 format image", but I find that fairly
unhelpful.)
-cary
^ permalink raw reply [flat|nested] 17+ messages in thread
* RE: [Patch][Gold] BE8 for ARM
2016-08-12 16:35 ` Cary Coutant
@ 2016-08-15 18:05 ` Bharathi Seshadri (bseshadr)
2016-08-16 14:17 ` Richard Earnshaw (lists)
2016-08-23 21:52 ` Cary Coutant
0 siblings, 2 replies; 17+ messages in thread
From: Bharathi Seshadri (bseshadr) @ 2016-08-15 18:05 UTC (permalink / raw)
To: Cary Coutant; +Cc: Richard Earnshaw (lists), binutils
[-- Attachment #1: Type: text/plain, Size: 3172 bytes --]
Hi,
Please find attached the BE8 patch that includes support for thumb as well.
I tested it on a hello world and bzip2 example for both arm and thumb besides a large arm application (size ~120MB).
No regressions with the gold test-suite for arm.
gold/ChangeLog
2016-08-15 Bharathi Seshadri <bseshadr@cisco.com>
* options.h (General_options): Add --be8 option.
* arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
(Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
(Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
(Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
(Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
Thanks,
Bharathi
-----Original Message-----
From: Cary Coutant [mailto:ccoutant@gmail.com]
Sent: Friday, August 12, 2016 9:35 AM
To: Bharathi Seshadri (bseshadr)
Cc: Richard Earnshaw (lists); binutils@sourceware.org
Subject: Re: [Patch][Gold] BE8 for ARM
> My application is arm only and non-thumb, so I did not include the thumb patch in the initial implementation. I'm now extending it to cover thumb. I'll post the patch when I'm done with testing.
OK, thanks! Here are my comments on the formatting...
+ gold_assert(section_address >= view_address
+ && ((section_address + section_size)
+ <= (view_address + view_size)));
The indentation isn't right here. The "<=" should line up with the second '(' in the line above.
for (size_t i = 0; i < num_first_plt_words - 1; i++)
- elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
+ if (parameters->options().user_set_be8())
+ elfcpp::Swap<32, false>::writeval(pov + i * 4, first_plt_entry[i]);
+ else
+ elfcpp::Swap<32, big_endian>::writeval(pov + i * 4,
+ first_plt_entry[i]);
(Two places.) I'd prefer to see braces around the body of the for loop here, since it's a more complex statement.
+ if (parameters->options().user_set_be8())
+ elfcpp::Swap<32, false>::writeval(pov + 16,
+ got_address - (plt_address +
+ 16)); else
+ elfcpp::Swap<32, big_endian>::writeval(pov + 16,
got_address - (plt_address + 16));
(Two places.) The indentation is off here, too. In each case, "got_address" should line up under "pov".
+ if (parameters->options().user_set_be8())
Instead of "user_set_be8", you should probably be using just "be8".
The difference is that if --be8 is ever turned on by default,
user_set_be8() will still be true only if the option is explicitly specified on the command line. (I do see a few other places in arm.cc where the same argument applies; those should probably get cleaned up
someday.)
+ DEFINE_bool(be8,options::TWO_DASHES, '\0', false,
+ N_("(ARM only) be8 -byte invariant addressing."), NULL);
The hyphen in front of "byte" seems wrong. (For comparison, ld's help text is simply "Output BE8 format image", but I find that fairly
unhelpful.)
-cary
[-- Attachment #2: be8_patch.txt --]
[-- Type: text/plain, Size: 7161 bytes --]
diff --git a/gold/arm.cc b/gold/arm.cc
index c47b002..2159dda 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -6639,6 +6639,79 @@ Arm_relobj<big_endian>::do_relocate_sections(
section_address,
section_size);
}
+ // BE8 swapping
+ if (parameters->options().be8())
+ {
+ section_size_type span_start, span_end;
+ elfcpp::Shdr<32, big_endian>
+ shdr(pshdrs + i * elfcpp::Elf_sizes<32>::shdr_size);
+ Mapping_symbol_position section_start(i, 0);
+ typename Mapping_symbols_info::const_iterator p =
+ this->mapping_symbols_info_.lower_bound(section_start);
+ unsigned char* view = (*pviews)[i].view;
+ Arm_address view_address = (*pviews)[i].address;
+ section_size_type view_size = (*pviews)[i].view_size;
+ while (p != this->mapping_symbols_info_.end()
+ && p->first.first == i)
+ {
+ typename Mapping_symbols_info::const_iterator next =
+ this->mapping_symbols_info_.upper_bound(p->first);
+
+ // Only swap arm or thumb code.
+ if ((p->second == 'a') || (p->second == 't'))
+ {
+ Output_section* os = this->output_section(i);
+ gold_assert(os != NULL);
+ Arm_address section_address =
+ this->simple_input_section_output_address(i, os);
+ span_start = convert_to_section_size_type(p->first.second);
+ if (next != this->mapping_symbols_info_.end()
+ && next->first.first == i)
+ span_end =
+ convert_to_section_size_type(next->first.second);
+ else
+ span_end =
+ convert_to_section_size_type(shdr.get_sh_size());
+ unsigned char* section_view =
+ view + (section_address - view_address);
+ uint64_t section_size = this->section_size(i);
+
+ gold_assert(section_address >= view_address
+ && ((section_address + section_size)
+ <= (view_address + view_size)));
+
+ // Set Output view for swapping
+ unsigned char *oview = section_view + span_start;
+ unsigned int index = 0;
+ if (p->second == 'a')
+ {
+ while (index + 3 < (span_end - span_start))
+ {
+ typedef typename elfcpp::Swap<32, big_endian>
+ ::Valtype Valtype;
+ Valtype* wv =
+ reinterpret_cast<Valtype*>(oview+index);
+ uint32_t val = elfcpp::Swap<32, false>::readval(wv);
+ elfcpp::Swap<32, true>::writeval(wv, val);
+ index += 4;
+ }
+ }
+ else if (p->second == 't')
+ {
+ while (index + 1 < (span_end - span_start))
+ {
+ typedef typename elfcpp::Swap<16, big_endian>
+ ::Valtype Valtype;
+ Valtype* wv = reinterpret_cast<Valtype*>(oview+index);
+ uint16_t val = elfcpp::Swap<16, false>::readval(wv);
+ elfcpp::Swap<16, true>::writeval(wv, val);
+ index += 2;
+ }
+ }
+ }
+ p = next;
+ }
+ }
}
}
@@ -7785,7 +7858,18 @@ Output_data_plt_arm_standard<big_endian>::do_fill_first_plt_entry(
const size_t num_first_plt_words = (sizeof(first_plt_entry)
/ sizeof(first_plt_entry[0]));
for (size_t i = 0; i < num_first_plt_words - 1; i++)
- elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
+ {
+ if (parameters->options().be8())
+ {
+ elfcpp::Swap<32, false>::writeval(pov + i * 4,
+ first_plt_entry[i]);
+ }
+ else
+ {
+ elfcpp::Swap<32, big_endian>::writeval(pov + i * 4,
+ first_plt_entry[i]);
+ }
+ }
// Last word in first PLT entry is &GOT[0] - .
elfcpp::Swap<32, big_endian>::writeval(pov + 16,
got_address - (plt_address + 16));
@@ -7846,11 +7930,21 @@ Output_data_plt_arm_short<big_endian>::do_fill_plt_entry(
gold_error(_("PLT offset too large, try linking with --long-plt"));
uint32_t plt_insn0 = plt_entry[0] | ((offset >> 20) & 0xff);
- elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
uint32_t plt_insn1 = plt_entry[1] | ((offset >> 12) & 0xff);
- elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
uint32_t plt_insn2 = plt_entry[2] | (offset & 0xfff);
- elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
+
+ if (parameters->options().be8())
+ {
+ elfcpp::Swap<32, false>::writeval(pov, plt_insn0);
+ elfcpp::Swap<32, false>::writeval(pov + 4, plt_insn1);
+ elfcpp::Swap<32, false>::writeval(pov + 8, plt_insn2);
+ }
+ else
+ {
+ elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
+ }
}
// This class generates long (16-byte) entries, for arbitrary displacements.
@@ -7906,13 +8000,24 @@ Output_data_plt_arm_long<big_endian>::do_fill_plt_entry(
- (plt_address + plt_offset + 8));
uint32_t plt_insn0 = plt_entry[0] | (offset >> 28);
- elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
uint32_t plt_insn1 = plt_entry[1] | ((offset >> 20) & 0xff);
- elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
uint32_t plt_insn2 = plt_entry[2] | ((offset >> 12) & 0xff);
- elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
uint32_t plt_insn3 = plt_entry[3] | (offset & 0xfff);
- elfcpp::Swap<32, big_endian>::writeval(pov + 12, plt_insn3);
+
+ if (parameters->options().be8())
+ {
+ elfcpp::Swap<32, false>::writeval(pov, plt_insn0);
+ elfcpp::Swap<32, false>::writeval(pov + 4, plt_insn1);
+ elfcpp::Swap<32, false>::writeval(pov + 8, plt_insn2);
+ elfcpp::Swap<32, false>::writeval(pov + 12, plt_insn3);
+ }
+ else
+ {
+ elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 12, plt_insn3);
+ }
}
// Write out the PLT. This uses the hand-coded instructions above,
@@ -10683,7 +10788,14 @@ Target_arm<big_endian>::do_adjust_elf_header(
e_ident[elfcpp::EI_OSABI] = 0;
e_ident[elfcpp::EI_ABIVERSION] = 0;
- // FIXME: Do EF_ARM_BE8 adjustment.
+ // Do EF_ARM_BE8 adjustment.
+ if (parameters->options().be8() && !big_endian)
+ gold_error("BE8 images only valid in big-endian mode.");
+ if (parameters->options().be8())
+ {
+ flags |= elfcpp::EF_ARM_BE8;
+ this->set_processor_specific_flags(flags);
+ }
// If we're working in EABI_VER5, set the hard/soft float ABI flags
// as appropriate.
diff --git a/gold/options.h b/gold/options.h
index 23c9658..8680635 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -674,6 +674,9 @@ class General_options
DEFINE_bool_alias(dn, Bdynamic, options::ONE_DASH, '\0',
N_("alias for -Bstatic"), NULL, true);
+ DEFINE_bool(be8,options::TWO_DASHES, '\0', false,
+ N_("Output BE8 format image"), NULL);
+
DEFINE_bool(Bgroup, options::ONE_DASH, '\0', false,
N_("Use group name lookup rules for shared library"), NULL);
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2016-08-15 18:05 ` Bharathi Seshadri (bseshadr)
@ 2016-08-16 14:17 ` Richard Earnshaw (lists)
2016-08-23 21:52 ` Cary Coutant
1 sibling, 0 replies; 17+ messages in thread
From: Richard Earnshaw (lists) @ 2016-08-16 14:17 UTC (permalink / raw)
To: Bharathi Seshadri (bseshadr), Cary Coutant; +Cc: binutils
On 15/08/16 19:05, Bharathi Seshadri (bseshadr) wrote:
> Hi,
>
> Please find attached the BE8 patch that includes support for thumb as well.
> I tested it on a hello world and bzip2 example for both arm and thumb besides a large arm application (size ~120MB).
> No regressions with the gold test-suite for arm.
>
Thanks for adding that. For the record I don't know the Gold code well
enough to review this further, so I'll leave that to Cary.
R.
> gold/ChangeLog
> 2016-08-15 Bharathi Seshadri <bseshadr@cisco.com>
>
> * options.h (General_options): Add --be8 option.
> * arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
> (Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
> (Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
> (Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
> (Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
>
> Thanks,
> Bharathi
>
> -----Original Message-----
> From: Cary Coutant [mailto:ccoutant@gmail.com]
> Sent: Friday, August 12, 2016 9:35 AM
> To: Bharathi Seshadri (bseshadr)
> Cc: Richard Earnshaw (lists); binutils@sourceware.org
> Subject: Re: [Patch][Gold] BE8 for ARM
>
>> My application is arm only and non-thumb, so I did not include the thumb patch in the initial implementation. I'm now extending it to cover thumb. I'll post the patch when I'm done with testing.
>
> OK, thanks! Here are my comments on the formatting...
>
> + gold_assert(section_address >= view_address
> + && ((section_address + section_size)
> + <= (view_address + view_size)));
>
> The indentation isn't right here. The "<=" should line up with the second '(' in the line above.
>
> for (size_t i = 0; i < num_first_plt_words - 1; i++)
> - elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
> + if (parameters->options().user_set_be8())
> + elfcpp::Swap<32, false>::writeval(pov + i * 4, first_plt_entry[i]);
> + else
> + elfcpp::Swap<32, big_endian>::writeval(pov + i * 4,
> + first_plt_entry[i]);
>
> (Two places.) I'd prefer to see braces around the body of the for loop here, since it's a more complex statement.
>
> + if (parameters->options().user_set_be8())
> + elfcpp::Swap<32, false>::writeval(pov + 16,
> + got_address - (plt_address +
> + 16)); else
> + elfcpp::Swap<32, big_endian>::writeval(pov + 16,
> got_address - (plt_address + 16));
>
> (Two places.) The indentation is off here, too. In each case, "got_address" should line up under "pov".
>
> + if (parameters->options().user_set_be8())
>
> Instead of "user_set_be8", you should probably be using just "be8".
> The difference is that if --be8 is ever turned on by default,
> user_set_be8() will still be true only if the option is explicitly specified on the command line. (I do see a few other places in arm.cc where the same argument applies; those should probably get cleaned up
> someday.)
>
> + DEFINE_bool(be8,options::TWO_DASHES, '\0', false,
> + N_("(ARM only) be8 -byte invariant addressing."), NULL);
>
> The hyphen in front of "byte" seems wrong. (For comparison, ld's help text is simply "Output BE8 format image", but I find that fairly
> unhelpful.)
>
> -cary
>
>
> be8_patch.txt
>
>
> diff --git a/gold/arm.cc b/gold/arm.cc
> index c47b002..2159dda 100644
> --- a/gold/arm.cc
> +++ b/gold/arm.cc
> @@ -6639,6 +6639,79 @@ Arm_relobj<big_endian>::do_relocate_sections(
> section_address,
> section_size);
> }
> + // BE8 swapping
> + if (parameters->options().be8())
> + {
> + section_size_type span_start, span_end;
> + elfcpp::Shdr<32, big_endian>
> + shdr(pshdrs + i * elfcpp::Elf_sizes<32>::shdr_size);
> + Mapping_symbol_position section_start(i, 0);
> + typename Mapping_symbols_info::const_iterator p =
> + this->mapping_symbols_info_.lower_bound(section_start);
> + unsigned char* view = (*pviews)[i].view;
> + Arm_address view_address = (*pviews)[i].address;
> + section_size_type view_size = (*pviews)[i].view_size;
> + while (p != this->mapping_symbols_info_.end()
> + && p->first.first == i)
> + {
> + typename Mapping_symbols_info::const_iterator next =
> + this->mapping_symbols_info_.upper_bound(p->first);
> +
> + // Only swap arm or thumb code.
> + if ((p->second == 'a') || (p->second == 't'))
> + {
> + Output_section* os = this->output_section(i);
> + gold_assert(os != NULL);
> + Arm_address section_address =
> + this->simple_input_section_output_address(i, os);
> + span_start = convert_to_section_size_type(p->first.second);
> + if (next != this->mapping_symbols_info_.end()
> + && next->first.first == i)
> + span_end =
> + convert_to_section_size_type(next->first.second);
> + else
> + span_end =
> + convert_to_section_size_type(shdr.get_sh_size());
> + unsigned char* section_view =
> + view + (section_address - view_address);
> + uint64_t section_size = this->section_size(i);
> +
> + gold_assert(section_address >= view_address
> + && ((section_address + section_size)
> + <= (view_address + view_size)));
> +
> + // Set Output view for swapping
> + unsigned char *oview = section_view + span_start;
> + unsigned int index = 0;
> + if (p->second == 'a')
> + {
> + while (index + 3 < (span_end - span_start))
> + {
> + typedef typename elfcpp::Swap<32, big_endian>
> + ::Valtype Valtype;
> + Valtype* wv =
> + reinterpret_cast<Valtype*>(oview+index);
> + uint32_t val = elfcpp::Swap<32, false>::readval(wv);
> + elfcpp::Swap<32, true>::writeval(wv, val);
> + index += 4;
> + }
> + }
> + else if (p->second == 't')
> + {
> + while (index + 1 < (span_end - span_start))
> + {
> + typedef typename elfcpp::Swap<16, big_endian>
> + ::Valtype Valtype;
> + Valtype* wv = reinterpret_cast<Valtype*>(oview+index);
> + uint16_t val = elfcpp::Swap<16, false>::readval(wv);
> + elfcpp::Swap<16, true>::writeval(wv, val);
> + index += 2;
> + }
> + }
> + }
> + p = next;
> + }
> + }
> }
> }
>
> @@ -7785,7 +7858,18 @@ Output_data_plt_arm_standard<big_endian>::do_fill_first_plt_entry(
> const size_t num_first_plt_words = (sizeof(first_plt_entry)
> / sizeof(first_plt_entry[0]));
> for (size_t i = 0; i < num_first_plt_words - 1; i++)
> - elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
> + {
> + if (parameters->options().be8())
> + {
> + elfcpp::Swap<32, false>::writeval(pov + i * 4,
> + first_plt_entry[i]);
> + }
> + else
> + {
> + elfcpp::Swap<32, big_endian>::writeval(pov + i * 4,
> + first_plt_entry[i]);
> + }
> + }
> // Last word in first PLT entry is &GOT[0] - .
> elfcpp::Swap<32, big_endian>::writeval(pov + 16,
> got_address - (plt_address + 16));
> @@ -7846,11 +7930,21 @@ Output_data_plt_arm_short<big_endian>::do_fill_plt_entry(
> gold_error(_("PLT offset too large, try linking with --long-plt"));
>
> uint32_t plt_insn0 = plt_entry[0] | ((offset >> 20) & 0xff);
> - elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
> uint32_t plt_insn1 = plt_entry[1] | ((offset >> 12) & 0xff);
> - elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
> uint32_t plt_insn2 = plt_entry[2] | (offset & 0xfff);
> - elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
> +
> + if (parameters->options().be8())
> + {
> + elfcpp::Swap<32, false>::writeval(pov, plt_insn0);
> + elfcpp::Swap<32, false>::writeval(pov + 4, plt_insn1);
> + elfcpp::Swap<32, false>::writeval(pov + 8, plt_insn2);
> + }
> + else
> + {
> + elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
> + elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
> + elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
> + }
> }
>
> // This class generates long (16-byte) entries, for arbitrary displacements.
> @@ -7906,13 +8000,24 @@ Output_data_plt_arm_long<big_endian>::do_fill_plt_entry(
> - (plt_address + plt_offset + 8));
>
> uint32_t plt_insn0 = plt_entry[0] | (offset >> 28);
> - elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
> uint32_t plt_insn1 = plt_entry[1] | ((offset >> 20) & 0xff);
> - elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
> uint32_t plt_insn2 = plt_entry[2] | ((offset >> 12) & 0xff);
> - elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
> uint32_t plt_insn3 = plt_entry[3] | (offset & 0xfff);
> - elfcpp::Swap<32, big_endian>::writeval(pov + 12, plt_insn3);
> +
> + if (parameters->options().be8())
> + {
> + elfcpp::Swap<32, false>::writeval(pov, plt_insn0);
> + elfcpp::Swap<32, false>::writeval(pov + 4, plt_insn1);
> + elfcpp::Swap<32, false>::writeval(pov + 8, plt_insn2);
> + elfcpp::Swap<32, false>::writeval(pov + 12, plt_insn3);
> + }
> + else
> + {
> + elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
> + elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
> + elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
> + elfcpp::Swap<32, big_endian>::writeval(pov + 12, plt_insn3);
> + }
> }
>
> // Write out the PLT. This uses the hand-coded instructions above,
> @@ -10683,7 +10788,14 @@ Target_arm<big_endian>::do_adjust_elf_header(
> e_ident[elfcpp::EI_OSABI] = 0;
> e_ident[elfcpp::EI_ABIVERSION] = 0;
>
> - // FIXME: Do EF_ARM_BE8 adjustment.
> + // Do EF_ARM_BE8 adjustment.
> + if (parameters->options().be8() && !big_endian)
> + gold_error("BE8 images only valid in big-endian mode.");
> + if (parameters->options().be8())
> + {
> + flags |= elfcpp::EF_ARM_BE8;
> + this->set_processor_specific_flags(flags);
> + }
>
> // If we're working in EABI_VER5, set the hard/soft float ABI flags
> // as appropriate.
> diff --git a/gold/options.h b/gold/options.h
> index 23c9658..8680635 100644
> --- a/gold/options.h
> +++ b/gold/options.h
> @@ -674,6 +674,9 @@ class General_options
> DEFINE_bool_alias(dn, Bdynamic, options::ONE_DASH, '\0',
> N_("alias for -Bstatic"), NULL, true);
>
> + DEFINE_bool(be8,options::TWO_DASHES, '\0', false,
> + N_("Output BE8 format image"), NULL);
> +
> DEFINE_bool(Bgroup, options::ONE_DASH, '\0', false,
> N_("Use group name lookup rules for shared library"), NULL);
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2016-08-15 18:05 ` Bharathi Seshadri (bseshadr)
2016-08-16 14:17 ` Richard Earnshaw (lists)
@ 2016-08-23 21:52 ` Cary Coutant
2017-09-08 11:27 ` Umesh Kalappa
1 sibling, 1 reply; 17+ messages in thread
From: Cary Coutant @ 2016-08-23 21:52 UTC (permalink / raw)
To: Bharathi Seshadri (bseshadr); +Cc: Richard Earnshaw (lists), binutils
> Please find attached the BE8 patch that includes support for thumb as well.
> I tested it on a hello world and bzip2 example for both arm and thumb besides a large arm application (size ~120MB).
> No regressions with the gold test-suite for arm.
>
> gold/ChangeLog
> 2016-08-15 Bharathi Seshadri <bseshadr@cisco.com>
>
> * options.h (General_options): Add --be8 option.
> * arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
> (Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
> (Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
> (Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
> (Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
Committed. Thanks!
-cary
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2016-08-23 21:52 ` Cary Coutant
@ 2017-09-08 11:27 ` Umesh Kalappa
0 siblings, 0 replies; 17+ messages in thread
From: Umesh Kalappa @ 2017-09-08 11:27 UTC (permalink / raw)
To: Cary Coutant
Cc: Bharathi Seshadri (bseshadr), Richard Earnshaw (lists), binutils
[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]
Hi Cary and everyone,
Arm/thumb stubs support was missed in the be8 mode with the previous
patch, hence adding the same with the unit cases.
No Regress on gold test-suites.
Please do needful by committing the same.
Thank you
~Umesh
On Wed, Aug 24, 2016 at 3:21 AM, Cary Coutant <ccoutant@gmail.com> wrote:
>> Please find attached the BE8 patch that includes support for thumb as well.
>> I tested it on a hello world and bzip2 example for both arm and thumb besides a large arm application (size ~120MB).
>> No regressions with the gold test-suite for arm.
>>
>> gold/ChangeLog
>> 2016-08-15 Bharathi Seshadri <bseshadr@cisco.com>
>>
>> * options.h (General_options): Add --be8 option.
>> * arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
>> (Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
>> (Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
>> (Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
>> (Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
>
> Committed. Thanks!
>
> -cary
[-- Attachment #2: be8_stubs_support.patch --]
[-- Type: application/octet-stream, Size: 12123 bytes --]
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 2343215..c0df05b 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-08 Umesh Kalappa <ukalappa@cisco.com>
+ * arm.cc (Stub::do_fixed_endian_write):Far call stubs
+ support for arm in the be8 mode.
+ * testsuite/Makefile.am: New test cases.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/arm_farcall_arm_arm_be8.sh: New script for arm to arm far call stubs.
+ * testsuite/arm_farcall_thumb_thumb_be8.sh: New script for thumb to thumb far call stubs.
+
2017-08-30 Alan Modra <amodra@gmail.com>
* powerpc.cc (Target_powerpc::Relocate::relocate): Nop addis on
diff --git a/gold/arm.cc b/gold/arm.cc
index f887fe5..8447559 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -4516,6 +4516,7 @@ Stub::do_fixed_endian_write(unsigned char* view, section_size_type view_size)
{
const Stub_template* stub_template = this->stub_template();
const Insn_template* insns = stub_template->insns();
+ unsigned int enable_be8 = parameters->options().be8();
// FIXME: We do not handle BE8 encoding yet.
unsigned char* pov = view;
@@ -4524,22 +4525,39 @@ Stub::do_fixed_endian_write(unsigned char* view, section_size_type view_size)
switch (insns[i].type())
{
case Insn_template::THUMB16_TYPE:
- elfcpp::Swap<16, big_endian>::writeval(pov, insns[i].data() & 0xffff);
+ if (enable_be8)
+ elfcpp::Swap<16, false>::writeval(pov, insns[i].data() & 0xffff);
+ else
+ elfcpp::Swap<16, big_endian>::writeval(pov, insns[i].data() & 0xffff);
break;
case Insn_template::THUMB16_SPECIAL_TYPE:
- elfcpp::Swap<16, big_endian>::writeval(
- pov,
- this->thumb16_special(i));
+ if (enable_be8)
+ elfcpp::Swap<16, false>::writeval(
+ pov,this->thumb16_special(i));
+ else
+ elfcpp::Swap<16, big_endian>::writeval(
+ pov,this->thumb16_special(i));
break;
case Insn_template::THUMB32_TYPE:
{
uint32_t hi = (insns[i].data() >> 16) & 0xffff;
uint32_t lo = insns[i].data() & 0xffff;
- elfcpp::Swap<16, big_endian>::writeval(pov, hi);
- elfcpp::Swap<16, big_endian>::writeval(pov + 2, lo);
+ if (enable_be8) {
+ elfcpp::Swap<16, false>::writeval(pov, hi);
+ elfcpp::Swap<16, false>::writeval(pov + 2, lo);
+ }
+ else {
+ elfcpp::Swap<16, big_endian>::writeval(pov, hi);
+ elfcpp::Swap<16, big_endian>::writeval(pov + 2, lo);
+ }
}
break;
case Insn_template::ARM_TYPE:
+ if (enable_be8)
+ elfcpp::Swap<32, false>::writeval(pov, insns[i].data());
+ else
+ elfcpp::Swap<32, big_endian>::writeval(pov, insns[i].data());
+ break;
case Insn_template::DATA_TYPE:
elfcpp::Swap<32, big_endian>::writeval(pov, insns[i].data());
break;
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index b9d9c8c..6bbd6eb 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -3710,6 +3710,38 @@ arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
+#Check ARM to ARM farcall veneers in the be8 mode addressing
+
+check_SCRIPTS += arm_farcall_arm_arm_be8.sh
+check_DATA += arm_farcall_arm_arm_be8.stdout
+
+arm_farcall_arm_arm_be8.stdout: arm_farcall_arm_arm_be8
+ $(TEST_OBJDUMP) -D $< > $@
+
+arm_farcall_arm_arm_be8: arm_farcall_arm_arm_be8.o ../ld-new
+ ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -EB --be8 -o $@ $<
+
+arm_farcall_arm_arm_be8.o: arm_farcall_arm_arm.s
+ $(TEST_AS) -EB -o $@ $<
+
+MOSTLYCLEANFILES += arm_farcall_arm_arm_be8
+
+#Check THUMB to THUMB farcall veneers in the be8 mode addressing
+
+check_SCRIPTS += arm_farcall_thumb_thumb_be8.sh
+check_DATA += arm_farcall_thumb_thumb_be8.stdout
+
+arm_farcall_thumb_thumb_be8.stdout: arm_farcall_thumb_thumb_be8
+ $(TEST_OBJDUMP) -D $< > $@
+
+arm_farcall_thumb_thumb_be8: arm_farcall_thumb_thumb_be8.o ../ld-new
+ ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -EB --be8 -o $@ $<
+
+arm_farcall_thumb_thumb_be8.o: arm_farcall_thumb_thumb.s
+ $(TEST_AS) -march=armv7-m -EB -o $@ $<
+
+MOSTLYCLEANFILES += arm_farcall_thumb_thumb_be8
+
# Check Thumb to ARM farcall veneers
check_SCRIPTS += arm_farcall_thumb_arm.sh
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 8e71ba7..b8a301a 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -869,6 +869,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_thumb.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm.sh \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_arm_be8.sh \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_be8.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target1_abs.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target1_rel.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_rel.sh \
@@ -916,6 +918,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_thumb.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_thumb_5t.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb.stdout \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_arm_be8.stdout \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_be8.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_5t.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_7m.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_6m.stdout \
@@ -5297,6 +5301,10 @@ arm_farcall_thumb_thumb.sh.log: arm_farcall_thumb_thumb.sh
@p='arm_farcall_thumb_thumb.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
arm_farcall_thumb_arm.sh.log: arm_farcall_thumb_arm.sh
@p='arm_farcall_thumb_arm.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+arm_farcall_arm_arm_be8.sh.log: arm_farcall_arm_arm_be8.sh
+ @p='arm_farcall_arm_arm_be8.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+arm_farcall_thumb_thumb_be8.sh.log: arm_farcall_thumb_thumb_be8.sh
+ @p='arm_farcall_thumb_thumb_be8.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
arm_target1_abs.sh.log: arm_target1_abs.sh
@p='arm_target1_abs.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
arm_target1_rel.sh.log: arm_target1_rel.sh
@@ -7802,6 +7810,24 @@ uninstall-am:
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv7-m -o $@ $<
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_arm_arm_be8.stdout: arm_farcall_arm_arm_be8
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_arm_arm_be8: arm_farcall_arm_arm_be8.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -EB --be8 -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_arm_arm_be8.o: arm_farcall_arm_arm.s
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -EB -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_be8.stdout: arm_farcall_thumb_thumb_be8
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_be8: arm_farcall_thumb_thumb_be8.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -EB --be8 -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_be8.o: arm_farcall_thumb_thumb.s
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv7-m -EB -o $@ $<
+
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@
diff --git a/gold/testsuite/arm_farcall_arm_arm_be8.sh b/gold/testsuite/arm_farcall_arm_arm_be8.sh
new file mode 100644
index 0000000..e21a16d
--- /dev/null
+++ b/gold/testsuite/arm_farcall_arm_arm_be8.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# arm_farcall_arm_arm_be8.sh -- a test case for ARM->ARM farcall veneers
+
+# Copyright (C) 2010-2017 Free Software Foundation, Inc.
+# This file is part of gold.
+# Based on arm_farcall_arm_arm.s file.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected instruction in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual instructions below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Check for ARM->ARM default
+check arm_farcall_arm_arm_be8.stdout "1004: .* ldr pc, \[pc, #-4\] .*"
+check arm_farcall_arm_arm_be8.stdout "1008: 20100002"
+
+exit 0
diff --git a/gold/testsuite/arm_farcall_thumb_thumb_be8.sh b/gold/testsuite/arm_farcall_thumb_thumb_be8.sh
new file mode 100644
index 0000000..c772a93
--- /dev/null
+++ b/gold/testsuite/arm_farcall_thumb_thumb_be8.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# arm_farcall_thumb_thumb_be8.sh -- a test case for Thumb->Thumb farcall veneers.
+
+# Copyright (C) 2010-2017 Free Software Foundation, Inc.
+# This file is part of gold.
+# Based on arm_farcall_thumb_thumb.s file
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected instruction in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual instructions below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Thumb->Thumb
+check arm_farcall_thumb_thumb_be8.stdout "1004:\sb401"
+check arm_farcall_thumb_thumb_be8.stdout "1006:\s4802"
+check arm_farcall_thumb_thumb_be8.stdout "1008:\s4684"
+check arm_farcall_thumb_thumb_be8.stdout "100a:\sbc01"
+check arm_farcall_thumb_thumb_be8.stdout "100c:\s4760"
+check arm_farcall_thumb_thumb_be8.stdout "100e:\sbf00"
+check arm_farcall_thumb_thumb_be8.stdout "1010:\s0002"
+check arm_farcall_thumb_thumb_be8.stdout "1012:\s1510"
+
+exit 0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
@ 2016-08-09 9:25 Umesh Kalappa
2016-08-12 5:35 ` Sriraman Tallam
0 siblings, 1 reply; 17+ messages in thread
From: Umesh Kalappa @ 2016-08-09 9:25 UTC (permalink / raw)
To: Bharathi Seshadri (bseshadr), Doug Kwan, Sriraman Tallam
Cc: binutils, ccoutant
Hi Doug /Sriram.
Any inputs/suggestions here ,will be appreciated .
Thank you
~Umesh
On Fri, Jul 8, 2016 at 4:55 AM, Bharathi Seshadri (bseshadr)
<bseshadr@cisco.com> wrote:
> Hi,
>
> This patch implements the BE8 support for ARM in the gold linker. It has been tested on a non-trivial large program (size ~120MB).
> Thanks to Cary Coutant for his initial review.
>
> gold/ChangeLog
> 2016-07-07 Bharathi Seshadri <bseshadr@cisco.com>
>
> * options.h (General_options): Add --be8 option.
> * arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
> (Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
> (Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
> (Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
> (Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
>
> Regards,
> Bharathi
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2016-08-09 9:25 Umesh Kalappa
@ 2016-08-12 5:35 ` Sriraman Tallam
0 siblings, 0 replies; 17+ messages in thread
From: Sriraman Tallam @ 2016-08-12 5:35 UTC (permalink / raw)
To: Umesh Kalappa; +Cc: Bharathi Seshadri (bseshadr), Doug Kwan, binutils, ccoutant
On Tue, Aug 9, 2016 at 2:25 AM, Umesh Kalappa <umesh.kalappa0@gmail.com> wrote:
> Hi Doug /Sriram.
>
> Any inputs/suggestions here ,will be appreciated .
I don't think I can be of much help here, not familiar with ARM.
Sri
>
> Thank you
> ~Umesh
>
> On Fri, Jul 8, 2016 at 4:55 AM, Bharathi Seshadri (bseshadr)
> <bseshadr@cisco.com> wrote:
>> Hi,
>>
>> This patch implements the BE8 support for ARM in the gold linker. It has been tested on a non-trivial large program (size ~120MB).
>> Thanks to Cary Coutant for his initial review.
>>
>> gold/ChangeLog
>> 2016-07-07 Bharathi Seshadri <bseshadr@cisco.com>
>>
>> * options.h (General_options): Add --be8 option.
>> * arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
>> (Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
>> (Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
>> (Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
>> (Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
>>
>> Regards,
>> Bharathi
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
@ 2017-09-13 6:25 Umesh Kalappa
2017-09-20 22:30 ` Cary Coutant
0 siblings, 1 reply; 17+ messages in thread
From: Umesh Kalappa @ 2017-09-13 6:25 UTC (permalink / raw)
To: Cary Coutant
Cc: Bharathi Seshadri (bseshadr), Richard Earnshaw (lists), binutils
Ping ,
Any comments or good to commit ?
Thank you
~Umesh
On Fri, Sep 8, 2017 at 4:57 PM, Umesh Kalappa <umesh.kalappa0@gmail.com> wrote:
> Hi Cary and everyone,
>
> Arm/thumb stubs support was missed in the be8 mode with the previous
> patch, hence adding the same with the unit cases.
>
> No Regress on gold test-suites.
>
> Please do needful by committing the same.
>
> Thank you
> ~Umesh
>
> On Wed, Aug 24, 2016 at 3:21 AM, Cary Coutant <ccoutant@gmail.com> wrote:
>>> Please find attached the BE8 patch that includes support for thumb as well.
>>> I tested it on a hello world and bzip2 example for both arm and thumb besides a large arm application (size ~120MB).
>>> No regressions with the gold test-suite for arm.
>>>
>>> gold/ChangeLog
>>> 2016-08-15 Bharathi Seshadri <bseshadr@cisco.com>
>>>
>>> * options.h (General_options): Add --be8 option.
>>> * arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
>>> (Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
>>> (Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
>>> (Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
>>> (Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
>>
>> Committed. Thanks!
>>
>> -cary
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2017-09-13 6:25 Umesh Kalappa
@ 2017-09-20 22:30 ` Cary Coutant
2017-09-25 10:58 ` Umesh Kalappa
0 siblings, 1 reply; 17+ messages in thread
From: Cary Coutant @ 2017-09-20 22:30 UTC (permalink / raw)
To: Umesh Kalappa
Cc: Bharathi Seshadri (bseshadr), Richard Earnshaw (lists), binutils
>> Arm/thumb stubs support was missed in the be8 mode with the previous
>> patch, hence adding the same with the unit cases.
>>
>> No Regress on gold test-suites.
+ if (enable_be8)
+ elfcpp::Swap<16, false>::writeval(pov, insns[i].data() & 0xffff);
+ else
+ elfcpp::Swap<16, big_endian>::writeval(pov, insns[i].data() & 0xffff);
These lines are not indented correctly.
+ if (enable_be8)
+ elfcpp::Swap<16, false>::writeval(
+ pov,this->thumb16_special(i));
+ else
+ elfcpp::Swap<16, big_endian>::writeval(
+ pov,this->thumb16_special(i));
Same here.
+ if (enable_be8) {
+ elfcpp::Swap<16, false>::writeval(pov, hi);
+ elfcpp::Swap<16, false>::writeval(pov + 2, lo);
+ }
+ else {
+ elfcpp::Swap<16, big_endian>::writeval(pov, hi);
+ elfcpp::Swap<16, big_endian>::writeval(pov + 2, lo);
+ }
}
break;
case Insn_template::ARM_TYPE:
+ if (enable_be8)
+ elfcpp::Swap<32, false>::writeval(pov, insns[i].data());
+ else
+ elfcpp::Swap<32, big_endian>::writeval(pov, insns[i].data());
+ break;
And here.
I think this comment from Stub::do_fixed_endian_write() can be removed:
// FIXME: We do not handle BE8 encoding yet.
diff --git a/gold/testsuite/arm_farcall_arm_arm_be8.sh
b/gold/testsuite/arm_farcall_arm_arm_be8.sh
new file mode 100644
index 0000000..e21a16d
--- /dev/null
+++ b/gold/testsuite/arm_farcall_arm_arm_be8.sh
The new shell script files should be executable. Please make sure
they're marked that way in your git repo.
-cary
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2017-09-20 22:30 ` Cary Coutant
@ 2017-09-25 10:58 ` Umesh Kalappa
2017-10-12 9:48 ` Umesh Kalappa
0 siblings, 1 reply; 17+ messages in thread
From: Umesh Kalappa @ 2017-09-25 10:58 UTC (permalink / raw)
To: Cary Coutant
Cc: Bharathi Seshadri (bseshadr), Richard Earnshaw (lists), binutils
[-- Attachment #1: Type: text/plain, Size: 1885 bytes --]
Thank you Cary for the comments and updated the patch .
~Umesh
On Thu, Sep 21, 2017 at 4:00 AM, Cary Coutant <ccoutant@gmail.com> wrote:
>>> Arm/thumb stubs support was missed in the be8 mode with the previous
>>> patch, hence adding the same with the unit cases.
>>>
>>> No Regress on gold test-suites.
>
> + if (enable_be8)
> + elfcpp::Swap<16, false>::writeval(pov, insns[i].data() & 0xffff);
> + else
> + elfcpp::Swap<16, big_endian>::writeval(pov, insns[i].data() & 0xffff);
>
> These lines are not indented correctly.
>
> + if (enable_be8)
> + elfcpp::Swap<16, false>::writeval(
> + pov,this->thumb16_special(i));
> + else
> + elfcpp::Swap<16, big_endian>::writeval(
> + pov,this->thumb16_special(i));
>
> Same here.
>
> + if (enable_be8) {
> + elfcpp::Swap<16, false>::writeval(pov, hi);
> + elfcpp::Swap<16, false>::writeval(pov + 2, lo);
> + }
> + else {
> + elfcpp::Swap<16, big_endian>::writeval(pov, hi);
> + elfcpp::Swap<16, big_endian>::writeval(pov + 2, lo);
> + }
> }
> break;
> case Insn_template::ARM_TYPE:
> + if (enable_be8)
> + elfcpp::Swap<32, false>::writeval(pov, insns[i].data());
> + else
> + elfcpp::Swap<32, big_endian>::writeval(pov, insns[i].data());
> + break;
>
> And here.
>
> I think this comment from Stub::do_fixed_endian_write() can be removed:
>
> // FIXME: We do not handle BE8 encoding yet.
>
> diff --git a/gold/testsuite/arm_farcall_arm_arm_be8.sh
> b/gold/testsuite/arm_farcall_arm_arm_be8.sh
> new file mode 100644
> index 0000000..e21a16d
> --- /dev/null
> +++ b/gold/testsuite/arm_farcall_arm_arm_be8.sh
>
> The new shell script files should be executable. Please make sure
> they're marked that way in your git repo.
>
> -cary
[-- Attachment #2: be8_stubs_support.patch --]
[-- Type: application/octet-stream, Size: 12456 bytes --]
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 2343215..c0df05b 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-08 Umesh Kalappa <ukalappa@cisco.com>
+ * arm.cc (Stub::do_fixed_endian_write):Far call stubs
+ support for arm in the be8 mode.
+ * testsuite/Makefile.am: New test cases.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/arm_farcall_arm_arm_be8.sh: New script for arm to arm far call stubs.
+ * testsuite/arm_farcall_thumb_thumb_be8.sh: New script for thumb to thumb far call stubs.
+
2017-08-30 Alan Modra <amodra@gmail.com>
* powerpc.cc (Target_powerpc::Relocate::relocate): Nop addis on
diff --git a/gold/arm.cc b/gold/arm.cc
index f887fe5..1837f66 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -4516,30 +4516,49 @@ Stub::do_fixed_endian_write(unsigned char* view, section_size_type view_size)
{
const Stub_template* stub_template = this->stub_template();
const Insn_template* insns = stub_template->insns();
+ unsigned int enable_be8 = parameters->options().be8();
- // FIXME: We do not handle BE8 encoding yet.
unsigned char* pov = view;
for (size_t i = 0; i < stub_template->insn_count(); i++)
{
switch (insns[i].type())
{
case Insn_template::THUMB16_TYPE:
- elfcpp::Swap<16, big_endian>::writeval(pov, insns[i].data() & 0xffff);
+ if (enable_be8)
+ elfcpp::Swap<16, false>::writeval(pov, insns[i].data() & 0xffff);
+ else
+ elfcpp::Swap<16, big_endian>::writeval(pov, insns[i].data() & 0xffff);
break;
case Insn_template::THUMB16_SPECIAL_TYPE:
- elfcpp::Swap<16, big_endian>::writeval(
- pov,
- this->thumb16_special(i));
+ if (enable_be8)
+ elfcpp::Swap<16, false>::writeval(
+ pov,this->thumb16_special(i));
+ else
+ elfcpp::Swap<16, big_endian>::writeval(
+ pov,this->thumb16_special(i));
break;
case Insn_template::THUMB32_TYPE:
{
uint32_t hi = (insns[i].data() >> 16) & 0xffff;
uint32_t lo = insns[i].data() & 0xffff;
- elfcpp::Swap<16, big_endian>::writeval(pov, hi);
- elfcpp::Swap<16, big_endian>::writeval(pov + 2, lo);
+ if (enable_be8)
+ {
+ elfcpp::Swap<16, false>::writeval(pov, hi);
+ elfcpp::Swap<16, false>::writeval(pov + 2, lo);
+ }
+ else
+ {
+ elfcpp::Swap<16, big_endian>::writeval(pov, hi);
+ elfcpp::Swap<16, big_endian>::writeval(pov + 2, lo);
+ }
}
break;
case Insn_template::ARM_TYPE:
+ if (enable_be8)
+ elfcpp::Swap<32, false>::writeval(pov, insns[i].data());
+ else
+ elfcpp::Swap<32, big_endian>::writeval(pov, insns[i].data());
+ break;
case Insn_template::DATA_TYPE:
elfcpp::Swap<32, big_endian>::writeval(pov, insns[i].data());
break;
@@ -6606,7 +6625,7 @@ Arm_relobj<big_endian>::do_relocate_sections(
relinfo.layout = layout;
relinfo.object = this;
- for (unsigned int i = 1; i < shnum; ++i)
+ for (static unsigned int i = 1; i < shnum; ++i)
{
Arm_input_section<big_endian>* arm_input_section =
arm_target->find_arm_input_section(this, i);
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index b9d9c8c..6bbd6eb 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -3710,6 +3710,38 @@ arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
+#Check ARM to ARM farcall veneers in the be8 mode addressing
+
+check_SCRIPTS += arm_farcall_arm_arm_be8.sh
+check_DATA += arm_farcall_arm_arm_be8.stdout
+
+arm_farcall_arm_arm_be8.stdout: arm_farcall_arm_arm_be8
+ $(TEST_OBJDUMP) -D $< > $@
+
+arm_farcall_arm_arm_be8: arm_farcall_arm_arm_be8.o ../ld-new
+ ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -EB --be8 -o $@ $<
+
+arm_farcall_arm_arm_be8.o: arm_farcall_arm_arm.s
+ $(TEST_AS) -EB -o $@ $<
+
+MOSTLYCLEANFILES += arm_farcall_arm_arm_be8
+
+#Check THUMB to THUMB farcall veneers in the be8 mode addressing
+
+check_SCRIPTS += arm_farcall_thumb_thumb_be8.sh
+check_DATA += arm_farcall_thumb_thumb_be8.stdout
+
+arm_farcall_thumb_thumb_be8.stdout: arm_farcall_thumb_thumb_be8
+ $(TEST_OBJDUMP) -D $< > $@
+
+arm_farcall_thumb_thumb_be8: arm_farcall_thumb_thumb_be8.o ../ld-new
+ ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -EB --be8 -o $@ $<
+
+arm_farcall_thumb_thumb_be8.o: arm_farcall_thumb_thumb.s
+ $(TEST_AS) -march=armv7-m -EB -o $@ $<
+
+MOSTLYCLEANFILES += arm_farcall_thumb_thumb_be8
+
# Check Thumb to ARM farcall veneers
check_SCRIPTS += arm_farcall_thumb_arm.sh
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 8e71ba7..b8a301a 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -869,6 +869,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_thumb.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm.sh \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_arm_be8.sh \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_be8.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target1_abs.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target1_rel.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_rel.sh \
@@ -916,6 +918,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_thumb.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_thumb_5t.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb.stdout \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_arm_be8.stdout \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_be8.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_5t.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_7m.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_6m.stdout \
@@ -5297,6 +5301,10 @@ arm_farcall_thumb_thumb.sh.log: arm_farcall_thumb_thumb.sh
@p='arm_farcall_thumb_thumb.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
arm_farcall_thumb_arm.sh.log: arm_farcall_thumb_arm.sh
@p='arm_farcall_thumb_arm.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+arm_farcall_arm_arm_be8.sh.log: arm_farcall_arm_arm_be8.sh
+ @p='arm_farcall_arm_arm_be8.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+arm_farcall_thumb_thumb_be8.sh.log: arm_farcall_thumb_thumb_be8.sh
+ @p='arm_farcall_thumb_thumb_be8.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
arm_target1_abs.sh.log: arm_target1_abs.sh
@p='arm_target1_abs.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
arm_target1_rel.sh.log: arm_target1_rel.sh
@@ -7802,6 +7810,24 @@ uninstall-am:
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv7-m -o $@ $<
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_arm_arm_be8.stdout: arm_farcall_arm_arm_be8
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_arm_arm_be8: arm_farcall_arm_arm_be8.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -EB --be8 -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_arm_arm_be8.o: arm_farcall_arm_arm.s
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -EB -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_be8.stdout: arm_farcall_thumb_thumb_be8
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_be8: arm_farcall_thumb_thumb_be8.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -EB --be8 -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_be8.o: arm_farcall_thumb_thumb.s
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv7-m -EB -o $@ $<
+
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@
diff --git a/gold/testsuite/arm_farcall_arm_arm_be8.sh b/gold/testsuite/arm_farcall_arm_arm_be8.sh
new file mode 100755
index 0000000..e21a16d
--- /dev/null
+++ b/gold/testsuite/arm_farcall_arm_arm_be8.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# arm_farcall_arm_arm_be8.sh -- a test case for ARM->ARM farcall veneers
+
+# Copyright (C) 2010-2017 Free Software Foundation, Inc.
+# This file is part of gold.
+# Based on arm_farcall_arm_arm.s file.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected instruction in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual instructions below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Check for ARM->ARM default
+check arm_farcall_arm_arm_be8.stdout "1004: .* ldr pc, \[pc, #-4\] .*"
+check arm_farcall_arm_arm_be8.stdout "1008: 20100002"
+
+exit 0
diff --git a/gold/testsuite/arm_farcall_thumb_thumb_be8.sh b/gold/testsuite/arm_farcall_thumb_thumb_be8.sh
new file mode 100755
index 0000000..c772a93
--- /dev/null
+++ b/gold/testsuite/arm_farcall_thumb_thumb_be8.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# arm_farcall_thumb_thumb_be8.sh -- a test case for Thumb->Thumb farcall veneers.
+
+# Copyright (C) 2010-2017 Free Software Foundation, Inc.
+# This file is part of gold.
+# Based on arm_farcall_thumb_thumb.s file
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected instruction in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual instructions below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Thumb->Thumb
+check arm_farcall_thumb_thumb_be8.stdout "1004:\sb401"
+check arm_farcall_thumb_thumb_be8.stdout "1006:\s4802"
+check arm_farcall_thumb_thumb_be8.stdout "1008:\s4684"
+check arm_farcall_thumb_thumb_be8.stdout "100a:\sbc01"
+check arm_farcall_thumb_thumb_be8.stdout "100c:\s4760"
+check arm_farcall_thumb_thumb_be8.stdout "100e:\sbf00"
+check arm_farcall_thumb_thumb_be8.stdout "1010:\s0002"
+check arm_farcall_thumb_thumb_be8.stdout "1012:\s1510"
+
+exit 0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2017-09-25 10:58 ` Umesh Kalappa
@ 2017-10-12 9:48 ` Umesh Kalappa
2017-10-20 4:00 ` Cary Coutant
0 siblings, 1 reply; 17+ messages in thread
From: Umesh Kalappa @ 2017-10-12 9:48 UTC (permalink / raw)
To: Cary Coutant
Cc: Bharathi Seshadri (bseshadr), Richard Earnshaw (lists), binutils
Ping+
Good to commit?
~Umesh
On Mon, Sep 25, 2017 at 4:28 PM, Umesh Kalappa <umesh.kalappa0@gmail.com> wrote:
> Thank you Cary for the comments and updated the patch .
>
> ~Umesh
>
> On Thu, Sep 21, 2017 at 4:00 AM, Cary Coutant <ccoutant@gmail.com> wrote:
>>>> Arm/thumb stubs support was missed in the be8 mode with the previous
>>>> patch, hence adding the same with the unit cases.
>>>>
>>>> No Regress on gold test-suites.
>>
>> + if (enable_be8)
>> + elfcpp::Swap<16, false>::writeval(pov, insns[i].data() & 0xffff);
>> + else
>> + elfcpp::Swap<16, big_endian>::writeval(pov, insns[i].data() & 0xffff);
>>
>> These lines are not indented correctly.
>>
>> + if (enable_be8)
>> + elfcpp::Swap<16, false>::writeval(
>> + pov,this->thumb16_special(i));
>> + else
>> + elfcpp::Swap<16, big_endian>::writeval(
>> + pov,this->thumb16_special(i));
>>
>> Same here.
>>
>> + if (enable_be8) {
>> + elfcpp::Swap<16, false>::writeval(pov, hi);
>> + elfcpp::Swap<16, false>::writeval(pov + 2, lo);
>> + }
>> + else {
>> + elfcpp::Swap<16, big_endian>::writeval(pov, hi);
>> + elfcpp::Swap<16, big_endian>::writeval(pov + 2, lo);
>> + }
>> }
>> break;
>> case Insn_template::ARM_TYPE:
>> + if (enable_be8)
>> + elfcpp::Swap<32, false>::writeval(pov, insns[i].data());
>> + else
>> + elfcpp::Swap<32, big_endian>::writeval(pov, insns[i].data());
>> + break;
>>
>> And here.
>>
>> I think this comment from Stub::do_fixed_endian_write() can be removed:
>>
>> // FIXME: We do not handle BE8 encoding yet.
>>
>> diff --git a/gold/testsuite/arm_farcall_arm_arm_be8.sh
>> b/gold/testsuite/arm_farcall_arm_arm_be8.sh
>> new file mode 100644
>> index 0000000..e21a16d
>> --- /dev/null
>> +++ b/gold/testsuite/arm_farcall_arm_arm_be8.sh
>>
>> The new shell script files should be executable. Please make sure
>> they're marked that way in your git repo.
>>
>> -cary
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch][Gold] BE8 for ARM
2017-10-12 9:48 ` Umesh Kalappa
@ 2017-10-20 4:00 ` Cary Coutant
[not found] ` <CAGfacvR9Q+n3ScPBUeqyuGuoNHzLTXBDsiUJC65mvwB7VcJpNw@mail.gmail.com>
0 siblings, 1 reply; 17+ messages in thread
From: Cary Coutant @ 2017-10-20 4:00 UTC (permalink / raw)
To: Umesh Kalappa
Cc: Bharathi Seshadri (bseshadr), Richard Earnshaw (lists), binutils
+ unsigned int enable_be8 = parameters->options().be8();
Should be const bool.
case Insn_template::THUMB16_TYPE:
- elfcpp::Swap<16, big_endian>::writeval(pov, insns[i].data() & 0xffff);
+ if (enable_be8)
elfcpp::Swap<16, false>::writeval(pov, insns[i].data() & 0xffff);
+ else
+ elfcpp::Swap<16, big_endian>::writeval(pov, insns[i].data() & 0xffff);
break;
+ if (enable_be8)
+ elfcpp::Swap<16, false>::writeval(
+ pov,this->thumb16_special(i));
+ else
+ elfcpp::Swap<16, big_endian>::writeval(
+ pov,this->thumb16_special(i));
+ if (enable_be8)
+ {
+ elfcpp::Swap<16, false>::writeval(pov, hi);
+ elfcpp::Swap<16, false>::writeval(pov + 2, lo);
+ }
+ else
+ {
+ elfcpp::Swap<16, big_endian>::writeval(pov, hi);
+ elfcpp::Swap<16, big_endian>::writeval(pov + 2, lo);
+ }
+ if (enable_be8)
+ elfcpp::Swap<32, false>::writeval(pov, insns[i].data());
+ else
+ elfcpp::Swap<32, big_endian>::writeval(pov, insns[i].data());
+ break;
These are still not indented correctly. Check the tab stop settings in
your editor -- it looks like you may have your editor set to tabs
every 4 columns.
- for (unsigned int i = 1; i < shnum; ++i)
+ for (static unsigned int i = 1; i < shnum; ++i)
What are you trying to do here? I'm pretty sure you don't mean to use
a static here.
I've fixed these and applied the patch for you.
Thanks!
-cary
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2017-10-26 15:06 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07 23:25 [Patch][Gold] BE8 for ARM Bharathi Seshadri (bseshadr)
2016-08-09 9:57 ` Richard Earnshaw (lists)
2016-08-12 15:22 ` Cary Coutant
2016-08-12 15:36 ` Bharathi Seshadri (bseshadr)
2016-08-12 16:35 ` Cary Coutant
2016-08-15 18:05 ` Bharathi Seshadri (bseshadr)
2016-08-16 14:17 ` Richard Earnshaw (lists)
2016-08-23 21:52 ` Cary Coutant
2017-09-08 11:27 ` Umesh Kalappa
2016-08-09 9:25 Umesh Kalappa
2016-08-12 5:35 ` Sriraman Tallam
2017-09-13 6:25 Umesh Kalappa
2017-09-20 22:30 ` Cary Coutant
2017-09-25 10:58 ` Umesh Kalappa
2017-10-12 9:48 ` Umesh Kalappa
2017-10-20 4:00 ` Cary Coutant
[not found] ` <CAGfacvR9Q+n3ScPBUeqyuGuoNHzLTXBDsiUJC65mvwB7VcJpNw@mail.gmail.com>
2017-10-26 15:06 ` Umesh Kalappa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).