[commit: ghc] master: rts: Fix references to UChar (8cb7bc5)

git at git.haskell.org git at git.haskell.org
Sun Nov 13 21:08:21 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8cb7bc5c234eb8168068f65b8888597106fec302/ghc

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

commit 8cb7bc5c234eb8168068f65b8888597106fec302
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Sun Nov 13 16:07:59 2016 -0500

    rts: Fix references to UChar
    
    Test Plan: Validate on Windows.
    
    Reviewers: erikd, austin, simonmar
    
    Reviewed By: erikd
    
    Subscribers: Phyx, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2700


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

8cb7bc5c234eb8168068f65b8888597106fec302
 rts/LinkerInternals.h |  9 +++++----
 rts/linker/PEi386.c   | 27 ++-------------------------
 2 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
index ce5c5eb..60370bb 100644
--- a/rts/LinkerInternals.h
+++ b/rts/LinkerInternals.h
@@ -281,16 +281,17 @@ int machoGetMisalignment( FILE * f );
    arising from using normal C indexing or pointer arithmetic
    are just plain wrong.  Sigh.
 */
-STATIC_INLINE UChar *
+STATIC_INLINE unsigned char *
 myindex ( int scale, void* base, int index )
 {
     return
-        ((UChar*)base) + scale * index;
+        ((unsigned char*)base) + scale * index;
 }
 
+// Defined in linker/PEi386.c
 char *cstring_from_section_name(
-    UChar* name,
-    UChar* strtab);
+    unsigned char* name,
+    unsigned char* strtab);
 #endif /* mingw32_HOST_OS */
 
 /* Which object file format are we targetting? */
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index 56975ed..5eaa35a 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -64,17 +64,9 @@
 #include <math.h>
 #include <wchar.h>
 
-static UChar *myindex(
-    int scale,
-    void* base,
-    int index);
-
 static UChar *cstring_from_COFF_symbol_name(
     UChar* name,
     UChar* strtab);
-static char *cstring_from_section_name(
-    UChar* name,
-    UChar* strtab);
 
 static size_t makeSymbolExtra_PEi386(
     ObjectCode* oc,
@@ -84,6 +76,7 @@ static size_t makeSymbolExtra_PEi386(
 static void addDLLHandle(
     pathchar* dll_name,
     HINSTANCE instance);
+
 static int verifyCOFFHeader(
     COFF_header *hdr,
     pathchar *filename);
@@ -553,22 +546,6 @@ int checkAndLoadImportLibrary( pathchar* arch_name, char* member_name, FILE* f)
     return 1;
 }
 
-/* We use myindex to calculate array addresses, rather than
-   simply doing the normal subscript thing.  That's because
-   some of the above structs have sizes which are not
-   a whole number of words.  GCC rounds their sizes up to a
-   whole number of words, which means that the address calcs
-   arising from using normal C indexing or pointer arithmetic
-   are just plain wrong.  Sigh.
-*/
-static UChar *
-myindex ( int scale, void* base, int index )
-{
-   return
-      ((UChar*)base) + scale * index;
-}
-
-
 static void
 printName ( UChar* name, UChar* strtab )
 {
@@ -635,7 +612,7 @@ cstring_from_COFF_symbol_name ( UChar* name, UChar* strtab )
    (when it is exactly 8 bytes long there's no trailing '\0'), so for
    consistency we *always* copy the string; the caller must free it
 */
-static char *
+char *
 cstring_from_section_name (UChar* name, UChar* strtab)
 {
     char *newstr;



More information about the ghc-commits mailing list