[Git][ghc/ghc][master] Fix build warning; add more informative information to the linker; fix linker for empty sections
Marge Bot
gitlab at gitlab.haskell.org
Thu Apr 23 03:15:43 UTC 2020
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
831b6642 by Moritz Angermann at 2020-04-22T23:15:33-04:00
Fix build warning; add more informative information to the linker; fix linker for empty sections
- - - - -
2 changed files:
- rts/linker/MachO.c
- rts/posix/GetTime.c
Changes:
=====================================
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]))
=====================================
rts/posix/GetTime.c
=====================================
@@ -71,7 +71,6 @@ Time getCurrentThreadCPUTime(void)
// support clock_getcpuclockid. Hence we prefer to use the Darwin-specific
// path on Darwin, even if clock_gettime is available.
#if defined(darwin_HOST_OS)
- mach_port_t port = pthread_mach_thread_np(osThreadId());
thread_basic_info_data_t info = { 0 };
mach_msg_type_number_t info_count = THREAD_BASIC_INFO_COUNT;
kern_return_t kern_err = thread_info(mach_thread_self(), THREAD_BASIC_INFO,
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/831b66425aa3a24e769ace8d4649299ade021717
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/831b66425aa3a24e769ace8d4649299ade021717
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200422/84a24082/attachment-0001.html>
More information about the ghc-commits
mailing list