File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1978,6 +1978,30 @@ impl<'a> Writer<'a> {
19781978 } ) ;
19791979 }
19801980
1981+ /// Write the section header for a relative relocation section.
1982+ ///
1983+ /// `offset` is the file offset of the relocations.
1984+ /// `size` is the size of the section in bytes.
1985+ pub fn write_relative_relocation_section_header (
1986+ & mut self ,
1987+ name : StringId ,
1988+ offset : usize ,
1989+ size : usize ,
1990+ ) {
1991+ self . write_section_header ( & SectionHeader {
1992+ name : Some ( name) ,
1993+ sh_type : elf:: SHT_RELA ,
1994+ sh_flags : 0 ,
1995+ sh_addr : 0 ,
1996+ sh_offset : offset as u64 ,
1997+ sh_size : size as u64 ,
1998+ sh_link : 0 ,
1999+ sh_info : 0 ,
2000+ sh_addralign : self . elf_align as u64 ,
2001+ sh_entsize : self . class ( ) . relr_size ( ) as u64 ,
2002+ } ) ;
2003+ }
2004+
19812005 /// Reserve a file range for a COMDAT section.
19822006 ///
19832007 /// `count` is the number of sections in the COMDAT group.
@@ -2222,6 +2246,15 @@ impl Class {
22222246 }
22232247 }
22242248
2249+ /// Return the size of a relative relocation entry.
2250+ pub fn relr_size ( self ) -> usize {
2251+ if self . is_64 {
2252+ mem:: size_of :: < elf:: Relr64 < Endianness > > ( )
2253+ } else {
2254+ mem:: size_of :: < elf:: Relr32 < Endianness > > ( )
2255+ }
2256+ }
2257+
22252258 /// Return the size of a dynamic entry.
22262259 pub fn dyn_size ( self ) -> usize {
22272260 if self . is_64 {
You can’t perform that action at this time.
0 commit comments