[Mesa-dev] [PATCH 2/4] add visibility hidden to tls entry points
Marc Dietrich
marvin24 at gmx.de
Wed Feb 18 01:56:14 PST 2015
Am Dienstag, 17. Februar 2015, 21:21:18 schrieb Matt Turner:
> On Mon, Feb 16, 2015 at 10:25 AM, Matt Turner <mattst88 at gmail.com> wrote:
> > On Mon, Feb 16, 2015 at 1:36 AM, Marc Dietrich <marvin24 at gmx.de> wrote:
> >> Avoid redefined symbol errors in clang. Based on a suggestion from
> >> Rafael à vila de EspÃndola <rafael.espindola at gmail.com> in
> >> http://llvm.org/bugs/show_bug.cgi?id=19778.
> >>
> >> Signed-off-by: Marc Dietrich <marvin24 at gmx.de>
> >> ---
> >>
> >> src/mapi/entry_x86-64_tls.h | 3 ++-
> >> src/mapi/entry_x86_tls.h | 5 +++--
> >> src/mapi/entry_x86_tsd.h | 5 +++--
> >> 3 files changed, 8 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/src/mapi/entry_x86-64_tls.h b/src/mapi/entry_x86-64_tls.h
> >> index 71e9d60..d36556c 100644
> >> --- a/src/mapi/entry_x86-64_tls.h
> >> +++ b/src/mapi/entry_x86-64_tls.h
> >> @@ -26,6 +26,7 @@
> >>
> >> */
> >>
> >> #include "u_macros.h"
> >>
> >> +#include "../util/macros.h"
> >
> > Let's add -I$(top_srcdir)src/util to src/mapi/Makefile.am's
> > AM_CPPFLAGS and include "util/macros.h". Occurs again in this patch.
> >
> >> __asm__(".text\n"
> >>
> >> ".balign 32\n"
> >>
> >> @@ -62,7 +63,7 @@ entry_patch_public(void)
> >>
> >> {
> >> }
> >>
> >> -static char
> >> +extern char HIDDEN
> >
> > So, reading the bug report... adding extern HIDDEN is kind of a hack.
> >
> > I have some patches in a wip branch that attempt to make LTO work, and
> > one of them replaces the __asm__ seen at the end of the previous hunk
> > with
> >
> > static void
> > __attribute__((__used__))
> > x86_64_entry_start()
> > {
> > }
> >
> > and just removes this char[] declaration. It /seems/ to work. I
> > suspect we'd also want to use aligned function attribute (and use
> > macros for the attributes).
> >
> > Interested in giving that a try?
>
> I see that you've resent these patches, but I don't see that you've
> seen this comment?
right, I somehow missed it. Good part is that I tried your suggestion, but it
doesn't work becuase gcc will create an empty function x86_64_entry_start()
which will alter the start of the dispatch table.
so I tried something like this:
--- a/src/mapi/entry_x86-64_tls.h
+++ b/src/mapi/entry_x86-64_tls.h
@@ -28,9 +28,7 @@
#include "macros.h"
#include "u_macros.h"
-__asm__(".text\n"
- ".balign 32\n"
- "x86_64_entry_start:");
+extern void shared_dispatch_stub_0();
#define STUB_ASM_ENTRY(func) \
".globl " func "\n" \
@@ -63,12 +61,10 @@ entry_patch_public(void)
{
}
-extern const char HIDDEN x86_64_entry_start[];
-
mapi_func
entry_get_public(int slot)
{
- return (mapi_func) (x86_64_entry_start + slot * 32);
+ return (mapi_func) (shared_dispatch_stub_0 + slot * 32);
}
void
which oddly seems to work, but is similar hackish, especially because the
table should be wrong for ES1 and ES2 dispatcher (but somehow it still works).
I'm not skilled enough to understand all this dispatching stuff, so either we
could use the original patch (using HIDDEN) or do something else, e.g. find a
way to create an empty label.
Marc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150218/21f7a8da/attachment.sig>
More information about the mesa-dev
mailing list