import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,19 @@
:mod:`macholib.MachO` --- Utilities for reading and writing Mach-O headers
==========================================================================
.. module:: macholib.MachO
:synopsis: Utilities for reading and writing Mach-O headers
This module defines a class :class:`Macho`, which enables reading
and writing the Mach-O header of an executable file or dynamic
library on MacOS X.
.. class:: MachO(filename)
Creates a MachO object by reading the Mach-O headers from
*filename*.
The *filename* should refer to an existing file in Mach-O
format, and can refer to fat (universal) binaries.
.. note:: more information will be added later

View file

@ -0,0 +1,14 @@
:mod:`macholib.MachoGraph` --- Graph data structure of Mach-O dependencies
===============================================================================
.. module:: macholib.MachOGraph
:synopsis: Graph data structure of Mach-O dependencies
This module defines the class :class:`MachOGraph` which represents the
direct and indirect dependencies of one or more Mach-O files on
other (library) files.
.. class:: MachOGraph(...)
To be discussed.

View file

@ -0,0 +1,13 @@
:mod:`macholib.MachOStandalone` --- Create standalone application bundles
==========================================================================
.. module:: macholib.MachOStandalone
:synopsis: Create standalone application bundles
This module defines class :class:`MachOStandalone` which locates
all Mach-O files in a directory (assumed to be the root of an
application or plugin bundle) and then copies all non-system
dependencies for the located files into the bundle.
.. class:: MachOStandalone(base[, dest[, graph[, env[, executable_path]]]])

View file

@ -0,0 +1,24 @@
:mod:`macholib.SymbolTable` --- Class to read the symbol table from a Mach-O header
===================================================================================
.. module:: macholib.SymbolTable
:synopsis: Class to read the symbol table from a Mach-O header
This module is deprecated because it is not by the author
and likely contains bugs. It also does not work for 64-bit binaries.
.. class:: SymbolTable(macho[, openfile])
Reads the SymbolTable for the given Mach-O object.
The option argument *openfile* specifies the
function to use to open the file, defaulting to
the builtin :func:`open` function.
.. warning:: As far as we know this class is not used
by any user of the modulegraph package, and the code
has not been updated after the initial implementation.
The end result of this is that the code does not
support 64-bit code at all and likely doesn't work
properly for 32-bit code as well.

View file

@ -0,0 +1,242 @@
Release history
===============
macholib 1.7
------------
* Added support for ARM64, LC_ENCRYPTION_INFO_64 and LC_LINKER_OPTION
Patch by Matthias Ringwald.
* Load commands now have a "describe" method that returns more information
about the command.
Patch by David Dorsey.
* The MAGIC value in the header was always represented in the native
byte order, instead of as the value read from the binary.
Patch by David Dorsey.
* Added various new constants to "macholib.mach_o".
Patch by David Dorsey.
macholib 1.6.1
--------------
* ?
macholib 1.6
------------
* Add support for '@loader_path' link command in
macholib.dyld:
- Added function ``macholib.dyld.dyld_loader_search``
- This function is used by ``macholib.dyld.dyld_find``,
and that function now has an new (optional) argument
with the path to the loader.
* Also add support for '@loader_path' to macholib.MachoGraph,
using the newly added '@loader_path' support in the
dyld module.
Due to this suppport the *macho_standalone* tool can
now rewrite binaries that contain an '@loader_path' load
command.
macholib 1.5.2
--------------
* Issue #93: Show the name of the affected file in the exception message
for Mach-O headers that are too large to relocate.
macholib 1.5.1
--------------
* There were no 'classifiers' in the package metadata due to
a bug in setup.py.
macholib 1.5
--------------
macholib 1.5 is a minor feature release
* No longer use 2to3 to provide Python 3 support
As a side-effect of this macholib no longer supports
Python 2.5 and earlier.
* Adds suppport for some new macho load commands
* Fix for py3k problem in macho_standalone.py
Patch by Guanqun Lu.
* Fix for some issues in macho_dump.py
Patch by Nam Nguyen
* Issue #10: Fix for LC_DATA_IN_CODE linker commands, without
this fix py2app cannot build application bundles when
the source binaries have been compiled with Xcode 4.5.
* Issue #6: Fix for LC_ENCRYPTION_INFO linker commands
* Use the mach header information to print the cpu type of a
binary, instead of trying to deduce that from pointer width
and endianness.
Changed the code because of issue #6, in which a user tries to
dump a iOS binary which results in bogus output in the previous
releases.
* The mapping ``macholib.macho_dump.ARCH_MAP`` is undocumented
and no longer used by macholib itself. It will be removed
in the next release.
* The command-line tools ``macho_find``, ``macho_dump`` and
``macho_standalone`` are deprecated. Use "python -mmacholib"
instead. That is::
$ python -mmacholib dump /usr/bin/grep
$ python -mmacholib find ~
$ python -mmacholib standalone myapp.app
This makes it clearer which version of the tools are used.
macholib 1.4.3
--------------
macholib 1.4.3 is a minor feature release
* Added strings for 'x86_64' and 'ppc64' to
macholib.mach_o.CPU_TYPE_NAMES.
* macho_find and macho_dump were broken in the 1.4.2 release
* added 'macholib.util.NOT_SYSTEM_FILES', a list of
files that aren't system path's even though they are
located in system locations.
Needed to work around a bug in PySide (see issue #32 in the
py2app tracker)
macholib 1.4.2
--------------
macholib 1.4.2 is a minor bugfix release
* The support for new load commands that was added in 1.4.1
contained a typo that caused problems on OSX 10.7 (Lion).
macholib 1.4.1
--------------
macholib 1.4.1 is a minor feature release
Features:
- Add support for a number of new MachO load commands that were added
during the lifetime of OSX 10.6: ``LC_LOAD_UPWARD_DYLIB``,
``LC_VERSION_MIN_MACOSX``, ``LC_VERSION_MIN_IPHONEOS`` and
``LC_FUNCTION_STARTS``.
macholib 1.4
-------------
macholib 1.4 is a feature release
Features:
- Documentation is now generated using `sphinx <http://pypi.python.org/pypi/sphinx>`_
and can be viewed at <http://packages.python.org/macholib>.
- The repository has moved to bitbucket
- There now is a testsuite
- Private functionality inside modules was renamed to
a name starting with an underscore.
.. note:: if this change affects your code you are relying on undefined
implementation features, please stop using private functions.
- The basic packable types in ``macholib.ptypes`` were renamed to better
represent the corresponding C type. The table below lists the old
an new names (the old names are still available, but are deprecated and
will be removed in a future release).
+--------------+--------------+
| **Old name** | **New name** |
+==============+==============+
| p_byte | p_int8 |
+--------------+--------------+
| p_ubyte | p_uint8 |
+--------------+--------------+
| p_short | p_int16 |
+--------------+--------------+
| p_ushort | p_uint16 |
+--------------+--------------+
| p_int | p_int32 |
+--------------+--------------+
| p_uint | p_uint32 |
+--------------+--------------+
| p_long | p_int32 |
+--------------+--------------+
| p_ulong | p_uint32 |
+--------------+--------------+
| p_longlong | p_int64 |
+--------------+--------------+
| p_ulonglong | p_uint64 |
+--------------+--------------+
``Macholib.ptypes.p_ptr`` is no longer present as it had an unclear
definition and isn't actually used in the codebase.
Bug fixes:
- The semantics of ``dyld.dyld_default_search`` were changed a bit,
it now first searches the framework path (if appropriate) and then
the linker path, irrespective of the value of the ``DYLD_FALLBACK*``
environment variables.
Previous versions would change the search order when those variables
was set, which is odd and doesn't correspond with the documented
behaviour of the system dyld.
- It is once again possible to install using python2.5
- The source distribution includes all files, this was broken
due to the switch to mercurial (which confused setuptools)
macholib 1.3
------------
macholib 1.3 is a feature release.
Features:
- Experimental Python 3.x support
This version contains lightly tested support for Python 3.
macholib 1.2.2
--------------
macholib 1.2.2 is a bugfix release.
Bug fixes:
- Macholib should work better with 64-bit code
(patch by Marc-Antoine Parent)

View file

@ -0,0 +1,159 @@
:mod:`macholib.dyld` --- Dyld emulation
=======================================
.. module:: macholib.dyld
:synopsis: Emulation of functonality of the dynamic linker
This module defines a number of functions that can be used
to emulate the functionality of the dynamic linker (``dyld``)
w.r.t. looking for library files and framworks.
.. function:: dyld_image_suffix([env])
Looks up the suffix to append to shared library and
framework names and returns this value when found.
Returns ``None`` when no suffix should be appended.
The *env* argument is a dictionary, which defaults
to :data:`os.environ`.
See the description of ``DYLD_IMAGE_SUFFIX`` in the
manual page for dyld(1) for more information.
.. function:: dydl_framework_path([env])
Returns a user-specified framework search path,
or an empty list when only the default search path
should be used.
The *env* argument is a dictionary, which defaults
to :data:`os.environ`.
See the description of ``DYLD_FRAMEWORK_PATH`` in the
manual page for dyld(1) for more information.
.. function:: dyld_library_path([env])
Returns a user-specified library search path,
or an empty list when only the default search path
should be used.
The *env* argument is a dictionary, which defaults
to :data:`os.environ`.
See the description of ``DYLD_LIBRARY_PATH`` in the
manual page for dyld(1) for more information.
.. function:: dyld_fallback_framework_path([env])
Return a user specified list of of directories where
to look for frameworks that aren't in their install path,
or an empty list when the default fallback path should
be used.
The *env* argument is a dictionary, which defaults
to :data:`os.environ`.
See the description of ``DYLD_FALLBACK_FRAMEWORK_PATH`` in the
manual page for dyld(1) for more information.
.. function:: dyld_fallback_library_path([env])
Return a user specified list of of directories where
to look for libraries that aren't in their install path,
or an empty list when the default fallback path should
be used.
The *env* argument is a dictionary, which defaults
to :data:`os.environ`.
See the description of ``DYLD_FALLBACK_LIBRARY_PATH`` in the
manual page for dyld(1) for more information.
.. function:: dyld_image_suffix_search(iterator[, env])
Yields all items in *iterator*, and prepents names
with the image suffix to those items when the suffix
is specified.
The *env* argument is a dictionary, which defaults
to :data:`os.environ`.
.. function:: dyld_override_search(name[, env])
If *name* is a framework name yield filesystem
paths relative to the entries in the framework
search path.
Always yield the filesystem paths relative to the
entries in the library search path.
The *env* argument is a dictionary, which defaults
to :data:`os.environ`.
.. function:: dyld_executable_path_search(name, executable_path)
If *name* is a path starting with ``@executable_path/`` yield
the path relative to the specified *executable_path*.
If *executable_path* is None nothing is yielded.
.. function:: dyld_loader_search(name, loader_path)
If *name* is a path starting with ``@loader_path/`` yield
the path relative to the specified *loader_path*.
If *loader_path* is None nothing is yielded.
.. versionadded: 1.6
.. function:: dyld_default_search(name[, env])
Yield the filesystem locations to look for a dynamic
library or framework using the default locations
used by the system dynamic linker.
This function will look in ``~/Library/Frameworks``
for frameworks, even though the system dynamic linker
doesn't.
The *env* argument is a dictionary, which defaults
to :data:`os.environ`.
.. function:: dyld_find(name[, executable_path[, env [, loader]]])
Returns the path of the requested dynamic library,
raises :exc:`ValueError` when the library cannot be found.
This function searches for the library in the same
locations and de system dynamic linker.
The *executable_path* should be the filesystem path
of the executable to which the library is linked (either
directly or indirectly).
The *env* argument is a dictionary, which defaults
to :data:`os.environ`.
The *loader_path* argument is an optional filesystem path for
the object file (binary of shared library) that references
*name*.
.. versionchanged:: 1.6
Added the *loader_path* argument.
.. function:: framework_find(fn[, executable_path[, env]])
Find a framework using the same semantics as the
system dynamic linker, but will accept looser names
than the system linker.
This function will return a correct result for input
values like:
* Python
* Python.framework
* Python.framework/Versions/Current

View file

@ -0,0 +1,33 @@
:mod:`macholib.dylib` --- Generic dylib path manipulation
=========================================================
.. module:: macholib.dylib
:synopsis: Generic dylib path manipulation
This module defines a function :func:`dylib_info` that can extract
useful information from the name of a dynamic library.
.. function:: dylib_info(filename)
A dylib name can take one of the following four forms:
* ``Location/Name.SomeVersion_Suffix.dylib``
* ``Location/Name.SomeVersion.dylib``
* ``Location/Name_Suffix.dylib``
* ``Location/Name.dylib``
Returns None if not found or a mapping equivalent to::
dict(
location='Location',
name='Name.SomeVersion_Suffix.dylib',
shortname='Name',
version='SomeVersion',
suffix='Suffix',
)
.. note:: *SomeVersion* and *Suffix* are optional and my be ``None``
if not present.

View file

@ -0,0 +1,34 @@
:mod:`macholib.framework` --- Generic framework path manipulation
==========================================================================
.. module:: macholib.framework
:synopsis: Generic framework path manipulation
This module defines a function :func:`framework_info` that can extract
useful information from the name of a dynamic library in a framework.
.. function:: framework_info(filename)
A framework name can take one of the following four forms:
* ``Location/Name.framework/Versions/SomeVersion/Name_Suffix``
* ``Location/Name.framework/Versions/SomeVersion/Name``
* ``Location/Name.framework/Name_Suffix``
* ``Location/Name.framework/Name``
Returns ``None`` if not found, or a mapping equivalent to::
dict(
location='Location',
name='Name.framework/Versions/SomeVersion/Name_Suffix',
shortname='Name',
version='SomeVersion',
suffix='Suffix',
)
.. note:: *SomeVersion* and *Suffix* are optional and may be None
if not present.

View file

@ -0,0 +1,59 @@
Macholib - Analyze and edit Mach-O headers
==========================================
macholib can be used to analyze and edit Mach-O headers, the executable
format used by Mac OS X.
It's typically used as a dependency analysis tool, and also to rewrite dylib
references in Mach-O headers to be ``@executable_path`` relative.
Though this tool targets a platform specific file format, it is pure python
code that is platform and endian independent.
General documentation
---------------------
.. toctree::
:maxdepth: 1
changelog
license
scripts
Reference Guide
---------------
.. toctree::
:maxdepth: 1
MachO
MachoOGraph
MachoOStandalone
SymbolTable
dyld
dylib
framework
macho_o
ptypes
Online Resources
----------------
* `Sourcecode repository on bitbucket <http://bitbucket.org/ronaldoussoren/macholib/>`_
* `The issue tracker <http://bitbucket.org/ronaldoussoren/macholib/issues>`_
* `Mac OS X ABI Mach-O File Format Reference at Apple <http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html>`_
Contributors
------------
Macholib was written by Bob Ippolito and is currently maintained by Ronald Oussoren <ronaldoussoren@mac.com>.
Indices and tables
------------------
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View file

@ -0,0 +1,23 @@
License
=======
Copyright (c) Bob Ippolito
Parts are copyright (c) 2010-2014 Ronald Oussoren
MIT License
...........
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
so.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -0,0 +1,13 @@
:mod:`macholib.mach_o` --- Low-level definitions
================================================
.. module:: macholib.mach_o
:synopsis: Low-level definitions of elements in a Mach-O file
This module defines constants and packable structure types
that correspond to elements of a Mach-O file.
The names of classes and constants is the same as those in
the Mach-O header files and
`Apple's documentation <http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html>`_. This document therefore
doesn't explictly document the names in this module.

View file

@ -0,0 +1,157 @@
:mod:`macholib.ptypes` --- Packable types
=========================================
.. module:: macholib.ptypes
:synopsis: Serializable types
The module :mod:`macholib.ptypes` defines types that can be serialized into
byte arrays, both for basic types and structured types (C ``struct`` values).
Utility functions
-----------------
.. function:: sizeof(value)
Returns the size in bytes of an object when packed, raises :exc:`ValueError`
for inappropriate values.
.. function:: pypackable(name, pytype, format)
Returns a packable type that is a subclass of the Python type
*pytype*. The value is converted to and from the packed format using
the struct *format*.
Packable types
--------------
.. class:: BasePackable
All packable types are a subclass of :class:`BasePackable`, which defines
the basic interface but is itself an abstract base class.
.. data:: _endian_
The byteorder of a packed value. This will be ``"<"` for
little endian values and ``">"`` for big-endian ones.
.. note:: the endianness option is a public value to be
able to support both big- and little-endian file formats.
The name suggests that this attribute is private, this
is partically for historical reasons and partially to
avoid conflicts with field names in C structs.
.. method:: from_mmap(mmap, ptr, \**kw)
This class method constructs the value from a subview of a
:class:`mmap.mmap` object. It uses bytes starting at offset *ptr* and
reads just enough bytes to read the entire object.
.. method:: from_fileobj(fp, \**kw)
This class method constructs the value by reading just enough bytes
from a file-like object.
.. note:: The file must be opened in binary mode, that is read calls
should return byte-strings and not unicode-strings.
.. method:: from_str(value, \**kw)
This class method construct the value by using the struct module
to parse the given bytes.
.. note:: contrary to what the name suggests the argument to this
method is a byte-string, not a unicode-string.
.. method:: from_tuple(fp, \**kw)
This class method constructs the object from a tuple with all fields.
.. method:: to_str()
Returns a byte representation of the value.
.. note:: there is no default implementation for this method
.. method:: to_fileobj(fp)
Write a byte representation of the value to the given file-like
object. The file should be opened in binary mode.
.. method:: to_mmap(mmap, ptr)
Write the byte representation of the value to a :class:`mmap.mmap`
object, starting at offset *ptr*.
.. class:: Structure(...)
.. data:: _fields_
This class attribute is a list that contains the fields of the
structure in the right order. Every item of this list is a tuple
with 2 arguments: the first element is the name of the field, and
the second the packable type for the field.
Every subclass of :class:`Structure` must define *_fields_* to be
usefull, and the value of *_fields_* should not be changed after
class construction.
Basic packables
---------------
Other than the core functionality this module defines a number of
:func:`pypackable` types that correspond to useful basic C types.
.. class:: p_char([value])
A byte string of length 1
.. class:: p_int8
An 8-bit signed integer
.. class:: p_uint8
An 8-bit unsigned integer
.. class:: p_int16
An 16-bit signed integer
.. class:: p_uint16
An 16-bit unsigned integer
.. class:: p_int32
An 32-bit signed integer
.. class:: p_uint32
An 32-bit unsigned integer
.. class:: p_int64
An 64-bit signed integer
.. class:: p_uint64
An 64-bit unsigned integer
.. class:: p_float
An floating point value of type ``float``
.. class:: p_double
An floating point value of type ``double``
.. note:: the module exports a number of other types with
names starting with ``p_``, such as ``p_int``. Those types
are deprecated and should not be used.

View file

@ -0,0 +1,35 @@
Command-line tools
==================
python -m macholib find
-----------------------
Usage::
$ python -mmacholib find dir...
Print the paths of all MachO binaries
in the specified directories.
python -m macholib standalone
-----------------------------
Usage::
$ python -m macholib standalone appbundle...
Convert one or more application bundles into
standalone bundles. That is, copy all non-system
shared libraries and frameworks used by the bundle
into the bundle and rewrite load commands.
python -mmacholib dump
----------------------
Usage::
$ python -mmacholib dump dir...
Prints information about all architectures in a
Mach-O file as well as all libraries it links
to.