File: tg-gscope.diff

package info (click to toggle)
glibc 2.24-11%2Bdeb9u3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 225,316 kB
  • sloc: ansic: 996,116; asm: 261,826; sh: 10,483; makefile: 9,849; cpp: 4,169; python: 3,971; perl: 2,254; awk: 1,753; pascal: 1,521; yacc: 291; sed: 80
file content (88 lines) | stat: -rw-r--r-- 3,757 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
From: Thomas Schwinge <thomas@schwinge.name>
Subject: [PATCH] gscope

Minimal gscope stuff.

glibc-2.8/debian/patches/hurd-i386/local-gscope.diff 3085

Probably written by Samuel Thibault.

---

I think that's the corresponding error message:

    /media/Stalin/tmp/glibc.hurd.gnu-2/elf/librtld.os: In function `add_dependency':
    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:106: undefined reference to `atomic_forced_read'
    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:109: undefined reference to `atomic_read_barrier'
    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:113: undefined reference to `atomic_forced_read'
    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:141: undefined reference to `THREAD_GSCOPE_RESET_FLAG'
    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:147: undefined reference to `atomic_forced_read'
    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:284: undefined reference to `THREAD_GSCOPE_SET_FLAG'
    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:261: undefined reference to `atomic_write_barrier'
    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:250: undefined reference to `atomic_write_barrier'
    /media/Stalin/tmp/glibc.hurd.gnu-2/elf/librtld.os: In function `add_to_global':
    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-open.c:162: undefined reference to `atomic_write_barrier'
    /media/Stalin/tmp/glibc.hurd.gnu-2/elf/librtld.os: In function `dl_open_worker':
    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-open.c:478: undefined reference to `atomic_write_barrier'
    collect2: ld returned 1 exit status
    make[2]: *** [/media/Stalin/tmp/glibc.hurd.gnu-2/elf/ld.so] Error 1

 elf/dl-support.c                  |    1 +
 sysdeps/generic/ldsodefs.h        |    1 +
 sysdeps/mach/hurd/sysdep-cancel.h |    9 +++++++++
 sysdeps/mach/hurd/tls.h           |   13 +++++++++++++
 4 files changed, 24 insertions(+)

--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -196,6 +196,7 @@ int (*_dl_make_stack_executable_hook) (v
 /* Function in libpthread to wait for termination of lookups.  */
 void (*_dl_wait_lookup_done) (void);
 
+int volatile _dl_thread_gscope_count;
 struct dl_scope_free_list *_dl_scope_free_list;
 
 #ifdef NEED_DL_SYSINFO
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -409,6 +409,7 @@ struct rtld_global
     size_t count;
     void *list[50];
   } *_dl_scope_free_list;
+  EXTERN volatile int _dl_thread_gscope_count;
 #ifdef SHARED
 };
 # define __rtld_global_attribute__
--- /dev/null
+++ b/sysdeps/mach/hurd/sysdep-cancel.h
@@ -0,0 +1,9 @@
+#include <sysdep.h>
+
+/* Always multi-thread (since there's at least the sig handler), but no
+   handling enabled.  */
+#define SINGLE_THREAD_P (0)
+#define RTLD_SINGLE_THREAD_P (0)
+#define LIBC_CANCEL_ASYNC()	0 /* Just a dummy value.  */
+#define LIBC_CANCEL_RESET(val)	((void)(val)) /* Nothing, but evaluate it.  */
+#define LIBC_CANCEL_HANDLED()	/* Nothing.  */
--- a/sysdeps/mach/hurd/tls.h
+++ b/sysdeps/mach/hurd/tls.h
@@ -75,5 +75,18 @@ typedef struct
 
 #endif /* !ASSEMBLER */
 
+#ifndef __ASSEMBLER__
+#include <mach/mach_traps.h>
+#include <atomic.h>
+/* Temporary poor-man's global scope switch support: just busy-waits */
+#define THREAD_GSCOPE_SET_FLAG() \
+	asm volatile ("lock incl %0":"=m"(GL(dl_thread_gscope_count)))
+#define THREAD_GSCOPE_RESET_FLAG() \
+	asm volatile ("lock decl %0":"=m"(GL(dl_thread_gscope_count)))
+#define THREAD_GSCOPE_WAIT() \
+  while (GL(dl_thread_gscope_count)) { \
+    __swtch_pri (0); \
+  }
+#endif
 
 #endif /* tls.h */