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

635 Коммитов

Автор SHA1 Сообщение Дата
Mike Hommey 8bb6a1a03e Bug 1423821 - Add a consistency check for section offsets to elfhack. r=froydnj
lld is being too smart for its own good, and places non-relocatable data
right after the program headers, which prevents the program headers from
growing. But elfhack wasn't checking for that, so happily placed the
non-relocatable data at its non-relocated location, overwriting the last
item of the program headers.

--HG--
extra : rebase_source : 6f26d475f0a19d88ddf21399dbce8ceac62b492d
2017-12-07 15:34:58 +09:00
Mike Hommey ded54a5e92 Bug 1423813 - Properly handle elfhack -r after bug 1385783. r=froydnj
Bug 1385783 changed things such that the two elfhack sections are not
adjacent anymore. They can even be in different segments in some cases,
but the undo code doesn't know how to actually handle that case.

So for now, allow non adjacent sections, but still verify that they are
in the same segment.

--HG--
extra : rebase_source : da95ef7df19eeea8dfd07b24f22e7bee18939b69
2017-12-07 15:22:22 +09:00
Tom Prince 1d74db87ce Bug 1424651: Remove unused SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE mozconfig variable; r=ted.mielczarek
MozReview-Commit-ID: CkIg3fiwp1z

--HG--
extra : rebase_source : 5a4a50c8feb477a9b50c30e35b72a316b1f1bc8c
2017-12-10 23:05:05 -07:00
Dorel Luca 2f271a1136 Backed out 4 changesets (bug 1424651) as requested by tomprice r=backout on a CLOSED TREE
Backed out changeset 10ebf78f32bb (bug 1424651)
Backed out changeset 746d96792d18 (bug 1424651)
Backed out changeset 6038fb7b458c (bug 1424651)
Backed out changeset 189fd4f1df41 (bug 1424651)
2017-12-12 06:33:18 +02:00
Tom Prince 4dfc8f7a46 Bug 1424651: Remove unused SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE mozconfig variable; r=ted.mielczarek
MozReview-Commit-ID: CkIg3fiwp1z

--HG--
extra : rebase_source : 475e2d8888ff4b93efa9886581de9d145b51c51c
2017-12-10 23:05:05 -07:00
Ted Mielczarek 8b7140ce04 bug 1424323 - remove MOZ_AUTOMATION_UPLOAD_SYMBOLS from in-tree mozconfigs. r=rillian
With all of our builds in Taskcluster now, we should never be uploading
symbols from build tasks. Unfortunately Windows builds were still doing so.
This patch removes MOZ_AUTOMATION_UPLOAD_SYMBOLS from all the in-tree
mozconfigs and a few other places so that it should always default off
(per moz-automation.mk). The rest of the uploadsymbols bits will be
removed once Thunderbird fixes their automation.

This patch was mostly autogenerated by running:
rg --files-with-matches UPLOAD_SYMBOLS browser/config/mozconfigs/ mobile/android/config/mozconfigs/ | xargs sed -ri '/.*UPLOAD_SYMBOLS.*/d'
sed -ri '/.*UPLOAD_SYMBOLS.*/d' build/unix/mozconfig.linux build/mozconfig.win-common build/macosx/local-mozconfig.common build/mozconfig.automation

Then mobile/android/config/mozconfigs/common and
taskcluster/scripts/builder/build-linux.sh were hand-edited.

MozReview-Commit-ID: Cy8kSEodSg4

--HG--
extra : rebase_source : 01caf1651b4eb428313e1f371aa585f8f34c4151
2017-12-08 13:50:17 -05:00
Mike Hommey 9ec14dddcb Bug 1417689 - Remove explicit --enable-elf-hack in mozconfigs. r=nalexander
--enable-elf-hack is the default on all platforms where it's supported,
and is completely ignored on platforms where it's not supported.
While moving the flag to moz.configure, we're going to make it only
work on platforms where elfhack is supported, so we at least need to
remove it from mozconfigs for those platforms where it's not supported.
But generally speaking, we want less things in mozconfigs, so just
remove it from there, since it's the default anyways.
2017-11-16 09:37:17 +09:00
Chris Manchester fb88a7e614 Bug 1407388 - Remove build/unix/elfhack/inject/Makefile.in and replace with generated files. r=mshal
MozReview-Commit-ID: Cr2RUlksKBJ

--HG--
extra : rebase_source : 03f32e52d754d29a23e774707b6f92e265bf3ce0
2017-11-07 16:54:22 -08:00
Nathan Froyd bce27af988 Bug 1163171 - part 2 - switch to using -isystem rather than -idirafter for Android; r=glandium
This command-line flag is a little more evocative and works correctly
with both GCC and clang.
2017-10-28 17:38:59 -04:00
Chris Manchester e361318990 Bug 1403346 - Remove clang plugin flags from stdc++compat through moz.build rather than Makefile.in r=glandium
MozReview-Commit-ID: DuFMdNru2i4
2017-10-25 15:12:10 -07:00
Chris Manchester 3aac6ce692 Bug 1403346 - Implement cflags filtering for elfhack in mozbuild COMPILE_FLAGS r=glandium
MozReview-Commit-ID: GO2mqMjHuHd
2017-10-25 15:12:10 -07:00
Tom Ritter 302cef9ace Bug 1407359 Set up a framework for patching the MinGW toolchain r=glandium
MozReview-Commit-ID: 8HtjLXAIXTP

--HG--
extra : rebase_source : b32cb4ac931c9dc599572bc5e726e4d68982c8a4
2017-10-16 20:52:47 -05:00
Robert-André Mauchin 3d620068f1 Bug 1407211 - Fix typo in build/unix/run-mozilla.sh from bug 1403366. r=glandium 2017-10-12 07:28:20 +09:00
Mike Hommey 37d01456dc Bug 1403366 - Don't set MOZILLA_FIVE_HOME from multiple scripts. r=froydnj
It was seldom used before previous commit and now does nothing.

--HG--
extra : rebase_source : e0b1dcdabe798af478e054cde0df65facf25ea21
2017-09-28 11:00:09 +09:00
Sebastian Hengst 2e58d81866 Backed out changeset ff0705eda4bd (bug 1403366) 2017-10-04 01:26:56 +02:00
Mike Hommey 5f2f5b4e64 Bug 1403366 - Don't set MOZILLA_FIVE_HOME from multiple scripts. r=froydnj
It was seldom used before previous commit and now does nothing.

--HG--
extra : rebase_source : e0b1dcdabe798af478e054cde0df65facf25ea21
2017-09-28 11:00:09 +09:00
Sebastian Hengst 6a0c7a5682 Backed out changeset 28b00bdf83a3 (bug 1403366) 2017-09-29 17:19:35 +02:00
Mike Hommey 8142d74974 Bug 1403366 - Don't set MOZILLA_FIVE_HOME from multiple scripts. r=froydnj
It was seldom used before previous commit and now does nothing.

--HG--
extra : rebase_source : 59ba89dbd8de9c0b9361872f3f45504a46f454a2
2017-09-28 11:00:09 +09:00
Tom Ritter 095b4bfda8 Bug 1330608 Add the MinGW32 toolchain build to Taskcluster r=glandium
MozReview-Commit-ID: JHS6y8kqr4T

--HG--
extra : rebase_source : e04692af64312db7028d4123075e02d8b9127ef2
2017-09-22 00:24:58 -05:00
Mike Hommey 6be61a27e7 Bug 1401005 - Handle the case where the relocation addend is not found at the relocation location. r=froydnj
--HG--
extra : rebase_source : 58c6dfbe9fc584bbbbce2b9739a374a465823b32
2017-09-21 11:37:30 +09:00
Chris Manchester fab07bc443 Bug 1386876 - Replace all uses of NO_VISIBILITY_FLAGS with a template and remove NO_VISIBILITY_FLAGS. r=glandium
MozReview-Commit-ID: 194U1WMCAM0

--HG--
extra : rebase_source : 365b68b0a1772d238ae9b84966e53dcd1197fd85
2017-05-01 18:12:35 -07:00
Chris Manchester c0a229d4c3 Bug 1386876 - Replace all uses of DISABLE_STL_WRAPPING with a template, remove DISABLE_STL_WRAPPING. r=glandium
MozReview-Commit-ID: FMEtb5PY7iP

--HG--
extra : rebase_source : 3cdee7528846462c758e623d6bcd2e6e17dbabff
2017-09-11 11:33:26 -07:00
Mike Hommey a3250ab5f7 Bug 1390752 - Avoid std::basic_ios<char, std::char_traits<char>>::operator bool() references. r=froydnj
This is similar to what we had until bug 1278456 removed them when we dropped
support for older libstdc++, but for a different symbol.

--HG--
extra : rebase_source : 641fc6c86c8f47e3dbd752bc20056f61646541a7
2017-08-16 15:03:43 +09:00
Eugen Sawin c0560f54d7 Bug 1388893 - [1.0] Abort code insertion if executable section was not found. r=glandium 2017-08-15 13:58:41 +02:00
Mike Hommey 733dc0bf95 Bug 1389422 - Avoid @GLIBCXX_3.4.22 symbols from the use of std::thread when building with GCC 6. r=froydnj
That the wrapper implementation works has been verified by creating a
dummy program such as:

  $ cat test.cc
  #include <thread>

  int main() {
    std::thread([]() {
      printf("foo\n");
    }).join();
    return 0;
  }

And compiling it with and without the hack:

  $ g++ -fno-rtti -o test test.cc -lpthread
  $ objdump -TC test | grep UND.*GLIBCXX_3.4.22
  0000000000000000      DF *UND*	0000000000000000  GLIBCXX_3.4.22 std:🧵:_State::~_State()
  0000000000000000      DF *UND*	0000000000000000  GLIBCXX_3.4.22 std:🧵:_M_start_thread(std::unique_ptr<std:🧵:_State, std::default_delete<std:🧵:_State> >, void (*)())

  $ ./test
  foo

  $ g++ -fno-rtti -o test test.cc $objdir/build/unix/stdc++compat/stdc++compat.o -lpthread
  $ objdump -TC test | grep UND.*GLIBCXX_3.4.22
  $ ./test
  foo

--HG--
extra : rebase_source : 53ca8e2d0424eaeb539d50510c441c8a3252c819
2017-08-11 17:20:47 +09:00
Mike Hommey ccd43013f6 Bug 1388713 - Change how elfhack looks for the bss section. r=froydnj
In bug 635961, elfhack was made to (ab)use the bss section as a
temporary space for a pointer. To find it, it scanned writable PT_LOAD
segments to find one that has a different file and memory size,
indicating the presence of .bss. This usually works fine, but when
the binary is linked with lld and relro is enabled, the end of the
file-backed part of the PT_LOAD segment containing the .bss section
ends up in the RELRO segment, making that location read-only and
subsequently making the elfhacked binary crash when it tries to restore
the .bss to a clean state, because it's not actually writing in the .bss
section: lld page aligns it after the RELRO segment.

So instead of scanning PT_LOAD segments, we scan for SHT_NOBITS
sections that are not SHF_TLS (i.e. not .tbss).

--HG--
extra : rebase_source : f18c43897fd0139aa8535f983e13eb785088cb18
2017-08-10 07:55:55 +09:00
Wes Kocher db7d003ae0 Merge m-c to autoland a=merge CLOSED TREE
MozReview-Commit-ID: Ko3lhAvzMJN
2017-08-03 18:22:09 -07:00
Mike Hommey 118fd76cf0 Bug 1356926 - Make all stdc++compat symbols weak. r=froydnj
In some cases, we can end up linking some things with
--static-libstdc++. The notable (only?) example of that is for the
clang-plugin, and that happens because it gets some of its flags from
llvm-config, which contains --static-libstdc++ because clang itself is
built that way.

When that happens, the combination of --static-libstdc++ and
stdc++compat breaks the build because they have conflicting symbols,
which is very much by design.

There are two ways out of this:
- avoiding either -static-libstdc++ or stdc++compat
- work around the symbol conflicts

The former is not totally reliable ; we'd have to accurately determine
if we're in a potentially conflicting case, and remove one of the two in
that case, and while we can do that for the cases we explicitly know
about, that's not future-proof, and might fail just as much in the
future.

So we go with the latter. The way we do this is by defining all the
std++compat symbols weak, such that at link time, they're overridden by
any symbol with the same name. When building with -static-libstdc++,
libstdc++.a provides those symbols so the linker eliminates the weak
ones. When not building with -static-libstdc++, the linker keeps the
symbols from stdc++compat. That last assertion is validated by the
long-standing CHECK_STDCXX test that we run when linking shared
libraries and programs.

That still leaves the symbols weak in the final shared
libraries/programs, which is a change from the current setup, but
shouldn't cause problems because when using versions of libstdc++.so
that do provide those symbols, it's fine to use the libstdc++.so version
anyways.
2017-08-04 06:07:42 +09:00
Mike Hommey 614312f061 Bug 1386588 - Change the GCC build script to be future-proof. r=gps
It becomes a library of some sort, so that multiple scripts can benefit
from it to build different versions of GCC.

The GPG key associated with GCC is also refreshed from keys.gnupg.net,
adding a new subkey, used to sign newer versions of GCC (and
postprocessed with pgpstrip to make it smaller).
2017-08-03 08:12:47 +09:00
Sylvestre Ledru 6e1f2d507b Bug 1385910 - In the error message, also ask to upload the pre-elfhacked library r=froydnj
MozReview-Commit-ID: A7ADGyQunjN

--HG--
extra : rebase_source : fac3410f828871b5b694851f99bdf588b67f0ef8
2017-07-31 16:35:03 +02:00
Mike Hommey 48eba8560c Bug 1385783 - Insert the elfhack code before the first executable section. r=froydnj
The lld linker creates separate segments for purely executable sections
(such as .text) and sections preceding those (such as .rel.dyn). Neither
gold nor bfd ld do that, and just put all those sections in the same
executable segment.

Since elfhack is putting its executable code between the two relocation
sections, it ends up in a non-executable segment, leading to a crash
when it's time to run that code.

We thus insert the elfhack code before the first executable section
instead of between the two relocation sections (which is where the
elfhack data lies, and stays).

--HG--
extra : rebase_source : ab18eb9ac518d69a8639ad0e785741395b662112
2017-08-02 16:39:12 +09:00
Mike Hommey a2b46623f9 Bug 1385783 - Don't assume both elfhack sections are next to each other. r=froydnj
--HG--
extra : rebase_source : 989e0233f5c80c61680ad4578ea6bd835d231655
2017-08-02 16:05:07 +09:00
Cameron McCormack 66d005a1e5 Bug 1385537 - Check for writable segments correctly. r=glandium
MozReview-Commit-ID: FItpvVeiMJM

--HG--
extra : rebase_source : e9eaeba92967c1e839667fb0597fd0cd8a9616a8
2017-07-29 13:56:25 +08:00
Mike Hommey a15c6351cb Bug 1385117 - Make the bss section of the elfhack testcase large enough. r=froydnj
Since bug 635961, building with relro makes elfhack try to use the bss
data for a temporary function pointer. If there is not enough space for
a pointer in the bss, elfhack will complain it couldn't find the bss.

In normal circumstances, this is most likely fine. Libraries with a bss
so small that it can't fit a pointer are already too small to be
elfhacked anyways. In Firefox, the two libraries with the smallest bss
have enough space for two pointers, and aren't elfhacked (libmozgtk.so
and libplds4.so).

However, the testcase that is used during the build to validate that
elfhack works doesn't have a large enough bss on x86-64, making elfhack
bail out, and the build fail as a consequence.

This, in turn, is due to the only non-thread-local zeroed data being an
int, which is not enough to fit a pointer on x86-64. We thus make it a
size_t.

--HG--
extra : rebase_source : bca2ddbf9d4a5e8786881fc524d642c38d610227
2017-07-28 07:15:39 +09:00
Mike Hommey 43b0a30fd0 Bug 635961 - Allow elfhack to relocate data under the GNU_RELRO segment. r=froydnj
--HG--
extra : rebase_source : 873898d5929414b754bf592ab4d60574700b646a
2017-07-11 07:41:07 +09:00
Wes Kocher 5dbd554bdd Backed out 2 changesets (bug 635961) at developer's request a=backout
Backed out changeset c56fa9c1eda0 (bug 635961)
Backed out changeset ddda63d5366e (bug 635961)

MozReview-Commit-ID: I6NxBctFn8e
2017-07-25 17:57:43 -07:00
Mike Hommey 809895d12d Bug 1378986 - Avoid crashing in elfhack when the input file has no relocations. r=me a=bustage
MozReview-Commit-ID: 8jXvB8iRJkC

--HG--
extra : rebase_source : 6b5f24e9bca51d090c5a7c41977e42c513136ec4
2017-07-25 15:50:34 -07:00
Mike Hommey 76cfb9c89f Bug 635961 - Allow elfhack to relocate data under the GNU_RELRO segment. r=froydnj
--HG--
extra : rebase_source : abbb92ee6a8f317fe80af5bf982c93c8b773a42f
2017-07-11 07:41:07 +09:00
Mike Hommey 7e8198e4b7 Bug 1379835 - Don't filter out -idirafter flag when building elfhack injected code. r=gps
--HG--
extra : rebase_source : 4c6eea5ec9c592873ef94cb0c674fc4b26ef385c
2017-07-11 08:02:16 +09:00
Mike Hommey b54839958c Bug 1378986 - Adjust the fake phdr section properly. r=froydnj
The PT_PHDR segment is optional, but the Android toolchain decides to
create one in some cases, and places it first. When that happens, the
work around for bug 1233963 fails, because the fake phdr section has not
been adjusted yet (it only happens when we see a PT_LOAD).

So we adjust the fake phdr section when we see a PT_PHDR segment (and
avoid re-updating it when we see a subsequent PT_LOAD).

--HG--
extra : rebase_source : 2190ec2f20ba9d144b8828874f9f8d70dd5ad2f6
2017-07-07 18:29:06 +09:00
Mike Hommey e6b808292f Bug 1378986 - Avoid elfhack failing on weird DT_INIT_ARRAYs. r=froydnj
Somehow, with the Android toolchain, we end up with
non-empty-but-really-empty DT_INIT_ARRAYs.

In practical terms, they are arrays with no relocations, and content
that is meaningless:

  $ objdump -s -j .init_array libnss3.so

  libnss3.so:     file format elf32-little

  Contents of section .init_array:
   1086e0 00000000                             ....

  $ readelf -r libnss3.so | grep 1086e0

  $ objdump -s -j .init_array libplugin-container-pie.so

  libplugin-container-pie.so:     file format elf32-little

  Contents of section .init_array:
   4479c ffffffff 00000000 ffffffff 00000000  ................

  $ readelf -r libplugin-container-pie.so | grep 4479c

Because so far, elfhack expected meaningful DT_INIT_ARRAYs, it bailed out
early in that case.

--HG--
extra : rebase_source : 217aacb42fdfabb466ed1f8149dfaeb4a595eda8
2017-07-07 14:44:46 +09:00
rforbes 1b11218ff1 Bug 1376968 - Remove obsolete -fsantize-coverage=edge from fuzzing config. r=decoder
MozReview-Commit-ID: IJAoxu9Ovze

--HG--
extra : rebase_source : 5f19fc176360fba47ee0b62250a4fa2605911672
2017-06-28 15:58:42 -07:00
Chris Manchester 479795876a Bug 1370695 - Remove build system code handling binary components. r=glandium
MozReview-Commit-ID: BKHWR34vWsu

--HG--
extra : rebase_source : d870a222d393479bb8ede2aaec571299488806c0
2017-06-13 16:01:45 -07:00
rforbes 3e2112c609 Bug 1359328 - Updates for fuzzing taskcluster build r=aobreja,decoder
MozReview-Commit-ID: 1RDQYnGTE2s

--HG--
extra : rebase_source : 77d2bdd37931d2c324cd07f4d6c7b996c1845a1c
2017-05-25 15:36:21 -07:00
Steve Fink 7e29e4b949 Bug 1339989 - Add --no-build option to build-gcc.sh, r=glandium
--HG--
extra : rebase_source : c642a75ceef62cdcd973ab121fd177de770d1b24
2017-04-17 14:51:17 -07:00
Mike Hommey ecbc3ab66c Bug 1365182 - When both clang and gcc are installed via tooltool, pick libstdc++ from gcc. r=froydnj
--HG--
extra : rebase_source : 7f5eec8e85e34c5249be11daabc466963476f279
2017-05-16 15:09:52 +09:00
Lee Salzman 20ac00c192 Bug 1350262 - implement prime rehash policy compat for unordered_map and unordered_set in libstdc++. r=glandium
MozReview-Commit-ID: 1zlGjRMKcBM
2017-05-09 22:15:18 -04:00
Ting-Yu Chou 337e68fa28 Bug 1333003 part 4 - Package the binary of llvm-symbolizer also on Windows. r=ted
MozReview-Commit-ID: 4nhVgQTJ7Bz

--HG--
extra : rebase_source : 4df3d39da1847ff40927ec3d1f11f76916181a46
2017-03-10 12:24:02 +08:00
Mike Hommey 97164d67cd Bug 1353661 - Don't build elfhack/inject during export. r=mshal
When the clang plugin is used, building something during export needs to
happen after the plugin is built. But there is no dependency ensuring
this happens.

OTOH, these sources in elfhack/inject don't need to be built that early,
so we'll just leave to the build system to build it at a proper time.

--HG--
extra : rebase_source : a6bef8ec6eece3a1b0e45f84c907c2fbc0800863
2017-04-05 18:01:33 +09:00
Wes Kocher 93d11e3441 Backed out 7 changesets (bug 1333003) for windows asan failures a=backout
Backed out changeset 3d2b2eeda8d3 (bug 1333003)
Backed out changeset 400d409ba4ca (bug 1333003)
Backed out changeset 1ba027abdfc9 (bug 1333003)
Backed out changeset 70114135bd8c (bug 1333003)
Backed out changeset 5715b15e33c0 (bug 1333003)
Backed out changeset 375e952bd738 (bug 1333003)
Backed out changeset d5d4112599f2 (bug 1333003)

MozReview-Commit-ID: DZUHJTdjX7V
2017-03-23 11:01:44 -07:00