[Patch][Gold] BE8 for ARM

Cary Coutant ccoutant@gmail.com
Fri Aug 12 16:35:00 GMT 2016


> 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



More information about the Binutils mailing list