Hi,
On Wed, 17 Aug 2011, Jed Davis wrote:
> One thing I'm not so sure about is accepting any SYMBOLIC_CONST as a
> legitimate address. That allows, for example, a symbol address cast
> to uintptr_t and added to (6ULL << 32), which will never fit. On the
> other hand, -fPIC allows offsets of up to +/- 16Mib for some unexplained
> reason,
The x86-64 ABI specifies this. All symbols have to be located between 0x0
and 2^31-2^24-1, and that is so that everything in memory objects of
length less than 2^24 can be addressed directly. Otherwise only the base
address of symbols would be addressable directly and any offsetted variant
would have to be calculated explicitely. If it weren't for this
provision, given this code:
global char arr[4096];
char f () { return arr[2]; }
the load couldn't use arr+2 directly as that possibly might not fit into
32 bit anymore. Similar things are true for the small PIC models
including your new one. That is, as long as symbols are always at most
2^31-2^24-1 away from all ends of referring instructions you can happily
accept offsets between +-2^24.
Ciao,
Michael.