pointer to variable in different address space

I am assuming address space 1 for variables in ROM. Now if I want a pointer to contain the address the this variable then how do I declare it? In other words I want to declare rom int *ptr.



Something like this works for me:

#define rom attribute((address_space(1)))
rom int *ptr;

$ clang rom.c -emit-llvm -o -
; ModuleID = ‘rom.c’
target datalayout = “e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128”
target triple = “i386-apple-darwin9”
@ptr = common global i32 addrspace(1)* null, align 4