Am Dienstag, 17. Februar 2015, 21:21:18 schrieb Matt Turner:
> On Mon, Feb 16, 2015 at 10:25 AM, Matt Turner <matts...@gmail.com> wrote:
> > On Mon, Feb 16, 2015 at 1:36 AM, Marc Dietrich <marvi...@gmx.de> wrote:
> >> Avoid redefined symbol errors in clang. Based on a suggestion from
> >> Rafael à vila de Espíndola <rafael.espind...@gmail.com> in
> >> http://llvm.org/bugs/show_bug.cgi?id=19778.
> >> 
> >> Signed-off-by: Marc Dietrich <marvi...@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






Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to