This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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: [RFC] Avoiding _divsi3 call during ld.so bootstrap


John Reiser wrote:
Implement a subroutine _divsi3 which checks the divisor for being 12
(which is sizeof(RELA)), then takes advantage of 1/12 = 0.010101... in binary
to perform the division by 12 using the strategy of umulsi3_highpart
(multiply by a binary fraction, take the high part) as Richard suggests.

Ah but you missed the point -- the existing _divsi3 function works just fine. The problem is that function calls don't work until ld.so is relocated. Whatever code GCC generates for this division would have to be done entirely in-line. Obviously that's not desirable for general-purpose code, so it would mean adding a special option to GCC that would only be used in this one place. Yuck.


An alternative is yet another special GCC option to generate a PC-relative call that does not require any relocation (assuming we can arrange for the _divsi3 routine to be located within the limited range of Xtensa's PC-relative call instruction). That seems somewhat better, but it would still be a special-purpose option with no other intended use (at least for now).

Thanks for your suggestion, though. I'm not going to decide on any course of action right now.

--Bob


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