1 use object
::{pe, read, Object, ObjectSection}
;
3 use std
::path
::PathBuf
;
5 #[cfg(feature = "coff")]
7 fn coff_extended_relocations() {
8 let path_to_obj
: PathBuf
= ["testfiles", "coff", "relocs_overflow.o"].iter().collect();
9 let contents
= fs
::read(&path_to_obj
).expect("Could not read relocs_overflow.o");
11 read
::coff
::CoffFile
::parse(&contents
[..]).expect("Could not parse relocs_overflow.o");
12 let code_section
= file
13 .section_by_name(".text")
14 .expect("Could not find .text section in relocs_overflow.o");
15 match code_section
.flags() {
16 object
::SectionFlags
::Coff { characteristics }
=> {
17 assert
!(characteristics
& pe
::IMAGE_SCN_LNK_NRELOC_OVFL
!= 0)
19 _
=> panic
!("Invalid section flags flavour."),
21 let relocations
= code_section
.relocations().collect
::<Vec
<_
>>();
22 assert_eq
!(relocations
.len(), 65536);