aboutsummaryrefslogtreecommitdiff
path: root/devel/plasma/files/patch-plasma_lib_fileformat_elf.py
blob: 8f7053efd5a0f5c462054e0b29cb23fbac3738f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
--- plasma/lib/fileformat/elf.py.orig	2019-02-27 16:23:45 UTC
+++ plasma/lib/fileformat/elf.py
@@ -215,9 +215,13 @@ class ELF(Binary):
         # pyreadelf's assumptions make our own string table
         fakestrtabheader = {
             "sh_offset": self.__get_offset(self.dtags["DT_STRTAB"]),
+            "sh_size":0,
+            "sh_flags":0,
+            "sh_addralign":0
         }
+
         strtab = StringTableSection(
-                fakestrtabheader, "strtab_plasma", self.elf.stream)
+                fakestrtabheader, "strtab_plasma", self.elf)
 
         # ...
         # Here in CLE was checked the DT_SONAME 
@@ -232,7 +236,9 @@ class ELF(Binary):
         fakesymtabheader = {
             "sh_offset": self.__get_offset(self.dtags["DT_SYMTAB"]),
             "sh_entsize": self.dtags["DT_SYMENT"],
-            "sh_size": 0
+            "sh_size": 0,
+            "sh_flags": 0,
+            "sh_addralign" : 0
         } # bogus size: no iteration allowed
 
         # ...
@@ -240,7 +246,7 @@ class ELF(Binary):
         # ...
 
         self.dynsym = SymbolTableSection(
-                fakesymtabheader, "symtab_plasma", self.elf.stream,
+                fakesymtabheader, "symtab_plasma",
                 self.elf, strtab)
 
         # mips' relocations are absolutely screwed up, handle some of them here.
@@ -276,11 +282,12 @@ class ELF(Binary):
                 "sh_offset": self.__get_offset(reloffset),
                 "sh_type": "SHT_" + rela_type,
                 "sh_entsize": relentsz,
-                "sh_size": relsz
+                "sh_size": relsz,
+                "sh_flags":0,
+                "sh_addralign":0
             }
             reloc_sec = RelocationSection(
-                    fakerelheader, "reloc_plasma",
-                    self.elf.stream, self.elf)
+                    fakerelheader, "reloc_plasma", self.elf)
             self.__register_relocs(reloc_sec)
 
         # try to parse relocations out of a table of type DT_JMPREL
@@ -291,11 +298,13 @@ class ELF(Binary):
                 "sh_offset": self.__get_offset(jmpreloffset),
                 "sh_type": "SHT_" + rela_type,
                 "sh_entsize": relentsz,
-                "sh_size": jmprelsz
+                "sh_size": jmprelsz,
+                "sh_flags":0,
+                "sh_addralign":0
             }
             jmprel_sec = RelocationSection(
                     fakejmprelheader, "jmprel_plasma",
-                    self.elf.stream, self.elf)
+                    self.elf)
 
             self.jmprel = self.__register_relocs(jmprel_sec)