• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • X86isa
      • Execloader
        • Elf-reader
          • Elf64_sym
          • Elf32_sym
          • Elf-header
          • Elf-section-header
          • Elf64-segment-header
          • Elf32-segment-header
          • Elf_bits32
          • Elf_bits8
          • Elf_bits64
          • Elf_bits16
          • Section-info
          • Read-section-headers
          • Read-segment-headers-64
          • Read-segment-headers-32
          • Read-section-names
          • Elf64_sym-info
          • Elf32_sym-info
          • Read-elf-header
          • Parse-symtab-entries
          • Populate-elf-contents
          • Is-elf-content-p
          • Get-string-section-data
          • Get-section-info1
          • Set-elf-stobj-fields
          • Get-named-section-headers
            • Elf-read-mem-null-term
            • Get-section-info
            • Get-symtab-entries
            • Find-label-address-from-elf-symtab-info
            • Section-names
            • Populate-elf
            • Get-label-addresses
            • Elf-read-string-null-term
            • Get-label-address
            • Good-elf-p
            • Elf64_sym-equiv-under-mask
            • Elf64-segment-headers
            • Elf32_sym-equiv-under-mask
            • Elf32-segment-headers
            • Section-info-list
            • Elf64_sym-info-list
            • Elf32_sym-info-list
            • Elf-section-headers
            • Elf64_sym-debug
            • Elf32_sym-debug
          • Mach-o-reader
          • Merge-first-split-bytes
          • Split-bytes
          • Take-till-zero
          • Charlist->bytes
          • Merge-bytes
          • Bytes->charlist
          • String->bytes
          • Bytes->string
        • Axe
      • Testing-utilities
      • Math
    • Elf-reader

    Get-named-section-headers

    Signature
    (get-named-section-headers elf-header file-byte-list) 
      → 
    new-sections
    Arguments
    elf-header — Guard (elf-header-p elf-header).
    file-byte-list — Guard (byte-listp file-byte-list).
    Returns
    new-sections — Type (elf-section-headers-p new-sections).

    Definitions and Theorems

    Function: get-named-section-headers

    (defun get-named-section-headers (elf-header file-byte-list)
     (declare (xargs :guard (and (elf-header-p elf-header)
                                 (byte-listp file-byte-list))))
     (let ((__function__ 'get-named-section-headers))
      (declare (ignorable __function__))
      (b*
       (((elf-header elf-header))
        (section-header-offset elf-header.shoff)
        (section-header-bytes
             (nthcdr section-header-offset file-byte-list))
        ((unless (byte-listp section-header-bytes))
         (prog2$ (raise "Not enough bytes to read ELF section headers!")
                 nil))
        (nsections elf-header.shnum)
        (w (if (equal elf-header.class 1) 4 8))
        (string-section-index elf-header.shstrndx)
        ((when (not (or (equal nsections string-section-index)
                        (> nsections string-section-index))))
         (prog2$
          (raise
           "ELF Binary: Mismatch between number of sections and string-section-index. ~
     Strings could not be read. ~%")
          nil))
        (headers
            (read-section-headers nsections w section-header-bytes nil))
        (string-section-data
             (get-string-section-data string-section-index
                                      headers file-byte-list))
        (updated-headers
             (read-section-names headers string-section-data nil)))
       updated-headers)))

    Theorem: elf-section-headers-p-of-get-named-section-headers

    (defthm elf-section-headers-p-of-get-named-section-headers
      (b* ((new-sections
                (get-named-section-headers elf-header file-byte-list)))
        (elf-section-headers-p new-sections))
      :rule-classes :rewrite)