mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-28 23:53:55 +00:00
Use architecture pointer size for AddConstructor (#1094)
* Use architecture pointer size for AddConstructor * Update src/backend.rs Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
This commit is contained in:
parent
0416f122aa
commit
04091772bc
@ -132,10 +132,16 @@ impl AddConstructor for ObjectProduct {
|
||||
let init_array_section =
|
||||
self.object
|
||||
.add_section(segment.to_vec(), b".init_array".to_vec(), SectionKind::Data);
|
||||
let address_size = self
|
||||
.object
|
||||
.architecture()
|
||||
.address_size()
|
||||
.expect("address_size must be known")
|
||||
.bytes();
|
||||
self.object.append_section_data(
|
||||
init_array_section,
|
||||
&std::iter::repeat(0)
|
||||
.take(8 /*FIXME pointer size*/)
|
||||
.take(address_size.into())
|
||||
.collect::<Vec<u8>>(),
|
||||
8,
|
||||
);
|
||||
@ -144,7 +150,7 @@ impl AddConstructor for ObjectProduct {
|
||||
init_array_section,
|
||||
object::write::Relocation {
|
||||
offset: 0,
|
||||
size: 64, // FIXME pointer size
|
||||
size: address_size * 8,
|
||||
kind: RelocationKind::Absolute,
|
||||
encoding: RelocationEncoding::Generic,
|
||||
symbol,
|
||||
|
Loading…
Reference in New Issue
Block a user