Bug 1060419 - convert mozglue/linker to use the mfbt-provided printf format defines, r=froydnj

MozReview-Commit-ID: LW6eDUxWXrp

--HG--
extra : rebase_source : 1d06ec765b30201f6cfc427006fa56384a61b38b
This commit is contained in:
Tom Tromey 2016-12-14 14:22:49 -07:00
Родитель b3223b115f
Коммит f6321565d2
6 изменённых файлов: 30 добавлений и 37 удалений

Просмотреть файл

@ -5,6 +5,7 @@
#include "BaseElf.h"
#include "Elfxx.h"
#include "Logging.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/RefPtr.h"
using namespace Elf;
@ -184,7 +185,7 @@ LoadedElf::InitDyn(const Phdr *pt_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];
@ -193,11 +194,11 @@ LoadedElf::InitDyn(const Phdr *pt_dyn)
}
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;
}

Просмотреть файл

@ -12,6 +12,7 @@
#include "BaseElf.h"
#include "Mappable.h"
#include "Logging.h"
#include "mozilla/IntegerPrintfMacros.h"
using namespace Elf;
using namespace mozilla;
@ -59,10 +60,10 @@ 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' : '-',
@ -184,7 +185,7 @@ CustomElf::Load(Mappable *mappable, const char *path, int flags)
}
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;
}
@ -455,7 +456,7 @@ 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 */
@ -585,7 +586,7 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
/* 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;
@ -608,7 +609,7 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
/* Ignored */
break;
default:
WARN("%s: dynamic header type #%" PRIxAddr" not handled",
WARN("%s: dynamic header type #%" PRIxPTR" not handled",
GetPath(), dyn->d_tag);
}
}
@ -669,7 +670,7 @@ CustomElf::Relocate()
}
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 */
@ -683,7 +684,7 @@ CustomElf::Relocate()
*(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;
}
@ -716,11 +717,11 @@ CustomElf::RelocateJumps()
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;

Просмотреть файл

@ -72,16 +72,4 @@ private:
} \
} 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 */

Просмотреть файл

@ -13,6 +13,7 @@
#include "Mappable.h"
#include "mozilla/SizePrintfMacros.h"
#include "mozilla/UniquePtr.h"
#ifdef ANDROID
@ -643,11 +644,11 @@ MappableSeekableZStream::ensure(const void *addr)
- 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;
}
@ -656,7 +657,7 @@ 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;

Просмотреть файл

@ -5,6 +5,7 @@
#include <algorithm>
#include "SeekableZStream.h"
#include "Logging.h"
#include "mozilla/SizePrintfMacros.h"
bool
SeekableZStream::Init(const void *buf, size_t length)
@ -58,7 +59,7 @@ 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;
}
@ -70,7 +71,7 @@ SeekableZStream::DecompressChunk(void *where, size_t chunk, size_t length)
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]))

Просмотреть файл

@ -14,6 +14,7 @@
#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"
@ -250,7 +251,7 @@ int SzipCompress::run(const char *name, Buffer &origBuf,
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. */
@ -318,7 +319,7 @@ int SzipCompress::run(const char *name, Buffer &origBuf,
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;
@ -339,9 +340,9 @@ int SzipCompress::run(const char *name, Buffer &origBuf,
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;
@ -351,7 +352,7 @@ int SzipCompress::run(const char *name, Buffer &origBuf,
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)) {