summaryrefslogtreecommitdiff
path: root/rts/linker
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2020-04-21 11:44:07 +0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-22 23:15:33 -0400
commit831b66425aa3a24e769ace8d4649299ade021717 (patch)
tree9782da78fdaa0f34f5a39e103910d5612238dccc /rts/linker
parent4b4a8b60a5b403e02117ab0a30a386664845586b (diff)
downloadhaskell-831b66425aa3a24e769ace8d4649299ade021717.tar.gz
Fix build warning; add more informative information to the linker; fix linker for empty sections
Diffstat (limited to 'rts/linker')
-rw-r--r--rts/linker/MachO.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c
index 6e379ffb53..58712075b2 100644
--- a/rts/linker/MachO.c
+++ b/rts/linker/MachO.c
@@ -677,6 +677,14 @@ static int
relocateSection(ObjectCode* oc, int curSection)
{
Section * sect = &oc->sections[curSection];
+
+ IF_DEBUG(linker, debugBelch("relocateSection %d, info: %x\n", curSection, sect->info));
+
+ // empty sections (without segments), won't have their info filled.
+ // there is no relocation to be done for them.
+ if(sect->info == NULL)
+ return 1;
+
MachOSection * msect = sect->info->macho_section; // for access convenience
MachORelocationInfo * relocs = sect->info->relocation_info;
MachOSymbol * symbols = oc->info->macho_symbols;
@@ -1192,7 +1200,7 @@ ocGetNames_MachO(ObjectCode* oc)
SymbolAddr* commonStorage = NULL;
unsigned long commonCounter;
- IF_DEBUG(linker,debugBelch("ocGetNames_MachO: start\n"));
+ IF_DEBUG(linker,debugBelch("ocGetNames_MachO: %s start\n", OC_INFORMATIVE_FILENAME(oc)));
Section *secArray;
secArray = (Section*)stgCallocBytes(
@@ -1449,7 +1457,7 @@ ocMprotect_MachO( ObjectCode *oc )
int
ocResolve_MachO(ObjectCode* oc)
{
- IF_DEBUG(linker, debugBelch("ocResolve_MachO: start\n"));
+ IF_DEBUG(linker, debugBelch("ocResolve_MachO: %s start\n", OC_INFORMATIVE_FILENAME(oc)));
if(NULL != oc->info->dsymCmd)
{
@@ -1460,6 +1468,9 @@ ocResolve_MachO(ObjectCode* oc)
for (int i = 0; i < oc->n_sections; i++)
{
const char * sectionName = oc->info->macho_sections[i].sectname;
+
+ IF_DEBUG(linker, debugBelch("ocResolve_MachO: section %d/%d: %s\n", i, oc->n_sections, sectionName));
+
if( !strcmp(sectionName,"__la_symbol_ptr")
|| !strcmp(sectionName,"__la_sym_ptr2")
|| !strcmp(sectionName,"__la_sym_ptr3"))
@@ -1483,7 +1494,7 @@ ocResolve_MachO(ObjectCode* oc)
}
else
{
- IF_DEBUG(linker, debugBelch("ocResolve_MachO: unknown section\n"));
+ IF_DEBUG(linker, debugBelch("ocResolve_MachO: unknown section %d/%d\n", i, oc->n_sections));
}
}
}
@@ -1520,7 +1531,7 @@ ocResolve_MachO(ObjectCode* oc)
for(int i = 0; i < oc->n_sections; i++)
{
- IF_DEBUG(linker, debugBelch("ocResolve_MachO: relocating section %d\n", i));
+ IF_DEBUG(linker, debugBelch("ocResolve_MachO: relocating section %d/%d\n", i, oc->n_sections));
#if defined(aarch64_HOST_ARCH)
if (!relocateSectionAarch64(oc, &oc->sections[i]))