This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [Patch][Gold] BE8 for ARM


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: be8_patch.txt
Description: be8_patch.txt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]