diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2017-03-29 17:30:50 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-03-29 18:06:21 -0400 |
commit | 01b062ec3fa138b92124ce7ca4deca0ddcb474ea (patch) | |
tree | b37ab33bf148c86aa3d7aa94f450d4ef8a248e89 /compiler/Unique.h | |
parent | 26c95f46e679fb73e1ec2bec2be0801c72fd1449 (diff) | |
download | haskell-01b062ec3fa138b92124ce7ca4deca0ddcb474ea.tar.gz |
unique: fix UNIQUE_BITS crosscompilation (Trac #13491)
The #13491 manifests best when we try to crosscompile
from 32-bit (i386-linux) to 64-bit (powerpc64-linux)
system:
./configure --target=powerpc64-unknown-linux-gnu
The build fails at assembly time:
"inplace/bin/ghc-stage1" ... -c rts/StgStartup.cmm
/tmp/ghc19687_0/ghc_4.s: Assembler messages:
/tmp/ghc19687_0/ghc_4.s:11:0: error:
Error: unknown pseudo-op: `.l'
|
11 | .L<\x00>4:
| ^
That happens because UNIQUE_BITS is defined in terms
of WORD_SIZE_IN_BITS macro:
#define UNIQUE_BITS (WORD_SIZE_IN_BITS - 8)
WORD_SIZE_IN_BITS is 64 bits (equals to target value)
while ghc-stage1 is still running on i386-linux
The fix is to stop relying on target macros and use
host's 'sizeof (HsInt)' and 'finiteBitSize' way to
determine unique layout.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: build i386-to-powerpc64 crosscompiler
Reviewers: rwbarton, austin, bgamari
Reviewed By: bgamari
Subscribers: RyanGlScott, thomie
Differential Revision: https://phabricator.haskell.org/D3397
Diffstat (limited to 'compiler/Unique.h')
-rw-r--r-- | compiler/Unique.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/Unique.h b/compiler/Unique.h index a786d8ff3e..e4cd2671a1 100644 --- a/compiler/Unique.h +++ b/compiler/Unique.h @@ -1,3 +1,5 @@ -#include "../includes/MachDeps.h" - -#define UNIQUE_BITS (WORD_SIZE_IN_BITS - 8) +/* unique has the following structure: + * HsInt unique = + * (unique_tag << (sizeof (HsInt) - UNIQUE_TAG_BITS)) | unique_number + */ +#define UNIQUE_TAG_BITS 8 |