Граф коммитов

61 Коммитов

Автор SHA1 Сообщение Дата
Mike Hommey 200194bccd Bug 725231 - Stop reporting library mappings to the crash reporter. r=snorp
This is a rebase of a 7-year-old patch that was r=taras. Back then it
was waiting for breakpad changes that never were reviewed. However,
since then, bug 1486524 made the linker always map uncompressed files
directly, making it less necessary to report the library mappings to
the crash reporter, and bug 1291377 disabled the linker altogether on
Android 6.0+, which makes report_mapping unused at all in that case.

Differential Revision: https://phabricator.services.mozilla.com/D81025
2020-07-06 14:38:29 +00:00
Sylvestre Ledru e226046cb8 Bug 1547143 - Format the tree: Be prescriptive with the pointer style (left) r=Ehsan
# ignore-this-changeset

Depends on D28954

Differential Revision: https://phabricator.services.mozilla.com/D28956

--HG--
extra : moz-landing-system : lando
2019-05-01 08:47:10 +00:00
Cameron McCormack eedb6aebd4 Bug 1538081 - Part 3: Add operator<<(ostream&) definitions for a few common types. r=froydnj,gerald
Depends on D25023

Differential Revision: https://phabricator.services.mozilla.com/D25024

--HG--
extra : moz-landing-system : lando
2019-03-30 04:26:26 +00:00
Ehsan Akhgari e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Nathan Froyd 1dba87fe96 Bug 1448029 - make constructors in the linker explicit; r=glandium
Attempting to stand up the static analysis for Android builds revealed
that we weren't being explicit enough.
2018-03-27 10:51:32 -04:00
Mike Hommey 8022e9e91e Bug 1376704 - Remove szip support in the linker. r=snorp
Since bug 1307886, we don't actually use szip anymore, and don't even
have the option to package Fennec using it. We can thus remove the
support for loading them, as well as on demand linkage.

The latter might mean we can remove the segfault handler, but it's
unclear whether this is currently working around other issues with
registering signal handlers, so we'll leave that to a followup.

--HG--
extra : rebase_source : ec23cd4e78f259a70f6690adc8dfabb557e8f304
2017-06-28 15:47:31 +09:00
Jim Chen f5f1f202b1 Bug 1360321 - 4a. Fix printf macro mismatches in mozglue; r=froydnj r=glandium
Fix printf macro mismatches where, for example, `PRIxPTR` is defined for
`long` but the ELF `Addr` type is defined as `long long`.

MozReview-Commit-ID: 8hXY1MpHPjS
2017-05-17 13:06:22 -04:00
Tom Tromey f6321565d2 Bug 1060419 - convert mozglue/linker to use the mfbt-provided printf format defines, r=froydnj
MozReview-Commit-ID: LW6eDUxWXrp

--HG--
extra : rebase_source : 1d06ec765b30201f6cfc427006fa56384a61b38b
2016-12-14 14:22:49 -07:00
Eugen Sawin 73f2949cad Bug 1309708 - [1.2] Delete reported library mapping on close. r=glandium 2016-11-10 15:47:59 +01:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Nathan Froyd 583afa0965 Bug 1207245 - part 3 - switch all uses of mozilla::RefPtr<T> to nsRefPtr<T>; r=ehsan
This commit was generated using the following script, executed at the
top level of a typical source code checkout.

 # Don't modify select files in mfbt/ because it's not worth trying to
 # tease out the dependencies currently.
 #
 # Don't modify anything in media/gmp-clearkey/0.1/ because those files
 # use their own RefPtr, defined in their own RefCounted.h.
find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    grep -v 'mfbt/RefPtr.h' | \
    grep -v 'mfbt/nsRefPtr.h' | \
    grep -v 'mfbt/RefCounted.h' | \
    grep -v 'media/gmp-clearkey/0.1/' | \
    xargs perl -p -i -e '
 s/mozilla::RefPtr/nsRefPtr/g; # handle declarations in headers
 s/\bRefPtr</nsRefPtr</g; # handle local variables in functions
 s#mozilla/RefPtr.h#mozilla/nsRefPtr.h#; # handle #includes
 s#mfbt/RefPtr.h#mfbt/nsRefPtr.h#;       # handle strange #includes
'

 # |using mozilla::RefPtr;| is OK; |using nsRefPtr;| is invalid syntax.
find . -name '*.cpp' -o -name '*.mm' | xargs sed -i -e '/using nsRefPtr/d'

 # RefPtr.h used |byRef| for dealing with COM-style outparams.
 # nsRefPtr.h uses |getter_AddRefs|.
 # Fixup that mismatch.
find . -name '*.cpp' -o -name '*.h'| \
    xargs perl -p -i -e 's/byRef/getter_AddRefs/g'
2015-10-18 00:40:10 -04:00
Nathan Froyd 974d8120f2 Bug 1161627 - part 2 - machine-convert TemporaryRef<T> to already_AddRefed<T>; r=ehsan
This conversion was done with the script:

  find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl' | \
    egrep -v 'cairo-win32-refptr.h|RefPtr.h|TestRefPtr.cpp' | \
    xargs sed -i -e 's/mozilla::TemporaryRef</already_AddRefed</g' \
                 -e 's/TemporaryRef</already_AddRefed</g'

Manual fixups were performed in the following instances:

- We handled mfbt/RefPtr.h manually so as to not convert TemporaryRef itself
  into already_AddRefed.

- The following files had explicit Move() calls added to make up for the lack
  of a copy constructor on already_AddRefed:

  dom/base/ImageEncoder.cpp
  dom/media/MediaTaskQueue.{h,cpp}
  dom/media/webaudio/PannerNode.cpp

- A redundant overload for MediaTaskQueue::Dispatch was deleted.

- A few manual fixups were required in mfbt/tests/TestRefPtr.cpp.

- Comments, using declarations, and forward declarations relating to
  TemporaryRef in dom/canvas/ and gfx/layers/ were changed to refer to
  already_AddRefed.
2015-06-17 10:00:52 -04:00
Nathan Froyd db188ea282 Bug 1160485 - remove implicit conversion from RefPtr<T> to TemporaryRef<T>; r=ehsan
Having this implicit conversion means that we can silently do extra
refcounting when it's completely unnecessary.  It's also an obstacle to
making RefPtr more nsRefPtr-like, so let's get rid of it.
2015-05-01 09:14:16 -04:00
Mike Hommey 9c53800a82 Bug 1081034 part 2 - Move initialization of self_elf to its own separate class. r=nfroyd
The new class is kind of like SystemElf, but using our linker's own symbol
resolution. This also adds some initialization from ELF program headers that
weren't done previously for self_elf, as well as registration as for CustomElf
instances.
2014-10-16 09:20:06 +09:00
Mike Hommey 85b47df0cb Bug 1081034 part 1 - Move GetSymbolPtr, Contains and FindExidx from CustomElf to BaseElf. r=nfroyd 2014-10-16 09:19:46 +09:00
Mike Hommey 84f2c13cef Bug 1078837 part 2 - Replace IsSystemElf/reinterpret_cast dance with better API. r=nfroyd 2014-10-16 09:19:45 +09:00
Mike Hommey eb89afceec Bug 1083020 - Add a (dummy) stats method to all LibHandles. r=nfroyd
While here, avoid doing anything if debug logging is disabled.
2014-10-16 09:19:40 +09:00
Mike Hommey 35f933f139 Bug 1080342 - Change how the symbols the flash plugin uses are hooked on Android. r=snorp
With bug 1077366, the linker makes the library containing it a fake
LD_PRELOAD. As a consequence, instead of, in the linker itself,
explicitely special-casing the symbols that disappeared in Android 4.4
that the flash plugin uses, it is now possible to use normal symbol
resolution to stubs defined separately in libmozglue.
2014-10-14 07:18:01 +09:00
Mike Hommey 464da0f9c2 Bug 1077384 - Make libmozglue a pseudo-LD_PRELOAD on android. r=nfroyd
In order to avoid adding more dlsym overhead than there already is, resolve
symbols directly in the library containing the linker. (GetSymbolPtr is
essentially free ; dlsym makes the system linker compule a ElfHash itself,
and that's quite expensive to do on all symbols)

This also paves the way for direct symbol resolution in all system libraries.
2014-10-07 07:42:18 +09:00
Mike Hommey 1cf20f37fd Bug 1036286 - Ensure faulty.lib diverts libc's sigaction instead of a LD_PRELOADed one. r=nfroyd
and force-send calls to sigaction from faulty.lib-loaded libraries to the libc.
2014-08-07 02:51:20 +09:00
Mike Hommey 8c39460da9 Backout changeset 34235900c3a0 (bug 1036286) because it wasn't the right fix. 2014-08-05 16:07:06 +09:00
Mike Hommey 1e14ec2f14 Bug 1036286 - Make sure libraries loaded by faulty.lib use its own sigaction. r=nfroyd
Android L added a libsigchain library it LD_PRELOADs. That library exposes
a different sigaction than libc's. It's used for ART.

faulty.lib gets its sigaction from libsigchain, but after bug 874708, the
libraries it loads simply use libc's sigaction, assuming it would be the
hooked one. In turn, this means libraries loaded by faulty.lib may
override faulty.lib's handler, which is definitely not the intent.

This essentially restores some of the code that bug 874708 removed.

An alternative fix would be to add support for LD_PRELOAD, but that has more
implications and feels more risky. This could be done, if necessary, as a
followup.
2014-07-24 13:43:56 +09:00
Mike Hommey f358f3711f Bug 1024248 - Properly tag linker error/warnings in logcat. r=nfroyd 2014-06-13 08:45:58 +09:00
Mike Hommey 81d8ff07e9 Bug 956398 - Only support text relocations for libflashplayer.so. r=nfroyd 2014-01-25 07:59:14 +09:00
Mike Hommey ec7b1e070a Bug 956398 - Support text relocations in the custom linker. r=nfroyd 2014-01-16 09:13:42 +09:00
James Willcox 8cb44b437e Bug 935676 - Stub out missing Flash symbols r=glandium
--HG--
extra : rebase_source : 7e02a6283a6ee53b3749e1816d4005b238085954
2014-01-15 09:16:33 -06:00
Birunthan Mohanathas c01f63b478 Bug 784739 - Switch from NULL to nullptr in mozglue/linker/; r=ehsan 2013-11-11 14:15:46 -05:00
Jim Chen 9705613071 Bug 930627 - Implement __gnu_Unwind_Find_exidx in custom linker on ARM. r=glandium 2013-10-31 11:40:32 -04:00
Mike Hommey 078b980b8d Bug 894829 - Avoid symbol resolution for relocations for the same symbol in faulty.lib. r=nfroyd 2013-07-23 07:26:08 +09:00
Mike Hommey abaa52c443 Bug 882608 - Fix various issues in faulty.lib with incomplete pages and MOZ_LINKER_ONDEMAND=0. r=nfroyd 2013-07-23 07:26:07 +09:00
Mike Hommey fc82c0f523 Bug 886730 - Add and use a MemoryRange class and helper functions for page alignment in faulty.lib. r=nfroyd 2013-06-27 09:35:49 +09:00
Mike Hommey c7c836946d Bug 886722 - Rename log/debug to LOG/DEBUG_LOG in faulty.lib. r=nfroyd 2013-06-27 09:35:49 +09:00
Mike Hommey 6d626eb6a0 Bug 885336 - Fix various issues with the dl_mmap interface. r=nfroyd 2013-06-27 09:35:48 +09:00
Mike Hommey 7a3c231b71 Bug 874708 - Hook libc's sigaction to avoid system libraries replacing our segfault handler temporarily and restoring it wrongly. r=nfroyd 2013-06-09 09:23:03 +02:00
Mike Hommey 48e758d56b Bug 875824 - Allow to disable on-demand decompression at runtime. r=sewardj 2013-05-29 16:18:27 +02:00
Mike Hommey 1cb6364a2e Bug 802240 - Expose an API to mmap the underlying file for a library loaded by faulty.lib. r=nfroyd 2013-04-12 10:23:12 +02:00
Kartikaya Gupta dd7a85d6a7 Bug 837551 - Ignore dynamic section headers of type DT_FLAGS_1. r=glandium 2013-02-04 09:58:54 -05:00
Mike Hommey 9446203c4a Bug 834459 - Specialize RefCounted template for LibHandle to better allow refcounting during destructor execution. r=nfroyd 2013-01-29 09:35:32 +01:00
Mike Hommey ccee4c2c0e Bug 830326 - Get rid of warnings in the custom linker code. r=nfroyd 2013-01-15 10:12:56 +01:00
Mike Hommey 77cfb9f1b0 Bug 830295 - Avoid RefPtr<LibHandle> triggering recursive calls to ~CustomElf, and use it in the linker segfault handler. r=nfroyd 2013-01-15 10:12:36 +01:00
Mike Hommey 11eafddbc8 Bug 826178 - Prefix all hexadecimal values with 0x in linker logs. r=nfroyd 2013-01-03 16:45:57 +01:00
Jim Chen a59d04549c Bug 824715 - Correctly calculate next page offset in custom linker; r=glandium 2013-01-01 21:44:04 -05:00
Josh Matthews f6cc129ce8 Backed out changeset 10b47593c4d7 (bug 824715) 2012-12-28 19:03:50 -05:00
Jim Chen e4b89b0500 Bug 824715 - Correctly calculate next page offset in custom linker; r=glandium 2012-12-28 15:29:44 -05:00
Mike Hommey a716e0afd3 Bug 772886 - Avoid failure to mmap some library segments on some armv6 devices. r=nfroyd 2012-07-14 10:54:22 +02:00
Mike Hommey c60b51ef30 Bug 735278 - Call destructors in reverse order of initializers in the linker. r=froydnj 2012-06-07 10:41:59 +02:00
Mike Hommey 2967371558 Bug 747033 - Implement dl_iterate_phdr in the custom linker. r=froydnj
--HG--
rename : mozglue/linker/CustomElf.h => mozglue/linker/Elfxx.h
2012-04-25 09:05:02 +02:00
Mike Hommey b00b3342a2 Bug 727959 - Ignore 0xffffffff entries the x86 Android NDK puts in .{init,fini}_array. r=tglek 2012-03-14 10:53:21 +01:00
Mike Hommey b3973a5b27 Bug 734812 - Make the linker error out when text relocations are defined with DF_TEXTREL. r=nfroyd 2012-03-13 09:48:20 +01:00