ó
™^c           @   s¾   d  d l  m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d d d „  ƒ  YZ d d d „  ƒ  YZ	 d S(   iÿÿÿÿ(   t   IntEnumt   FileTypec           B   s&   e  Z d  Z d Z d Z d Z d Z RS(   i    i   i   i   i   (   t   __name__t
   __module__t   nullt   objectt
   executablet   dynamic_shared_objectt	   core_dump(    (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyR      s
   t   MachineTypec           B   st   e  Z d  Z d Z d Z d Z d Z d Z d Z d Z	 d Z
 d	 Z d
 Z d Z d Z d Z d Z d Z d Z d Z RS(   i    i   i   i   i   i   i   i(   i+   i2   i>   i´   iµ   i·   i}   i¾   iZ¯  i[¯  (   R   R   t   unspecifiedt   sparct   x86t   mipst   sparc32plust   ppct   ppc64t   armt   sparc64t   ia64t   x86_64t   l1omt   k1omt   arm64t   calt   cudat   hsail32t   hsail64(    (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyR	      s$   t   FormatVersionc           B   s   e  Z d  Z d Z RS(   i    i   (   R   R   t   invalidt   current(    (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyR   ;   s   t   ElfClassc           B   s   e  Z d  Z d Z d Z RS(   i    i   i   (   R   R   R   t   class32t   class64(    (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyR   B   s   t   DataEncodingc           B   s   e  Z d  Z d Z d Z RS(   i    i   i   (   R   R   R   t   little_endiant
   big_endian(    (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyR"   K   s   t   OSABIc           B   s   e  Z d  Z d Z d Z RS(   i    i   id   (   R   R   t   nonet   gnuR   (    (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyR%   T   s   t   FileIdentificationc           B   s    e  Z d  „  Z e d „  ƒ Z RS(   c         C   s   | |  _  t j |  _ d  S(   N(   t   abiR   R   t   file_version(   t   selfR)   (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyt   __init__^   s    	c         C   sw   t  d ƒ } d | d <t d ƒ | d <t d ƒ | d <t d ƒ | d	 <|  j j | d
 <|  j j | d <|  j | d <| S(   Ni   i   i    t   Ei   t   Li   t   Fi   i   i   i   (   t	   bytearrayt   ordR)   t	   elf_classt   elf_data_encodingR*   (   R+   t   identification(    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyt   as_bytearrayb   s    
(   R   R   R,   t   propertyR5   (    (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyR(   ]   s   	t
   FileHeaderc           B   s    e  Z d  „  Z e d „  ƒ Z RS(   c         C   sG  d d  l  } d d  l } t | | j j ƒ sF t d t | ƒ ƒ ‚ n  | j sh t d t | ƒ ƒ ‚ n  | |  _ t	 |  j ƒ |  _
 |  j j t j k r¶ d |  _ d |  _ d |  _ n d |  _ d |  _ d |  _ |  j |  _ t j |  _ t j |  _ d  |  _ d  |  _ d  |  _ d	 |  _ d	 |  _ d	 |  _ | j j  j! j" j# |  _$ d  S(
   Niÿÿÿÿs+   ABI %s must be represented by an ABI objects!   ABI %s is not compatible with ELFi4   i    i(   i@   i8   i    (%   t   peachpy.formats.elf.sectiont   peachpy.abit
   isinstanceR)   t   ABIt	   TypeErrort   strt   is_elf_compatiblet
   ValueErrorR(   R4   R2   R   R    t   file_header_sizet   program_header_entry_sizet   section_header_entry_sizet   sizeR   R   t	   file_typeR   R   R*   t   Nonet   entry_addresst   program_header_table_offsett   section_header_table_offsett   flagst   program_header_entries_countt   section_header_entries_countt   formatst   elft   sectiont   SectionIndext	   undefinedt   section_name_string_table_index(   R+   R)   t   peachpy(    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyR,   p   s2    													c         C   s  d d  l  } | j j |  j j |  j j ƒ } |  j j | j |  j	 ƒ | j |  j j
 ƒ | j |  j ƒ | j |  j p{ d ƒ | j |  j p‘ d ƒ | j |  j p§ d ƒ | j |  j ƒ | j |  j ƒ | j |  j ƒ | j |  j ƒ | j |  j ƒ | j |  j ƒ | j |  j ƒ S(   Niÿÿÿÿi    (   t   peachpy.encodert   encodert   EncoderR)   t
   endiannesst   elf_bitnessR4   R5   t   uint16RD   t   elf_machine_typet   uint32R*   t   unsigned_offsetRF   RG   RH   RI   R@   RA   RJ   RB   RK   RQ   (   R+   RR   RT   (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyR5   ˜   s    !Þ(   R   R   R,   R6   R5   (    (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyR7   o   s   	(N(    (    (
   t   enumR    R   R	   R   R   R"   R%   R(   R7   (    (    (    sE   /torch/pytorch/third_party/python-peachpy/peachpy/formats/elf/file.pyt   <module>   s   '			