Skip to content

Commit 7e25355

Browse files
committed
Stage #[repr(packed)] in std::rt
1 parent 576c717 commit 7e25355

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/libstd/rt/backtrace.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,8 @@ mod imp {
701701
static IMAGE_FILE_MACHINE_IA64: libc::DWORD = 0x0200;
702702
static IMAGE_FILE_MACHINE_AMD64: libc::DWORD = 0x8664;
703703

704-
#[repr(packed)]
704+
#[cfg(stage0)]
705+
#[packed]
705706
struct SYMBOL_INFO {
706707
SizeOfStruct: libc::c_ulong,
707708
TypeIndex: libc::c_ulong,
@@ -723,6 +724,30 @@ mod imp {
723724
Name: [libc::c_char, ..MAX_SYM_NAME],
724725
}
725726

727+
#[cfg(not(stage0))]
728+
#[repr(C, packed)]
729+
struct SYMBOL_INFO {
730+
SizeOfStruct: libc::c_ulong,
731+
TypeIndex: libc::c_ulong,
732+
Reserved: [u64, ..2],
733+
Index: libc::c_ulong,
734+
Size: libc::c_ulong,
735+
ModBase: u64,
736+
Flags: libc::c_ulong,
737+
Value: u64,
738+
Address: u64,
739+
Register: libc::c_ulong,
740+
Scope: libc::c_ulong,
741+
Tag: libc::c_ulong,
742+
NameLen: libc::c_ulong,
743+
MaxNameLen: libc::c_ulong,
744+
// note that windows has this as 1, but it basically just means that
745+
// the name is inline at the end of the struct. For us, we just bump
746+
// the struct size up to MAX_SYM_NAME.
747+
Name: [libc::c_char, ..MAX_SYM_NAME],
748+
}
749+
750+
726751
#[repr(C)]
727752
enum ADDRESS_MODE {
728753
AddrMode1616,
@@ -772,6 +797,7 @@ mod imp {
772797

773798
static MAXIMUM_SUPPORTED_EXTENSION: uint = 512;
774799

800+
#[repr(C)]
775801
pub struct CONTEXT {
776802
ContextFlags: libc::DWORD,
777803
Dr0: libc::DWORD,
@@ -800,6 +826,7 @@ mod imp {
800826
ExtendedRegisters: [u8, ..MAXIMUM_SUPPORTED_EXTENSION],
801827
}
802828

829+
#[repr(C)]
803830
pub struct FLOATING_SAVE_AREA {
804831
ControlWord: libc::DWORD,
805832
StatusWord: libc::DWORD,
@@ -829,6 +856,7 @@ mod imp {
829856
use libc::{c_longlong, c_ulonglong};
830857
use libc::types::os::arch::extra::{WORD, DWORD, DWORDLONG};
831858

859+
#[repr(C)]
832860
pub struct CONTEXT {
833861
P1Home: DWORDLONG,
834862
P2Home: DWORDLONG,
@@ -886,11 +914,13 @@ mod imp {
886914
LastExceptionFromRip: DWORDLONG,
887915
}
888916

917+
#[repr(C)]
889918
pub struct M128A {
890919
Low: c_ulonglong,
891920
High: c_longlong
892921
}
893922

923+
#[repr(C)]
894924
pub struct FLOATING_SAVE_AREA {
895925
_Dummy: [u8, ..512] // FIXME: Fill this out
896926
}
@@ -907,6 +937,7 @@ mod imp {
907937
}
908938
}
909939

940+
#[repr(C)]
910941
struct Cleanup {
911942
handle: libc::HANDLE,
912943
SymCleanup: SymCleanupFn,

0 commit comments

Comments
 (0)