aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-elf/p_align-1.c
blob: 6579cd74e524a87c4905392f2069042643478fbb (plain)
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
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

#ifndef ALIGN
# define ALIGN 0x800000
#endif

int
__attribute__ ((weak))
is_aligned (void *p, int align)
{
  return (((uintptr_t) p) & (align - 1)) == 0;
}

int foo __attribute__ ((aligned (ALIGN))) = 1;

int
main (void)
{
  if (!is_aligned (&foo, ALIGN))
    abort ();
  printf ("PASS\n");
  return 0;
}