From 8cb7bc5c234eb8168068f65b8888597106fec302 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 13 Nov 2016 16:07:59 -0500 Subject: [PATCH] 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 --- 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 ce5c5ebbe4..60370bbcd2 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 56975ed976..5eaa35ad17 100644 --- a/rts/linker/PEi386.c +++ b/rts/linker/PEi386.c @@ -64,17 +64,9 @@ #include #include -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; -- GitLab