Use __asm__ rather than asm in ld testsuite
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / pr23428.c
1 /* Ensure we get syscall declared. */
2 #define _DEFAULT_SOURCE
3
4 #include <unistd.h>
5 #include <link.h>
6 #include <syscall.h>
7
8 #define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1)
9
10 int
11 main (int argc, char **argv)
12 {
13 char **ev = &argv[argc + 1];
14 char **evp = ev;
15 ElfW(auxv_t) *av;
16 const ElfW(Phdr) *phdr = NULL;
17 size_t phnum = 0;
18 size_t loadnum = 0;
19 int fd = STDOUT_FILENO;
20 size_t i;
21
22 while (*evp++ != NULL)
23 ;
24
25 av = (ElfW(auxv_t) *) evp;
26
27 for (; av->a_type != AT_NULL; ++av)
28 switch (av->a_type)
29 {
30 case AT_PHDR:
31 phdr = (const void *) av->a_un.a_val;
32 break;
33 case AT_PHNUM:
34 phnum = av->a_un.a_val;
35 break;
36 }
37
38 for (i = 0; i < phnum; i++, phdr++)
39 if (phdr->p_type == PT_LOAD)
40 loadnum++;
41
42 syscall (SYS_write, fd, STRING_COMMA_LEN ("PASS\n"));
43
44 syscall (SYS_exit, !loadnum);
45 return 0;
46 }
This page took 0.037121 seconds and 4 git commands to generate.