@@ -31,7 +31,7 @@ fn test_section_iterator() {
31
31
let target_machine = get_native_target_machine ( ) ;
32
32
33
33
let context = Context :: create ( ) ;
34
- let mut module = context. create_module ( "my_module " ) ;
34
+ let mut module = context. create_module ( "test_section_iterator " ) ;
35
35
36
36
let gv_a = module. add_global ( context. i8_type ( ) , None , "a" ) ;
37
37
gv_a. set_initializer ( & context. i8_type ( ) . const_zero ( ) . as_basic_value_enum ( ) ) ;
@@ -90,7 +90,7 @@ fn test_symbol_iterator() {
90
90
let target_machine = get_native_target_machine ( ) ;
91
91
92
92
let context = Context :: create ( ) ;
93
- let mut module = context. create_module ( "my_module " ) ;
93
+ let mut module = context. create_module ( "test_symbol_iterator " ) ;
94
94
module
95
95
. add_global ( context. i8_type ( ) , None , "a" )
96
96
. set_initializer ( & context. i8_type ( ) . const_zero ( ) . as_basic_value_enum ( ) ) ;
@@ -141,15 +141,18 @@ fn test_reloc_iterator() {
141
141
let target_machine = get_native_target_machine ( ) ;
142
142
143
143
let context = Context :: create ( ) ;
144
- let mut module = context. create_module ( "my_module" ) ;
144
+ let target_data = target_machine. get_target_data ( ) ;
145
+ let intptr_t = target_data. ptr_sized_int_type_in_context ( & context, None ) ;
146
+
147
+ let mut module = context. create_module ( "test_reloc_iterator" ) ;
145
148
let x_ptr = module
146
149
. add_global ( context. i8_type ( ) , None , "x" )
147
150
. as_pointer_value ( ) ;
148
151
let x_plus_4 = x_ptr
149
- . const_to_int ( context . i64_type ( ) )
150
- . const_add ( context . i64_type ( ) . const_int ( 4 , false ) ) ;
152
+ . const_to_int ( intptr_t )
153
+ . const_add ( intptr_t . const_int ( 4 , false ) ) ;
151
154
module
152
- . add_global ( context . i64_type ( ) , None , "a" )
155
+ . add_global ( intptr_t , None , "a" )
153
156
. set_initializer ( & x_plus_4) ;
154
157
155
158
module. set_triple ( & target_machine. get_triple ( ) ) ;
@@ -162,7 +165,7 @@ fn test_reloc_iterator() {
162
165
163
166
let mut found_relocation = false ;
164
167
for section in object_file. get_sections ( ) {
165
- for reloc in section. get_relocations ( ) {
168
+ for _ in section. get_relocations ( ) {
166
169
found_relocation = true ;
167
170
// We don't stop the traversal here, so as to exercise the iterators.
168
171
}
0 commit comments