File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7777 # Putting ourselves in the LD_LIBRARY_PATH breaks literally everything else...
7878 - export LD_LIBRARY_PATH="$(echo LD_LIBRARY_PATH | tr ':' '\n' | grep -v {{prefix}} | tr '\n' ':')"
7979
80- - gcc -o test1 test.c -pthread - fPIC -pie
80+ - gcc -o test1 test.c -fPIC -pie
8181 - ./test1
8282
83- - find {{deps.gnu.org/gcc.prefix}} -name stdatomic.h
84-
8583 - |
8684 gcc \
8785 -nostdinc \
9795 {{prefix}}/lib/crt1.o \
9896 {{prefix}}/lib/crtn.o \
9997 test.c \
100- -pthread \
10198 -fPIC \
10299 -pie
103- - objdump -p test2
104- - ./test2
100+ - test "$(./test2)" = "gnu_get_libc_version() = {{version.marketing}}"
105101
106102provides :
107103 - bin/catchsegv
Original file line number Diff line number Diff line change 11#define _GNU_SOURCE
2- #include <assert.h>
32#include <gnu/libc-version.h>
4- #include <stdatomic.h>
53#include <stdio.h>
6- #include <threads.h>
7-
8- atomic_int acnt ;
9- int cnt ;
10-
11- int f (void * thr_data ) {
12- for (int n = 0 ; n < 1000 ; ++ n ) {
13- ++ cnt ;
14- ++ acnt ;
15- }
16- return 0 ;
17- }
184
195int main (int argc , char * * argv ) {
206 /* Basic library version check. */
217 printf ("gnu_get_libc_version() = %s\n" , gnu_get_libc_version ());
22-
23- thrd_t thr [10 ];
24- for (int n = 0 ; n < 10 ; ++ n )
25- thrd_create (& thr [n ], f , NULL );
26- for (int n = 0 ; n < 10 ; ++ n )
27- thrd_join (thr [n ], NULL );
28- printf ("The atomic counter is %u\n" , acnt );
29- printf ("The non-atomic counter is %u\n" , cnt );
308}
You can’t perform that action at this time.
0 commit comments