[commit: ghc] master: linker: Move ARM interworking note to SymbolExtras.c (6fecb7e)

git at git.haskell.org git at git.haskell.org
Wed Nov 2 20:15:31 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6fecb7e784daabe3f62ef8090e7019d7ad384080/ghc

>---------------------------------------------------------------

commit 6fecb7e784daabe3f62ef8090e7019d7ad384080
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Fri Oct 28 09:26:08 2016 -0400

    linker: Move ARM interworking note to SymbolExtras.c


>---------------------------------------------------------------

6fecb7e784daabe3f62ef8090e7019d7ad384080
 rts/Linker.c              | 24 ------------------------
 rts/linker/SymbolExtras.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/rts/Linker.c b/rts/Linker.c
index 27a8ffc..e46fc05 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -202,30 +202,6 @@ int ocTryLoad( ObjectCode* oc );
 #endif
 
 /*
-  Note [The ARM/Thumb Story]
-  ~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-  Support for the ARM architecture is complicated by the fact that ARM has not
-  one but several instruction encodings. The two relevant ones here are the original
-  ARM encoding and Thumb, a more dense variant of ARM supporting only a subset
-  of the instruction set.
-
-  How the CPU decodes a particular instruction is determined by a mode bit. This
-  mode bit is set on jump instructions, the value being determined by the low
-  bit of the target address: An odd address means the target is a procedure
-  encoded in the Thumb encoding whereas an even address means it's a traditional
-  ARM procedure (the actual address jumped to is even regardless of the encoding bit).
-
-  Interoperation between Thumb- and ARM-encoded object code (known as "interworking")
-  is tricky. If the linker needs to link a call by an ARM object into Thumb code
-  (or vice-versa) it will produce a jump island. This, however, is incompatible with
-  GHC's tables-next-to-code. For this reason, it is critical that GHC emit
-  exclusively ARM or Thumb objects for all Haskell code.
-
-  We still do, however, need to worry about foreign code.
-*/
-
-/*
  * Due to the small memory model (see above), on x86_64 we have to map
  * all our non-PIC object files into the low 2Gb of the address space
  * (why 2Gb and not 4Gb?  Because all addresses must be reachable
diff --git a/rts/linker/SymbolExtras.c b/rts/linker/SymbolExtras.c
index c985104..1973f7b 100644
--- a/rts/linker/SymbolExtras.c
+++ b/rts/linker/SymbolExtras.c
@@ -141,6 +141,34 @@ SymbolExtra* makeSymbolExtra( ObjectCode* oc,
 #endif
 
 #ifdef arm_HOST_ARCH
+/*
+  Note [The ARM/Thumb Story]
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+  Support for the ARM architecture is complicated by the fact that ARM has not
+  one but several instruction encodings. The two relevant ones here are the original
+  ARM encoding and Thumb, a more dense variant of ARM supporting only a subset
+  of the instruction set.
+
+  How the CPU decodes a particular instruction is determined by a mode bit. This
+  mode bit is set on jump instructions, the value being determined by the low
+  bit of the target address: An odd address means the target is a procedure
+  encoded in the Thumb encoding whereas an even address means it's a traditional
+  ARM procedure (the actual address jumped to is even regardless of the encoding bit).
+
+  Interoperation between Thumb- and ARM-encoded object code (known as "interworking")
+  is tricky. If the linker needs to link a call by an ARM object into Thumb code
+  (or vice-versa) it will produce a jump island using makeArmSymbolExtra. This,
+  however, is incompatible with GHC's tables-next-to-code since pointers
+  fixed-up in this way will point to a bit of generated code, not a info
+  table/Haskell closure like TNTC expects. For this reason, it is critical that
+  GHC emit exclusively ARM or Thumb objects for all Haskell code.
+
+  We still do, however, need to worry about calls to foreign code, hence the
+  need for makeArmSymbolExtra.
+*/
+
+/* Produce a jump island for ARM/Thumb interworking */
 SymbolExtra* makeArmSymbolExtra( ObjectCode* oc,
                                  unsigned long symbolNumber,
                                  unsigned long target,



More information about the ghc-commits mailing list