Exemplo n.º 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);
        }
Exemplo n.º 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);
        }