File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -1978,6 +1978,30 @@ impl<'a> Writer<'a> {
1978
1978
} ) ;
1979
1979
}
1980
1980
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
+
1981
2005
/// Reserve a file range for a COMDAT section.
1982
2006
///
1983
2007
/// `count` is the number of sections in the COMDAT group.
@@ -2222,6 +2246,15 @@ impl Class {
2222
2246
}
2223
2247
}
2224
2248
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
+
2225
2258
/// Return the size of a dynamic entry.
2226
2259
pub fn dyn_size ( self ) -> usize {
2227
2260
if self . is_64 {
You can’t perform that action at this time.
0 commit comments