[MIPS] fix CRT_CALL_STATIC_FUNCTION macro

Petar Jovanovic petar.jovanovic@rt-rk.com
Thu Jan 22 15:45:00 GMT 2015


This is a case when _init () function has to jump to __do_global_ctors_aux,
but __do_global_ctors_aux is too far away, so the target address is
shortened to fit in jal, and __do_global_ctors_aux is not reached.

Regards,
Petar

-----Original Message-----
From: Matthew Fortune [mailto:Matthew.Fortune@imgtec.com] 
Sent: Thursday, January 22, 2015 9:36 AM
To: Petar Jovanovic; gcc-patches@gcc.gnu.org
Cc: Petar Jovanovic
Subject: RE: [MIPS] fix CRT_CALL_STATIC_FUNCTION macro

> This is a follow-up to a change [1] in glibc. It fixes the issue [2] 
> when jal can not reach a target in different region.
> 
> It has been tested with DejaGnu for mips32/o32, mips64/n32 and 
> mips64/n64.
> 
> Let me know what you think.

So to confirm, the issue is non-pic crt calling an init routine beyond the
current 256 MB region?

Otherwise for PIC the issue is dealt with by the assembler with the JAL
<sym> being expanded to a load from the got and indirect call through t9.
Previously t9 would not have been set up for the callee if the code was
built non-pic (as it would just use a JAL). That would have made the setup
of gp somewhat pointless in the CRT_CALL_STATIC_FUNCTION code. I am
therefore a little confused by the existing code that sets up GP but then it
seemingly is not used unless built for PIC.

I need a little time to consider this further. Catherine may comment in the
meantime.

Thanks,
Matthew



More information about the Gcc-patches mailing list