Skip to content

Commit 1acbd4d

Browse files
committedJun 28, 2019
Detect TLS support in compiler
1 parent fe0aae1 commit 1acbd4d

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed
 

‎pkg/e2fsprogs/config.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@
227227
#endif
228228
/* #undef STACK_DIRECTION */
229229
#define STDC_HEADERS 1
230-
#define TLS __thread
230+
#ifdef HAVE__THREAD_LOCAL
231+
# define TLS _Thread_local
232+
#endif
231233
#define USE_POSIX_THREADS 1
232234
/* #undef USE_POSIX_THREADS_WEAK */
233235
/* #undef USE_PTH_THREADS */

‎pkg/e2fsprogs/gen.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ cflags{
1010
}
1111

1212
build('cat', '$outdir/config.h', {
13-
'$dir/config.h',
13+
'$builddir/probe/HAVE__THREAD_LOCAL',
1414
'$builddir/probe/SIZEOF_LONG',
1515
'$builddir/probe/SIZEOF_TIME_T',
16+
'$dir/config.h',
1617
})
1718

1819
set('subst', {

‎pkg/util-linux/config.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@
200200
#define HAVE_TERM_H 1
201201
#define HAVE_TIMEGM 1
202202
#define HAVE_TIMER_CREATE 1
203-
#define HAVE_TLS 1
203+
#ifdef HAVE__THREAD_LOCAL
204+
# define HAVE_TLS 1
205+
#endif
204206
#define HAVE_TM_GMTOFF 1
205207
#define HAVE_TM_ZONE 1
206208
/* #undef HAVE_TZNAME */

‎pkg/util-linux/gen.lua

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
set('version', '2.34.0')
22
cflags{
33
'-include $dir/config.h',
4-
'-I $dir',
54
'-I $outdir',
65
'-I $srcdir/include',
76
'-I $srcdir/libuuid/src',
87
}
98

9+
build('cat', '$outdir/config.h', {
10+
'$builddir/probe/HAVE__THREAD_LOCAL',
11+
'$dir/config.h',
12+
})
13+
1014
build('sed', '$outdir/libsmartcols.h', '$srcdir/libsmartcols/src/libsmartcols.h.in', {
1115
expr='s,@LIBSMARTCOLS_VERSION@,$version,',
1216
})
@@ -21,6 +25,7 @@ build('sed', '$outdir/libfdisk.h', '$srcdir/libfdisk/src/libfdisk.h.in', {
2125

2226
pkg.hdrs = copy('$outdir/include/uuid', '$srcdir/libuuid/src', {'uuid.h'})
2327
pkg.deps = {
28+
'$outdir/config.h',
2429
'$outdir/libsmartcols.h',
2530
'$outdir/libfdisk.h',
2631
}

‎probe/HAVE__THREAD_LOCAL

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
_Thread_local int x;
2+
int main(void) {
3+
return x;
4+
}

‎probe/gen.lua

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ end
44

55
probe('HAVE_IMMINTRIN_H')
66
probe('HAVE__MM_MOVEMASK_EPI8')
7+
probe('HAVE__THREAD_LOCAL')
78

89
local function probesize(var)
910
build('probesize', '$outdir/'..var, {'$dir/'..var, '|', 'scripts/probe-size.sh'}, {var=var})

0 commit comments

Comments
 (0)
Please sign in to comment.