1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright (c) 2018 Google, Inc
3 # Written by Simon Glass <sjg@chromium.org>
5 # Entry-type module for sections, which are entries which can contain other
9 from entry import Entry
15 class Entry_section(Entry):
16 def __init__(self, image, etype, node):
17 Entry.__init__(self, image, etype, node)
18 self._section = bsection.Section(node.name, node)
20 def ObtainContents(self):
21 self._section.GetEntryContents()
24 return self._section.GetData()
26 def GetPositions(self):
27 """Handle entries that want to set the position/size of other entries
29 This calls each entry's GetPositions() method. If it returns a list
30 of entries to update, it updates them.
32 self._section.GetEntryPositions()
36 """Pack all entries into the section"""
37 self._section.PackEntries()
38 self.size = self._section.CheckSize()
39 return super(Entry_section, self).Pack(pos)
41 def WriteSymbols(self, section):
42 """Write symbol values into binary files for access at run time"""
43 self._section.WriteSymbols()
45 def ProcessContents(self):
46 self._section.ProcessEntryContents()
47 super(Entry_section, self).ProcessContents()
49 def CheckPosition(self):
50 self._section.CheckEntries()
52 def WriteMap(self, fd, indent):
53 """Write a map of the section to a .map file
56 fd: File to write the map to
58 super(Entry_section, self).WriteMap(fd, indent)
59 self._section.WriteMap(fd, indent + 1)