From 798a3cfa961b4db6c4ac4e581227c48e1da28dc8 Mon Sep 17 00:00:00 2001 From: Rafal Harabien Date: Thu, 8 Dec 2011 20:28:06 +0000 Subject: [PATCH] - Partially revert r54613 to fix test bot svn path=/trunk/; revision=54619 --- reactos/tools/rsym/rsym.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/reactos/tools/rsym/rsym.c b/reactos/tools/rsym/rsym.c index 3894d406dea..e40f2f0a224 100644 --- a/reactos/tools/rsym/rsym.c +++ b/reactos/tools/rsym/rsym.c @@ -431,6 +431,34 @@ FindSectionForRVA(DWORD RVA, unsigned NumberOfSections, PIMAGE_SECTION_HEADER Se return NULL; } +static int +IncludeRelocationsForSection(PIMAGE_SECTION_HEADER SectionHeader) +{ + static char *BlacklistedSections[] = + { + ".edata", + ".reloc" + }; + char SectionName[IMAGE_SIZEOF_SHORT_NAME]; + unsigned i; + + if (0 != (SectionHeader->Characteristics & IMAGE_SCN_LNK_REMOVE)) + { + return 0; + } + + for (i = 0; i < sizeof(BlacklistedSections) / sizeof(BlacklistedSections[0]); i++) + { + strncpy(SectionName, BlacklistedSections[i], IMAGE_SIZEOF_SHORT_NAME); + if (0 == memcmp(SectionName, SectionHeader->Name, IMAGE_SIZEOF_SHORT_NAME)) + { + return 0; + } + } + + return 1; +} + static int ProcessRelocations(ULONG *ProcessedRelocsLength, void **ProcessedRelocs, void *RawData, PIMAGE_OPTIONAL_HEADER OptHeader, @@ -476,7 +504,7 @@ ProcessRelocations(ULONG *ProcessedRelocsLength, void **ProcessedRelocs, { TargetSectionHeader = FindSectionForRVA(BaseReloc->VirtualAddress, NumberOfSections, SectionHeaders); - if (NULL != TargetSectionHeader) + if (NULL != TargetSectionHeader && IncludeRelocationsForSection(TargetSectionHeader)) { AcceptedRelocs = *ProcessedRelocs; Found = 0;