Beispiel #1
0
func SetupElfAuxv(u models.Usercorn) ([]byte, error) {
	var buf bytes.Buffer
	auxv, err := setupElfAuxv(u)
	if err != nil {
		return nil, err
	}
	if u.Bits() == 32 {
		var auxv32 Elf32Auxv
		for _, a := range auxv {
			auxv32.Type = uint32(a.Type)
			auxv32.Val = uint32(a.Val)
			if err := struc.PackWithOrder(&buf, &auxv32, u.ByteOrder()); err != nil {
				return nil, err
			}
		}
	} else {
		for _, a := range auxv {
			if err := struc.PackWithOrder(&buf, &a, u.ByteOrder()); err != nil {
				return nil, err
			}
		}
	}
	return buf.Bytes(), err
}
func (s *StrucStream) Pack(i interface{}) error {
	return struc.PackWithOrder(s.Stream, i, s.Order)
}