summaryrefslogtreecommitdiff
path: root/rts/LinkerInternals.h
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2017-05-03 11:07:10 +0200
committerGabor Greif <ggreif@gmail.com>2017-05-04 15:38:26 +0200
commit81af480a0fd3b37fff17245c1468638597261bcb (patch)
tree5493a9adcb9857c062f0664700aaeafe12c37bec /rts/LinkerInternals.h
parent783dfa744b14e682951a8358e51356a2dedda325 (diff)
downloadhaskell-81af480a0fd3b37fff17245c1468638597261bcb.tar.gz
Abandon typedefing the {Section,ObjectCode}FormatInfo structs
Summary: This is a follow-up to @angerman 's refactoring for ELF that happened with e5e8646d3c6af82549b55fbee6764b087144a7ec My previous commit a6675a93efe7cae2f206508047a39e73ce4e92a5 corrected a typedef redefinition issue with GCC v4.4 (which is pervasive with RHEL 6). Now the problem has resurfaced. Instead of dancing after the different compiler's pipe, I decided to eliminate the typedefs altogether and refer to the struct namespace explicitly. Added a note to describe why typedefs are not applied on customisable structs. Reviewers: austin, bgamari, erikd, simonmar Subscribers: rwbarton, thomie, angerman Differential Revision: https://phabricator.haskell.org/D3527
Diffstat (limited to 'rts/LinkerInternals.h')
-rw-r--r--rts/LinkerInternals.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
index 4574f39e82..a884561138 100644
--- a/rts/LinkerInternals.h
+++ b/rts/LinkerInternals.h
@@ -20,9 +20,6 @@
typedef void SymbolAddr;
typedef char SymbolName;
-typedef struct _SectionFormatInfo SectionFormatInfo;
-typedef struct _ObjectCodeFormatInfo ObjectCodeFormatInfo;
-
/* See Linker.c Note [runtime-linker-phases] */
typedef enum {
OBJECT_LOADED,
@@ -52,6 +49,18 @@ typedef
}
SectionAlloc;
+/*
+ * Note [No typedefs for customizable types]
+ * Some pointer-to-struct types are defined opaquely
+ * first, and customized later to architecture/ABI-specific
+ * instantiations. Having the usual
+ * typedef struct _Foo {...} Foo;
+ * wrappers is hard to get right with older versions of GCC,
+ * so just have a
+ * struct Foo {...};
+ * and always refer to it with the 'struct' qualifier.
+ */
+
typedef
struct _Section {
void* start; /* actual start of section in memory */
@@ -66,8 +75,10 @@ typedef
void* mapped_start; /* start of mmap() block */
StgWord mapped_size; /* size of mmap() block */
- /* A customizable type to augment the Section type. */
- SectionFormatInfo* info;
+ /* A customizable type to augment the Section type.
+ * See Note [No typedefs for customizable types]
+ */
+ struct SectionFormatInfo* info;
}
Section;
@@ -142,8 +153,10 @@ typedef struct _ObjectCode {
/* ptr to mem containing the object file image */
char* image;
- /* A customizable type, that formats can use to augment ObjectCode */
- ObjectCodeFormatInfo *info;
+ /* A customizable type, that formats can use to augment ObjectCode
+ * See Note [No typedefs for customizable types]
+ */
+ struct ObjectCodeFormatInfo* info;
/* non-zero if the object file was mmap'd, otherwise malloc'd */
int imageMapped;
@@ -321,8 +334,8 @@ char *cstring_from_section_name(
# include "linker/ElfTypes.h"
#elif defined (mingw32_HOST_OS)
# define OBJFORMAT_PEi386
-struct _SectionFormatInfo { void* placeholder; };
-struct _ObjectCodeFormatInfo { void* placeholder; };
+struct SectionFormatInfo { void* placeholder; };
+struct ObjectCodeFormatInfo { void* placeholder; };
#elif defined(darwin_HOST_OS) || defined(ios_HOST_OS)
# define OBJFORMAT_MACHO
# include "linker/MachOTypes.h"