Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jhheider committed Sep 29, 2023
1 parent 98962f1 commit 7976e91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
8 changes: 2 additions & 6 deletions projects/gnu.org/glibc/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ test:
# Putting ourselves in the LD_LIBRARY_PATH breaks literally everything else...
- export LD_LIBRARY_PATH="$(echo LD_LIBRARY_PATH | tr ':' '\n' | grep -v {{prefix}} | tr '\n' ':')"

- gcc -o test1 test.c -pthread -fPIC -pie
- gcc -o test1 test.c -fPIC -pie
- ./test1

- find {{deps.gnu.org/gcc.prefix}} -name stdatomic.h

- |
gcc \
-nostdinc \
Expand All @@ -97,11 +95,9 @@ test:
{{prefix}}/lib/crt1.o \
{{prefix}}/lib/crtn.o \
test.c \
-pthread \
-fPIC \
-pie
- objdump -p test2
- ./test2
- test "$(./test2)" = "gnu_get_libc_version() = {{version.marketing}}"

provides:
- bin/catchsegv
Expand Down
22 changes: 0 additions & 22 deletions projects/gnu.org/glibc/test.c
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
#define _GNU_SOURCE
#include <assert.h>
#include <gnu/libc-version.h>
#include <stdatomic.h>
#include <stdio.h>
#include <threads.h>

atomic_int acnt;
int cnt;

int f(void* thr_data) {
for(int n = 0; n < 1000; ++n) {
++cnt;
++acnt;
}
return 0;
}

int main(int argc, char **argv) {
/* Basic library version check. */
printf("gnu_get_libc_version() = %s\n", gnu_get_libc_version());

thrd_t thr[10];
for(int n = 0; n < 10; ++n)
thrd_create(&thr[n], f, NULL);
for(int n = 0; n < 10; ++n)
thrd_join(thr[n], NULL);
printf("The atomic counter is %u\n", acnt);
printf("The non-atomic counter is %u\n", cnt);
}

0 comments on commit 7976e91

Please sign in to comment.