From d0fde4d6592feb190bd138dae1109545edfa4318 Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 24 Sep 2015 04:19:56 -0400 Subject: [PATCH] P4 to Git Change 1193950 by nhaustov@nhaustov_hsa on 2015/09/24 04:08:17 SWDEV-77164 - Remove libelf differences from original elftoolchain. These erroneously make ELF_C_RDWR not to load existing section headers. Testing: pre-checkin Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/utils/libelf/elf_scn.c#4 edit --- rocclr/compiler/lib/loaders/elf/utils/libelf/elf_scn.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/rocclr/compiler/lib/loaders/elf/utils/libelf/elf_scn.c b/rocclr/compiler/lib/loaders/elf/utils/libelf/elf_scn.c index 2dbaea1ecd..8f9389d3f1 100644 --- a/rocclr/compiler/lib/loaders/elf/utils/libelf/elf_scn.c +++ b/rocclr/compiler/lib/loaders/elf/utils/libelf/elf_scn.c @@ -154,11 +154,7 @@ elf_getscn(Elf *e, size_t index) if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) return (NULL); - // If we aren't a read/write from a file or a read only elf, - // make sure that the headers are loaded. If we are a read/write - // from a file, we should have the headers loaded already. - if ((e->e_cmd == ELF_C_READ - || (e->e_cmd == ELF_C_RDWR && e->e_fd == -1)) && + if (e->e_cmd != ELF_C_WRITE && (e->e_flags & LIBELF_F_SHDRS_LOADED) == 0 && _libelf_load_section_headers(e, ehdr) == 0) return (NULL); @@ -211,8 +207,7 @@ elf_newscn(Elf *e) * file using ELF_C_READ, mess with its internal structure and * use elf_update(...,ELF_C_NULL) to compute its new layout. */ - if ((e->e_cmd == ELF_C_READ - || (e->e_cmd == ELF_C_RDWR && e->e_fd == -1)) && + if (e->e_cmd != ELF_C_WRITE && (e->e_flags & LIBELF_F_SHDRS_LOADED) == 0 && _libelf_load_section_headers(e, ehdr) == 0) return (NULL);