#include <stdio.h> // fprintf(), NULL
#include <stdlib.h> // exit(), EXIT_SUCCESS
#include "test.h" // PASS(), FAIL(), XPASS(), XFAIL()
int foo[] = { 5, 6, 7, 8 };
extern int* pfoo;
extern int bar[];
int* pbar = &bar[1];
int __attribute__((weak)) stuff[] = { 1, 2, 3, 4, 5 };
int* pstuff = &stuff[3];
void realmain()
{
if ( *pfoo != 7 )
FAIL("weak-external-reloc, pfoo=%d", *pfoo);
else if ( *pbar != 21 )
FAIL("weak-external-reloc, pbar=%d", *pbar);
else if ( *pstuff != 4 )
FAIL("weak-external-reloc, pstuffr=%d", *pstuff);
else
PASS("weak-external-reloc");
}