+ // Stubs are added at the end of "owner_".
+ // The current section can always be the stub owner, except when
+ // whole_sec is true and the current section isn't the last of
+ // the pasted sections. (This restriction for the whole_sec
+ // case is just to simplify the corner case mentioned in
+ // group_sections.)
+ // Note that "owner_" itself is not necessarily part of the
+ // group of sections served by these stubs!
+ if (!whole_sec || this->output_section_ != o)
+ {
+ this->owner_ = i;
+ this->output_section_ = o;
+ }
+
+ if (this->state_ == FINDING_STUB_SECTION)
+ {
+ if (this->group_end_addr_ - start_addr <= group_size)
+ return true;
+ // The group after the stubs has reached maximum size.
+ // Now see about adding sections before the stubs to the
+ // group. If the current section has a 14-bit branch and
+ // the group after the stubs exceeds stub14_group_size_
+ // (because they didn't have 14-bit branches), don't add
+ // sections before the stubs: The size of stubs for such a
+ // large group may exceed the reach of a 14-bit branch.
+ if (!this->stubs_always_before_branch_
+ && this_size <= group_size
+ && this->group_end_addr_ - end_addr <= group_size)
+ {
+ this->state_ = HAS_STUB_SECTION;
+ this->group_end_addr_ = end_addr;
+ return true;
+ }
+ }
+ else if (this->state_ == NO_GROUP)
+ {
+ // Only here on very first use of Stub_control
+ this->state_ = FINDING_STUB_SECTION;
+ this->group_end_addr_ = end_addr;
+ return true;
+ }
+ else
+ gold_unreachable();