• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • X86isa
      • Axe
      • 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
      • Math
      • Testing-utilities
    • Elf-reader

    Read-section-names

    Get the names of the section headers from the string section table, located at the offset indicated by the sh_offset value of the shstrndxth section

    Signature
    (read-section-names sec-headers string-section-data acc) 
      → 
    new-sec-headers
    Arguments
    sec-headers — Guard (elf-section-headers-p sec-headers).
    string-section-data — Guard (byte-listp string-section-data).
    acc — Guard (elf-section-headers-p acc).
    Returns
    new-sec-headers — Type (elf-section-headers-p new-sec-headers), given (elf-section-headers-p acc).

    Definitions and Theorems

    Function: read-section-names

    (defun read-section-names (sec-headers string-section-data acc)
     (declare (xargs :guard (and (elf-section-headers-p sec-headers)
                                 (byte-listp string-section-data)
                                 (elf-section-headers-p acc))))
     (let ((__function__ 'read-section-names))
      (declare (ignorable __function__))
      (if (atom sec-headers)
          acc
       (b*
        ((section-header (car sec-headers))
         ((elf-section-header section-header))
         (name-str-offset section-header.name)
         ((unless (<= name-str-offset
                      (len string-section-data)))
          (prog2$
           (raise
            "String-section-data's length should be at least ~x0, but it is ~x1 instead!"
            name-str-offset
            (len string-section-data))
           acc))
         (name-str (elf-read-string-null-term
                        string-section-data name-str-offset))
         (new-section-header
              (change-elf-section-header section-header
                                         :name-str name-str)))
        (read-section-names (cdr sec-headers)
                            string-section-data
                            (cons new-section-header acc))))))

    Theorem: elf-section-headers-p-of-read-section-names

    (defthm elf-section-headers-p-of-read-section-names
     (implies
       (elf-section-headers-p acc)
       (b*
        ((new-sec-headers
              (read-section-names sec-headers string-section-data acc)))
        (elf-section-headers-p new-sec-headers)))
     :rule-classes :rewrite)