diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2013-04-23 09:44:36 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2013-04-23 09:44:36 +0000 |
commit | 61522196c71593da09572fce9af9e0d7dad61bc3 (patch) | |
tree | 9bf74facd67974fa2f780d6ce68b14eb7a94e371 /winsup/cygwin/pseudo-reloc.cc | |
parent | 1875ee55d31d3673059373c8f9837bf98f93c713 (diff) | |
download | newlib-61522196c71593da09572fce9af9e0d7dad61bc3.zip newlib-61522196c71593da09572fce9af9e0d7dad61bc3.tar.gz newlib-61522196c71593da09572fce9af9e0d7dad61bc3.tar.bz2 |
* Merge in cygwin-64bit-branch.
Diffstat (limited to 'winsup/cygwin/pseudo-reloc.cc')
-rw-r--r-- | winsup/cygwin/pseudo-reloc.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/winsup/cygwin/pseudo-reloc.cc b/winsup/cygwin/pseudo-reloc.cc index df91e58..00c58d7 100644 --- a/winsup/cygwin/pseudo-reloc.cc +++ b/winsup/cygwin/pseudo-reloc.cc @@ -313,12 +313,12 @@ do_pseudo_reloc (void * start, void * end, void * base) break; case 32: reldata = (ptrdiff_t) (*((unsigned int *)reloc_target)); -#ifdef _WIN64 +#if defined (__x86_64__) || defined (_WIN64) if ((reldata & 0x80000000) != 0) reldata |= ~((ptrdiff_t) 0xffffffff); #endif break; -#ifdef _WIN64 +#if defined (__x86_64__) || defined (_WIN64) case 64: reldata = (ptrdiff_t) (*((unsigned long long *)reloc_target)); break; @@ -344,9 +344,15 @@ do_pseudo_reloc (void * start, void * end, void * base) __write_memory ((void *) reloc_target, &reldata, 2); break; case 32: +#if defined (__CYGWIN__) && defined (__x86_64__) && !defined (__OPTIMIZE__) + if (reldata > (ptrdiff_t) __INT32_MAX__ + || reldata < -((ptrdiff_t) __INT32_MAX__) - 1) + __report_error ("Invalid relocation. Offset %p at address %p " + "doesn't fit into 32 bits", reldata, reloc_target); +#endif __write_memory ((void *) reloc_target, &reldata, 4); break; -#ifdef _WIN64 +#if defined (__x86_64__) || defined (_WIN64) case 64: __write_memory ((void *) reloc_target, &reldata, 8); break; |