author | Tom Tromey <tom@tromey.com> |
Wed, 14 Dec 2016 14:22:49 -0700 | |
changeset 343556 | e0e53d202593b66dd0b77623275b214da8570b36 |
parent 343555 | dc2d793bf2770e36c2807d7954b09f1b34d6ea56 |
child 343557 | 1f08f556c880d7afcd297032e7d055339d5ac6ad |
push id | 31381 |
push user | kwierso@gmail.com |
push date | Fri, 17 Feb 2017 20:45:51 +0000 |
treeherder | mozilla-central@f302def88fe5 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | froydnj |
bugs | 1060419 |
milestone | 54.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/mozglue/linker/BaseElf.cpp +++ b/mozglue/linker/BaseElf.cpp @@ -1,15 +1,16 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "BaseElf.h" #include "Elfxx.h" #include "Logging.h" +#include "mozilla/IntegerPrintfMacros.h" #include "mozilla/RefPtr.h" using namespace Elf; using namespace mozilla; unsigned long BaseElf::Hash(const char *symbol) { @@ -179,30 +180,30 @@ LoadedElf::InitDyn(const Phdr *pt_dyn) Array<Dyn> dyns; dyns.InitSize(GetPtr<Dyn>(pt_dyn->p_vaddr), pt_dyn->p_filesz); size_t symnum = 0; for (auto dyn = dyns.begin(); dyn < dyns.end() && dyn->d_tag; ++dyn) { switch (dyn->d_tag) { case DT_HASH: { - DEBUG_LOG("%s 0x%08" PRIxAddr, "DT_HASH", dyn->d_un.d_val); + DEBUG_LOG("%s 0x%08" PRIxPTR, "DT_HASH", dyn->d_un.d_val); const Elf::Word *hash_table_header = \ GetPtr<Elf::Word>(dyn->d_un.d_ptr); symnum = hash_table_header[1]; buckets.Init(&hash_table_header[2], hash_table_header[0]); chains.Init(&*buckets.end()); } break; case DT_STRTAB: - DEBUG_LOG("%s 0x%08" PRIxAddr, "DT_STRTAB", dyn->d_un.d_val); + DEBUG_LOG("%s 0x%08" PRIxPTR, "DT_STRTAB", dyn->d_un.d_val); strtab.Init(GetPtr(dyn->d_un.d_ptr)); break; case DT_SYMTAB: - DEBUG_LOG("%s 0x%08" PRIxAddr, "DT_SYMTAB", dyn->d_un.d_val); + DEBUG_LOG("%s 0x%08" PRIxPTR, "DT_SYMTAB", dyn->d_un.d_val); symtab.Init(GetPtr(dyn->d_un.d_ptr)); break; } } if (!buckets || !symnum) { ERROR("%s: Missing or broken DT_HASH", GetPath()); } else if (!strtab) { ERROR("%s: Missing DT_STRTAB", GetPath());
--- a/mozglue/linker/CustomElf.cpp +++ b/mozglue/linker/CustomElf.cpp @@ -7,16 +7,17 @@ #include <vector> #include <dlfcn.h> #include <signal.h> #include <string.h> #include "CustomElf.h" #include "BaseElf.h" #include "Mappable.h" #include "Logging.h" +#include "mozilla/IntegerPrintfMacros.h" using namespace Elf; using namespace mozilla; /* TODO: Fill ElfLoader::Singleton.lastError on errors. */ /* Function used to report library mappings from the custom linker to Gecko * crash reporter */ @@ -54,20 +55,20 @@ const Ehdr *Ehdr::validate(const void *b return ehdr; } namespace { void debug_phdr(const char *type, const Phdr *phdr) { - DEBUG_LOG("%s @0x%08" PRIxAddr " (" - "filesz: 0x%08" PRIxAddr ", " - "memsz: 0x%08" PRIxAddr ", " - "offset: 0x%08" PRIxAddr ", " + DEBUG_LOG("%s @0x%08" PRIxPTR " (" + "filesz: 0x%08" PRIxPTR ", " + "memsz: 0x%08" PRIxPTR ", " + "offset: 0x%08" PRIxPTR ", " "flags: %c%c%c)", type, phdr->p_vaddr, phdr->p_filesz, phdr->p_memsz, phdr->p_offset, phdr->p_flags & PF_R ? 'r' : '-', phdr->p_flags & PF_W ? 'w' : '-', phdr->p_flags & PF_X ? 'x' : '-'); } static int p_flags_to_mprot(Word flags) { @@ -179,17 +180,17 @@ CustomElf::Load(Mappable *mappable, cons #endif default: DEBUG_LOG("%s: Program header type #%d not handled", elf->GetPath(), phdr->p_type); } } if (min_vaddr != 0) { - ERROR("%s: Unsupported minimal virtual address: 0x%08" PRIxAddr, + ERROR("%s: Unsupported minimal virtual address: 0x%08" PRIxPTR, elf->GetPath(), min_vaddr); return nullptr; } if (!dyn) { ERROR("%s: No PT_DYNAMIC segment found", elf->GetPath()); return nullptr; } @@ -450,17 +451,17 @@ CustomElf::LoadSegment(const Phdr *pt_lo } return true; } namespace { void debug_dyn(const char *type, const Dyn *dyn) { - DEBUG_LOG("%s 0x%08" PRIxAddr, type, dyn->d_un.d_val); + DEBUG_LOG("%s 0x%08" PRIxPTR, type, dyn->d_un.d_val); } } /* anonymous namespace */ bool CustomElf::InitDyn(const Phdr *pt_dyn) { /* Scan PT_DYNAMIC segment and gather some information */ @@ -580,17 +581,17 @@ CustomElf::InitDyn(const Phdr *pt_dyn) } else { ERROR("%s: Text relocations are not supported", GetPath()); return false; } } /* we can treat this like having a DT_SYMBOLIC tag */ flags &= ~DF_SYMBOLIC; if (flags) - WARN("%s: unhandled flags #%" PRIxAddr" not handled", + WARN("%s: unhandled flags #%" PRIxPTR" not handled", GetPath(), flags); } break; case DT_SONAME: /* Should match GetName(), but doesn't matter */ case DT_SYMBOLIC: /* Indicates internal symbols should be looked up in * the library itself first instead of the executable, * which is actually what this linker does by default */ case RELOC(COUNT): /* Indicates how many relocations are relative, which @@ -603,17 +604,17 @@ CustomElf::InitDyn(const Phdr *pt_dyn) case DT_VERSYM: /* DT_VER* entries are used for symbol versioning, which */ case DT_VERDEF: /* this linker doesn't support yet. */ case DT_VERDEFNUM: case DT_VERNEED: case DT_VERNEEDNUM: /* Ignored */ break; default: - WARN("%s: dynamic header type #%" PRIxAddr" not handled", + WARN("%s: dynamic header type #%" PRIxPTR" not handled", GetPath(), dyn->d_tag); } } if (!buckets || !symnum) { ERROR("%s: Missing or broken DT_HASH", GetPath()); return false; } @@ -664,31 +665,31 @@ CustomElf::Relocate() symptr = GetPtr(sym.st_value); } else { /* TODO: handle symbol resolving to nullptr vs. being undefined. */ symptr = GetSymbolPtrInDeps(strtab.GetStringAt(sym.st_name)); } } if (symptr == nullptr) - WARN("%s: Relocation to NULL @0x%08" PRIxAddr, + WARN("%s: Relocation to NULL @0x%08" PRIxPTR, GetPath(), rel->r_offset); /* Apply relocation */ switch (ELF_R_TYPE(rel->r_info)) { case R_GLOB_DAT: /* R_*_GLOB_DAT relocations simply use the symbol value */ *(void **) ptr = symptr; break; case R_ABS: /* R_*_ABS* relocations add the relocation added to the symbol value */ *(const char **) ptr = (const char *)symptr + rel->GetAddend(base); break; default: - ERROR("%s: Unsupported relocation type: 0x%" PRIxAddr, + ERROR("%s: Unsupported relocation type: 0x%" PRIxPTR, GetPath(), ELF_R_TYPE(rel->r_info)); return false; } } return true; } bool @@ -711,21 +712,21 @@ CustomElf::RelocateJumps() void *symptr; if (sym.st_shndx != SHN_UNDEF) symptr = GetPtr(sym.st_value); else symptr = GetSymbolPtrInDeps(strtab.GetStringAt(sym.st_name)); if (symptr == nullptr) { if (ELF_ST_BIND(sym.st_info) == STB_WEAK) { - WARN("%s: Relocation to NULL @0x%08" PRIxAddr " for symbol \"%s\"", + WARN("%s: Relocation to NULL @0x%08" PRIxPTR " for symbol \"%s\"", GetPath(), rel->r_offset, strtab.GetStringAt(sym.st_name)); } else { - ERROR("%s: Relocation to NULL @0x%08" PRIxAddr " for symbol \"%s\"", + ERROR("%s: Relocation to NULL @0x%08" PRIxPTR " for symbol \"%s\"", GetPath(), rel->r_offset, strtab.GetStringAt(sym.st_name)); return false; } } /* Apply relocation */ *(void **) ptr = symptr; }
--- a/mozglue/linker/Logging.h +++ b/mozglue/linker/Logging.h @@ -67,21 +67,9 @@ private: #define DEBUG_LOG(...) \ do { \ if (MOZ_UNLIKELY(Logging::isVerbose())) { \ LOG(__VA_ARGS__); \ } \ } while(0) -#if defined(__LP64__) -# define PRIxAddr "lx" -# define PRIxSize "lx" -# define PRIdSize "ld" -# define PRIuSize "lu" -#else -# define PRIxAddr "x" -# define PRIxSize "x" -# define PRIdSize "d" -# define PRIuSize "u" -#endif - #endif /* Logging_h */
--- a/mozglue/linker/Mappable.cpp +++ b/mozglue/linker/Mappable.cpp @@ -8,16 +8,17 @@ #include <sys/stat.h> #include <cstring> #include <cstdlib> #include <cstdio> #include <string> #include "Mappable.h" +#include "mozilla/SizePrintfMacros.h" #include "mozilla/UniquePtr.h" #ifdef ANDROID #include <linux/ashmem.h> #endif #include <sys/stat.h> #include <errno.h> #include "ElfLoader.h" @@ -638,30 +639,30 @@ MappableSeekableZStream::ensure(const vo (reinterpret_cast<uintptr_t>(chunkAddr) + length); const void *start = std::max(map->addr, chunkAddr); const void *end = std::min(map->end(), chunkEndAddr); length = reinterpret_cast<uintptr_t>(end) - reinterpret_cast<uintptr_t>(start); if (mprotect(const_cast<void *>(start), length, map->prot) == 0) { - DEBUG_LOG("mprotect @%p, 0x%" PRIxSize ", 0x%x", start, length, map->prot); + DEBUG_LOG("mprotect @%p, 0x%" PRIxSIZE ", 0x%x", start, length, map->prot); return true; } - ERROR("mprotect @%p, 0x%" PRIxSize ", 0x%x failed with errno %d", + ERROR("mprotect @%p, 0x%" PRIxSIZE ", 0x%x failed with errno %d", start, length, map->prot, errno); return false; } void MappableSeekableZStream::stats(const char *when, const char *name) const { size_t nEntries = zStream.GetChunksNum(); - DEBUG_LOG("%s: %s; %" PRIdSize "/%" PRIdSize " chunks decompressed", + DEBUG_LOG("%s: %s; %" PRIuSIZE "/%" PRIuSIZE " chunks decompressed", name, when, static_cast<size_t>(chunkAvailNum), nEntries); size_t len = 64; UniquePtr<char[]> map = MakeUnique<char[]>(len + 3); map[0] = '['; for (size_t i = 0, j = 1; i < nEntries; i++, j++) { map[j] = chunkAvail[i] ? '*' : '_';
--- a/mozglue/linker/SeekableZStream.cpp +++ b/mozglue/linker/SeekableZStream.cpp @@ -1,15 +1,16 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <algorithm> #include "SeekableZStream.h" #include "Logging.h" +#include "mozilla/SizePrintfMacros.h" bool SeekableZStream::Init(const void *buf, size_t length) { const SeekableZStreamHeader *header = SeekableZStreamHeader::validate(buf); if (!header) { ERROR("Not a seekable zstream"); return false; @@ -53,29 +54,29 @@ SeekableZStream::Decompress(void *where, } return true; } bool SeekableZStream::DecompressChunk(void *where, size_t chunk, size_t length) { if (chunk >= offsetTable.numElements()) { - ERROR("DecompressChunk: chunk #%" PRIdSize " out of range [0-%" PRIdSize ")", + ERROR("DecompressChunk: chunk #%" PRIuSIZE " out of range [0-%" PRIuSIZE ")", chunk, offsetTable.numElements()); return false; } bool isLastChunk = (chunk == offsetTable.numElements() - 1); size_t chunkLen = isLastChunk ? lastChunkSize : chunkSize; if (length == 0 || length > chunkLen) length = chunkLen; - DEBUG_LOG("DecompressChunk #%" PRIdSize " @%p (%" PRIdSize "/% " PRIdSize ")", + DEBUG_LOG("DecompressChunk #%" PRIuSIZE " @%p (%" PRIuSIZE "/%" PRIuSIZE ")", chunk, where, length, chunkLen); zxx_stream zStream(&allocator); zStream.avail_in = (isLastChunk ? totalSize : uint32_t(offsetTable[chunk + 1])) - uint32_t(offsetTable[chunk]); zStream.next_in = const_cast<Bytef *>(buffer + uint32_t(offsetTable[chunk])); zStream.avail_out = length; zStream.next_out = reinterpret_cast<Bytef *>(where);
--- a/mozglue/linker/szip.cpp +++ b/mozglue/linker/szip.cpp @@ -9,16 +9,17 @@ #include <sstream> #include <cstring> #include <cstdlib> #include <zlib.h> #include <fcntl.h> #include <errno.h> #include "mozilla/Assertions.h" #include "mozilla/Scoped.h" +#include "mozilla/SizePrintfMacros.h" #include "mozilla/UniquePtr.h" #include "SeekableZStream.h" #include "Utils.h" #include "Logging.h" Logging Logging::Singleton; const char *filterName[] = { @@ -245,17 +246,17 @@ int SzipCompress::run(const char *name, ERROR("Won't compress %s: it's empty", name); return 1; } if (SeekableZStreamHeader::validate(origBuf)) { WARN("Skipping %s: it's already a szip", name); return 0; } bool compressed = false; - LOG("Size = %" PRIuSize, origSize); + LOG("Size = %" PRIuSIZE, origSize); /* Allocate a buffer the size of the uncompressed data: we don't want * a compressed file larger than that anyways. */ if (!outBuf.Resize(origSize)) { ERROR("Couldn't allocate output buffer: %s", strerror(errno)); return 1; } @@ -313,17 +314,17 @@ int SzipCompress::run(const char *name, firstDictSize = scanFilters ? 4096 : 0; lastDictSize = SzipCompress::winSize; } else { firstDictSize = lastDictSize = dictSize; } Buffer tmpBuf; for (size_t d = firstDictSize; d <= lastDictSize; d += 4096) { - DEBUG_LOG("Compressing with dictionary of size %" PRIuSize, d); + DEBUG_LOG("Compressing with dictionary of size %" PRIuSIZE, d); if (do_compress(*origData, tmpBuf, static_cast<unsigned char *>(dict) + SzipCompress::winSize - d, d, filter)) continue; if (!compressed || tmpBuf.GetLength() < outBuf.GetLength()) { outBuf.Fill(tmpBuf); compressed = true; dictSize = d; } @@ -334,29 +335,29 @@ int SzipCompress::run(const char *name, outBuf.Fill(origBuf); LOG("Not compressed"); return 0; } if (dictSize == (size_t) -1) dictSize = 0; - DEBUG_LOG("Used filter \"%s\" and dictionary size of %" PRIuSize, + DEBUG_LOG("Used filter \"%s\" and dictionary size of %" PRIuSIZE, filterName[filter], dictSize); - LOG("Compressed size is %" PRIuSize, outBuf.GetLength()); + LOG("Compressed size is %" PRIuSIZE, outBuf.GetLength()); /* Sanity check */ Buffer tmpBuf; SzipDecompress decompress; if (decompress.run("buffer", outBuf, "buffer", tmpBuf)) return 1; size_t size = tmpBuf.GetLength(); if (size != origSize) { - ERROR("Compression error: %" PRIuSize " != %" PRIuSize, size, origSize); + ERROR("Compression error: %" PRIuSIZE " != %" PRIuSIZE, size, origSize); return 1; } if (memcmp(static_cast<void *>(origBuf), static_cast<void *>(tmpBuf), size)) { ERROR("Compression error: content mismatch"); return 1; } return 0; }