This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [PATCH 08/12] De-PLTize __stack_chk_fail internal calls within libc.so.


On 12/15/2016 06:24 PM, Nix wrote:
On 15 Dec 2016, nix@esperi.org.uk verbalised:

diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
index 36908b5..15ff56a 100644
--- a/sysdeps/generic/symbol-hacks.h
+++ b/sysdeps/generic/symbol-hacks.h
@@ -7,5 +7,7 @@ asm ("memcpy = __GI_memcpy");

 /* -fstack-protector generates calls to __stack_chk_fail, which need
    similar adjustments to avoid going through the PLT.  */
+# if defined STACK_PROTECTOR_LEVEL && STACK_PROTECTOR_LEVEL > 0
 asm ("__stack_chk_fail = __stack_chk_fail_local");
+# endif
 #endif

This causes (minor) problems on SPARC:

Extra PLT reference: libc.so: __stack_chk_fail

Whether we can disregard this, I don't know, but it does feel wrong.

Well, avoiding this is the point of __stack_chk_fail_local, isn't it? So we surely can't ignore it.

I think what is going on is that once a symbol has a hidden anywhere in a static link, all references to it are turned hidden. Previously, this hidden reference occurred in the file which *defined* __stack_chk_fail_local, but is now gone from there. (At the assembler level, the .hidden directive is markedly different from the GCC visibility attribute.)

Could you try this?

# if defined STACK_PROTECTOR_LEVEL && STACK_PROTECTOR_LEVEL > 0
asm (".hidden __stack_chk_fail_local");
asm ("__stack_chk_fail = __stack_chk_fail_local");
# endif

Thanks,
Florian


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