diff --git a/sig/caotral/binary/elf.rbs b/sig/caotral/binary/elf.rbs index 8a0df987..e77b5d58 100644 --- a/sig/caotral/binary/elf.rbs +++ b/sig/caotral/binary/elf.rbs @@ -2,6 +2,7 @@ class Caotral::Binary::ELF include Enumerable[Caotral::Binary::ELF::Section] attr_reader sections: Array[Caotral::Binary::ELF::Section] + attr_reader program_headers: Array[Caotral::Binary::ELF::ProgramHeader] attr_accessor header: Caotral::Binary::ELF::Header? def initialize: () -> void @@ -11,5 +12,5 @@ class Caotral::Binary::ELF def select_by_name: (String | Symbol) -> Array[Caotral::Binary::ELF::Section] def index: (String | Symbol) -> Integer? def select_by_names: (Array[String | Regexp]) -> Array[Caotral::Binary::ELF::Section] - def without_section: (String | Symbol) -> Array[Caotral::Binary::ELF::Section] + def without_sections: (Array[String | Regexp]) -> Array[Caotral::Binary::ELF::Section] end diff --git a/sig/caotral/linker.rbs b/sig/caotral/linker.rbs index ec8e2b5d..d651bdba 100644 --- a/sig/caotral/linker.rbs +++ b/sig/caotral/linker.rbs @@ -3,16 +3,18 @@ class Caotral::Linker @output: String @linker: String @options: Array[String] + @needed: Array[String] @executable: bool @shared: bool + @pie: bool @debug: bool - def self.link!: (inputs: Array[String], ?output: String, ?linker: String, ?debug: bool, ?shared: bool, ?executable: bool) -> void - def initialize: (inputs: Array[String], ?output: String, ?linker: String, ?linker_options: Array[String], ?executable: bool, ?shared: bool, ?debug: bool) -> void - def link: (inputs: Array[String], ?output: String, ?shared: bool, ?debug: bool, ?executable: bool) -> void + def self.link!: (inputs: Array[String], ?output: String, ?linker: String, ?debug: bool, ?shared: bool, ?executable: bool, ?pie: bool, ?needed: Array[String]) -> void + def initialize: (inputs: Array[String], ?output: String, ?linker: String, ?linker_options: Array[String], ?executable: bool, ?shared: bool, ?pie: bool, ?debug: bool, ?needed: Array[String]) -> void + def link: (inputs: Array[String], ?output: String, ?shared: bool, ?debug: bool, ?executable: bool, ?pie: bool) -> void - def link_command: (inputs: Array[String], ?output: String, ?shared: bool, ?debug: bool) -> String + def link_command: (inputs: Array[String], ?output: String) -> String def libpath: () -> String def gcc_libpath: () -> String - def to_elf: (inputs: Array[String], ?output: String, ?debug: bool, ?shared: bool, ?executable: bool) -> String + def to_elf: (inputs: Array[String], ?output: String, ?debug: bool, ?shared: bool, ?executable: bool, ?pie: bool, ?needed: Array[String]) -> String end diff --git a/sig/caotral/linker/builder.rbs b/sig/caotral/linker/builder.rbs index 172e3b22..c04da0da 100644 --- a/sig/caotral/linker/builder.rbs +++ b/sig/caotral/linker/builder.rbs @@ -1,13 +1,17 @@ class Caotral::Linker::Builder @elf_objs: Array[Caotral::Binary::ELF] - @symbols: Hash[Symbol, Set[String]] + @symbols: Hash[Symbol, untyped] + @linker_metadata: Hash[Symbol, untyped] @executable: bool @debug: bool @shared: bool + @pie: bool + @needed: Array[String] - attr_reader symbols: Hash[Symbol, Set[String]] + attr_reader symbols: Hash[Symbol, untyped] + attr_reader linker_metadata: Hash[Symbol, untyped] - def initialize: (elf_objs: Array[Caotral::Binary::ELF], ?executable: bool, ?debug: bool, ?shared: bool) -> void + def initialize: (elf_objs: Array[Caotral::Binary::ELF], ?executable: bool, ?debug: bool, ?shared: bool, ?pie: bool, ?needed: Array[String]) -> void def build: () -> Caotral::Binary::ELF - def resolve_symbols: () -> Hash[Symbol, Set[String]] + def resolve_symbols: () -> Hash[Symbol, untyped] end diff --git a/sig/caotral/linker/layout.rbs b/sig/caotral/linker/layout.rbs new file mode 100644 index 00000000..e002a01f --- /dev/null +++ b/sig/caotral/linker/layout.rbs @@ -0,0 +1,16 @@ +class Caotral::Linker::Layout + @elf: Caotral::Binary::ELF + @shared: bool + @executable: bool + @pie: bool + @file_offset: Integer + @section_headers_offset: Integer + + attr_reader debug: bool? + attr_reader shared: bool + attr_reader executable: bool + attr_reader pie: bool + + def initialize: (elf: Caotral::Binary::ELF, shared: bool, executable: bool, pie: bool) -> void + def apply!: () -> Caotral::Binary::ELF +end diff --git a/sig/caotral/linker/writer.rbs b/sig/caotral/linker/writer.rbs index b20ccd88..edb23d38 100644 --- a/sig/caotral/linker/writer.rbs +++ b/sig/caotral/linker/writer.rbs @@ -1,4 +1,18 @@ class Caotral::Linker::Writer + @elf_obj: Caotral::Binary::ELF + @output: String + @debug: bool + @executable: bool + @shared: bool + @pie: bool + @program_headers: Array[Caotral::Binary::ELF::ProgramHeader] + @write_sections: Array[Caotral::Binary::ELF::Section] + + attr_reader elf_obj: Caotral::Binary::ELF + attr_reader output: String + attr_reader debug: bool + attr_reader program_headers: Array[Caotral::Binary::ELF::ProgramHeader] + def self.write!: (elf_obj: Caotral::Binary::ELF, output: String, ?debug: bool, ?executable: bool, ?shared: bool) -> String def initialize: (elf_obj: Caotral::Binary::ELF, output: String, ?debug: bool, ?executable: bool, ?shared: bool, ?pie: bool) -> void def write: () -> String