[Openmcl-cvs-notifications] r14946 - /trunk/source/library/elf.lisp

gb at clozure.com gb at clozure.com
Fri Aug 19 15:56:05 CDT 2011


Author: gb
Date: Fri Aug 19 15:56:05 2011
New Revision: 14946

Log:
Add an empty section named ".gnu.prelink_undo"; the 'perf' profiler uses
the presence of a section with that name to determine that an object
file has been "prelinked", and we basically want it to view a CCL image
(with sections at fixed addresses) that way.

Modified:
    trunk/source/library/elf.lisp

Modified: trunk/source/library/elf.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/library/elf.lisp (original)
+++ trunk/source/library/elf.lisp Fri Aug 19 15:56:05 2011
@@ -374,13 +374,15 @@
          (symbols-section (new-elf-section object))
          (strings-section (new-elf-section object))
          (shstrtab-section (new-elf-section object))
+         (prelink-id-section (new-elf-section object))
          (section-names (make-elf-string-table))
          (lisp-section-index (elf-section-index lisp-section))
          (symbols (register-elf-functions lisp-section-index))
          (lisp-section-header (elf-section-header-for-section object lisp-=
section))
          (symbols-section-header (elf-section-header-for-section object sy=
mbols-section))
          (strings-section-header (elf-section-header-for-section object st=
rings-section))
-         (shstrtab-section-header (elf-section-header-for-section object s=
hstrtab-section)))
+         (shstrtab-section-header (elf-section-header-for-section object s=
hstrtab-section))
+         (prelink-id-section-header (elf-section-header-for-section object=
 prelink-id-section)))
     =

     (setf (pref file-header #+64-bit-target :<E>lf64_<E>hdr.e_shstrndx
                 #+32-bit-target :<E>lf32_<E>hdr.e_shstrndx) (elf-section-i=
ndex shstrtab-section))
@@ -419,10 +421,18 @@
                 #+32-bit-target :<E>lf32_<S>hdr.sh_type) #$SHT_STRTAB
           (pref shstrtab-section-header #+64-bit-target :<E>lf64_<S>hdr.sh=
_flags
                 #+32-bit-target :<E>lf32_<S>hdr.sh_flags) (logior #$SHF_ST=
RINGS #$SHF_ALLOC))
+    ;; The perf profiler recognizes prelinked libraries by the presence of
+    ;; some section with this exact name; it doesn't care about the sectio=
n's
+    ;; contents or other attributes, currently.
+    ;; We want that profiler to treat the lisp section as if it was prelin=
ked.
+    (setf (pref prelink-id-section-header #+64-bit-target :<E>lf64_<S>hdr.=
sh_name
+                #+32-bit-target :<E>lf32_<S>hdr.sh_name) (elf-register-str=
ing ".gnu.prelink_undo" section-names))
+    =

     (elf-make-empty-data-for-section object lisp-section (ash (- (%fixnum-=
ref *readonly-area* target::area.active) (%fixnum-ref *readonly-area* targe=
t::area.low) )target::fixnumshift))
     (elf-init-section-data-from-string-table object strings-section (elf-s=
ymbol-table-strings symbols))
     (elf-init-section-data-from-string-table object shstrtab-section secti=
on-names)
     (elf-init-symbol-section-from-symbol-table object symbols-section symb=
ols)
+    (elf-make-empty-data-for-section object prelink-id-section 0)
     ;; Prepare in-memory data structures.
     (elf-update object #$ELF_C_NULL)
     ;; Fix up the program header.



More information about the Openmcl-cvs-notifications mailing list