Commit 8cb7bc5c authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

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
parent ca1b9860
...@@ -281,16 +281,17 @@ int machoGetMisalignment( FILE * f ); ...@@ -281,16 +281,17 @@ int machoGetMisalignment( FILE * f );
arising from using normal C indexing or pointer arithmetic arising from using normal C indexing or pointer arithmetic
are just plain wrong. Sigh. are just plain wrong. Sigh.
*/ */
STATIC_INLINE UChar * STATIC_INLINE unsigned char *
myindex ( int scale, void* base, int index ) myindex ( int scale, void* base, int index )
{ {
return return
((UChar*)base) + scale * index; ((unsigned char*)base) + scale * index;
} }
// Defined in linker/PEi386.c
char *cstring_from_section_name( char *cstring_from_section_name(
UChar* name, unsigned char* name,
UChar* strtab); unsigned char* strtab);
#endif /* mingw32_HOST_OS */ #endif /* mingw32_HOST_OS */
/* Which object file format are we targetting? */ /* Which object file format are we targetting? */
......
...@@ -64,17 +64,9 @@ ...@@ -64,17 +64,9 @@
#include <math.h> #include <math.h>
#include <wchar.h> #include <wchar.h>
static UChar *myindex(
int scale,
void* base,
int index);
static UChar *cstring_from_COFF_symbol_name( static UChar *cstring_from_COFF_symbol_name(
UChar* name, UChar* name,
UChar* strtab); UChar* strtab);
static char *cstring_from_section_name(
UChar* name,
UChar* strtab);
static size_t makeSymbolExtra_PEi386( static size_t makeSymbolExtra_PEi386(
ObjectCode* oc, ObjectCode* oc,
...@@ -84,6 +76,7 @@ static size_t makeSymbolExtra_PEi386( ...@@ -84,6 +76,7 @@ static size_t makeSymbolExtra_PEi386(
static void addDLLHandle( static void addDLLHandle(
pathchar* dll_name, pathchar* dll_name,
HINSTANCE instance); HINSTANCE instance);
static int verifyCOFFHeader( static int verifyCOFFHeader(
COFF_header *hdr, COFF_header *hdr,
pathchar *filename); pathchar *filename);
...@@ -553,22 +546,6 @@ int checkAndLoadImportLibrary( pathchar* arch_name, char* member_name, FILE* f) ...@@ -553,22 +546,6 @@ int checkAndLoadImportLibrary( pathchar* arch_name, char* member_name, FILE* f)
return 1; 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 static void
printName ( UChar* name, UChar* strtab ) printName ( UChar* name, UChar* strtab )
{ {
...@@ -635,7 +612,7 @@ cstring_from_COFF_symbol_name ( 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 (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 consistency we *always* copy the string; the caller must free it
*/ */
static char * char *
cstring_from_section_name (UChar* name, UChar* strtab) cstring_from_section_name (UChar* name, UChar* strtab)
{ {
char *newstr; char *newstr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment