Message ID | 20180512133145.GA30506@gmail.com |
---|---|
State | New |
Headers | show |
Series | i386: Replace PREINIT_FUNCTION@PLT with *%eax in call | expand |
On Sat, May 12, 2018 at 06:31:45AM -0700, H.J. Lu wrote: > Since we have loaded address of PREINIT_FUNCTION into %eax, we can > avoid extra branch to PLT slot. > > Any comments? > > H.J. > --- > * sysdeps/i386/crti.S (_init): Replace PREINIT_FUNCTION@PLT > with *%eax in call. > --- > sysdeps/i386/crti.S | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sysdeps/i386/crti.S b/sysdeps/i386/crti.S > index c0422f9ce3..065460b813 100644 > --- a/sysdeps/i386/crti.S > +++ b/sysdeps/i386/crti.S > @@ -68,7 +68,7 @@ _init: > movl PREINIT_FUNCTION@GOT(%ebx), %eax > testl %eax, %eax > je .Lno_weak_fn > - call PREINIT_FUNCTION@PLT The PREINIT_FUNCTION macro is essentially just __gmon_start__, right? So unless this was somehow introduced specifically for profiling purposes this seems legit. Acked-by: Christian Brauner (Ubuntu) <christian@brauner.io> > + call *%eax > .Lno_weak_fn: > #else > call PREINIT_FUNCTION > -- > 2.17.0 >
On Mon, May 14, 2018 at 8:46 AM, Christian Brauner <christian@brauner.io> wrote: > On Sat, May 12, 2018 at 06:31:45AM -0700, H.J. Lu wrote: >> Since we have loaded address of PREINIT_FUNCTION into %eax, we can >> avoid extra branch to PLT slot. >> >> Any comments? >> >> H.J. >> --- >> * sysdeps/i386/crti.S (_init): Replace PREINIT_FUNCTION@PLT >> with *%eax in call. >> --- >> sysdeps/i386/crti.S | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/sysdeps/i386/crti.S b/sysdeps/i386/crti.S >> index c0422f9ce3..065460b813 100644 >> --- a/sysdeps/i386/crti.S >> +++ b/sysdeps/i386/crti.S >> @@ -68,7 +68,7 @@ _init: >> movl PREINIT_FUNCTION@GOT(%ebx), %eax >> testl %eax, %eax >> je .Lno_weak_fn >> - call PREINIT_FUNCTION@PLT > > The PREINIT_FUNCTION macro is essentially just __gmon_start__, right? So That is correct. > unless this was somehow introduced specifically for profiling purposes > this seems legit. x86-64 already has some similar: movq PREINIT_FUNCTION@GOTPCREL(%rip), %rax testq %rax, %rax je .Lno_weak_fn call *%rax .Lno_weak_fn: > Acked-by: Christian Brauner (Ubuntu) <christian@brauner.io> I am going to check it in.
diff --git a/sysdeps/i386/crti.S b/sysdeps/i386/crti.S index c0422f9ce3..065460b813 100644 --- a/sysdeps/i386/crti.S +++ b/sysdeps/i386/crti.S @@ -68,7 +68,7 @@ _init: movl PREINIT_FUNCTION@GOT(%ebx), %eax testl %eax, %eax je .Lno_weak_fn - call PREINIT_FUNCTION@PLT + call *%eax .Lno_weak_fn: #else call PREINIT_FUNCTION