示例#1
0
        private ElfBinarySection GetOrCreateDebugSection(string name, bool createSymbol, out int symbolIndex)
        {
            var newSection = new ElfBinarySection()
            {
                Name      = name,
                Alignment = 1,
                Type      = ElfSectionType.ProgBits,
                Stream    = new MemoryStream(),
            };

            Elf.AddSection(newSection);
            symbolIndex = 0;

            if (createSymbol && _symbolTable != null)
            {
                symbolIndex = _symbolTable.Entries.Count;
                _symbolTable.Entries.Add(new ElfSymbol()
                {
                    Type    = ElfSymbolType.Section,
                    Section = newSection,
                });
            }

            return(newSection);
        }
示例#2
0
        private ElfRelocationTable GetOrCreateRelocationTable(ElfBinarySection section)
        {
            var newSection = new ElfRelocationTable()
            {
                Name      = $".rela{section.Name}",
                Alignment = (ulong)AddressSize,
                Flags     = ElfSectionFlags.InfoLink,
                Type      = ElfSectionType.RelocationAddends,
                Info      = section,
                Link      = _symbolTable,
            };

            Elf.AddSection(newSection);
            return(newSection);
        }