From c5ab800077547700cfacc6f9d0d3fe5e25f2a147 Mon Sep 17 00:00:00 2001 From: sewardj Date: Mon, 4 Feb 2002 16:30:20 +0000 Subject: [PATCH] [project @ 2002-02-04 16:30:20 by sewardj] Adding section descriptions, for ELF: don't record sections satisfying size == 0 || kind `notElem` [SECTIONKIND_CODE_OR_RODATA, SECTIONKIND_RWDATA] The latter condition is really an optimisation based on knowledge of what queries will be made of the table. Still, seems to work, and reduces the number of sections in the list by about a factor of 3, so hopefully will improve GC performance in GHCi. If you get wierd GC problems in GHCi ... this may be to blame. --- ghc/rts/Linker.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ghc/rts/Linker.c b/ghc/rts/Linker.c index 3ed1843..4eeaf51 100644 --- a/ghc/rts/Linker.c +++ b/ghc/rts/Linker.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Linker.c,v 1.81 2002/02/01 02:05:52 sof Exp $ + * $Id: Linker.c,v 1.82 2002/02/04 16:30:20 sewardj Exp $ * * (c) The GHC Team, 2000, 2001 * @@ -857,6 +857,10 @@ static void addSection ( ObjectCode* oc, SectionKind kind, s->kind = kind; s->next = oc->sections; oc->sections = s; + /* + fprintf(stderr, "addSection: %p-%p (size %d), kind %d\n", + start, ((char*)end)-1, end - start + 1, kind ); + */ } @@ -1936,10 +1940,11 @@ ocGetNames_ELF ( ObjectCode* oc ) } /* fill in the section info */ - addSection(oc, kind, ehdrC + shdr[i].sh_offset, - ehdrC + shdr[i].sh_offset + shdr[i].sh_size - 1); - if (kind != SECTIONKIND_OTHER && shdr[i].sh_size > 0) + if (kind != SECTIONKIND_OTHER && shdr[i].sh_size > 0) { addProddableBlock(oc, ehdrC + shdr[i].sh_offset, shdr[i].sh_size); + addSection(oc, kind, ehdrC + shdr[i].sh_offset, + ehdrC + shdr[i].sh_offset + shdr[i].sh_size - 1); + } if (shdr[i].sh_type != SHT_SYMTAB) continue; -- 1.7.10.4