mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 830326 - Get rid of warnings in the custom linker code. r=nfroyd
This commit is contained in:
parent
e55ecf1802
commit
915357dd17
@ -418,7 +418,7 @@ CustomElf::LoadSegment(const Phdr *pt_load) const
|
||||
* (p_vaddr == 0). But subsequent segments may not be 16k aligned
|
||||
* and fail to mmap. In such case, try to mmap again at the p_align
|
||||
* boundary instead of page boundary. */
|
||||
debug("%s: Failed to mmap, retrying");
|
||||
debug("%s: Failed to mmap, retrying", GetPath());
|
||||
align = pt_load->p_align;
|
||||
} while (1);
|
||||
|
||||
@ -570,7 +570,7 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
|
||||
break;
|
||||
case DT_FLAGS:
|
||||
{
|
||||
Word flags = dyn->d_un.d_val;
|
||||
Addr flags = dyn->d_un.d_val;
|
||||
/* Treat as a DT_TEXTREL tag */
|
||||
if (flags & DF_TEXTREL) {
|
||||
log("%s: Text relocations are not supported", GetPath());
|
||||
|
@ -234,7 +234,9 @@ ElfLoader::Load(const char *path, int flags, LibHandle *parent)
|
||||
}
|
||||
|
||||
char *abs_path = NULL;
|
||||
#ifdef MOZ_DEBUG_LINKER
|
||||
const char *requested_path = path;
|
||||
#endif
|
||||
|
||||
/* When the path is not absolute and the library is being loaded for
|
||||
* another, first try to load the library from the directory containing
|
||||
@ -574,7 +576,7 @@ ElfLoader::DebuggerHelper::DebuggerHelper(): dbg(NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
debug("DT_DEBUG points at %p", dbg);
|
||||
debug("DT_DEBUG points at %p", static_cast<void *>(dbg));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -754,7 +756,8 @@ void SEGVHandler::handler(int signum, siginfo_t *info, void *context)
|
||||
/* Redispatch to the registered handler */
|
||||
SEGVHandler &that = ElfLoader::Singleton;
|
||||
if (that.action.sa_flags & SA_SIGINFO) {
|
||||
debug("Redispatching to registered handler @%p", that.action.sa_sigaction);
|
||||
debug("Redispatching to registered handler @%p",
|
||||
FunctionPtr(that.action.sa_sigaction));
|
||||
that.action.sa_sigaction(signum, info, context);
|
||||
} else if (that.action.sa_handler == SIG_DFL) {
|
||||
debug("Redispatching to default handler");
|
||||
@ -762,7 +765,8 @@ void SEGVHandler::handler(int signum, siginfo_t *info, void *context)
|
||||
sigaction(signum, &that.action, NULL);
|
||||
raise(signum);
|
||||
} else if (that.action.sa_handler != SIG_IGN) {
|
||||
debug("Redispatching to registered handler @%p", that.action.sa_handler);
|
||||
debug("Redispatching to registered handler @%p",
|
||||
FunctionPtr(that.action.sa_handler));
|
||||
that.action.sa_handler(signum);
|
||||
} else {
|
||||
debug("Ignoring");
|
||||
|
@ -27,7 +27,6 @@
|
||||
#ifndef ELF_ST_BIND
|
||||
#define ELF_ST_BIND ELF64_ST_BIND
|
||||
#endif
|
||||
#define PRIxAddr "lx"
|
||||
#else
|
||||
#define Elf_(type) Elf32_ ## type
|
||||
#define ELFCLASS ELFCLASS32
|
||||
@ -36,7 +35,6 @@
|
||||
#ifndef ELF_ST_BIND
|
||||
#define ELF_ST_BIND ELF32_ST_BIND
|
||||
#endif
|
||||
#define PRIxAddr "x"
|
||||
#endif
|
||||
|
||||
#ifndef __BYTE_ORDER
|
||||
|
@ -10,7 +10,30 @@
|
||||
#define log(...) __android_log_print(ANDROID_LOG_ERROR, "GeckoLinker", __VA_ARGS__)
|
||||
#else
|
||||
#include <cstdio>
|
||||
#define log(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__)
|
||||
|
||||
/* Expand to 1 or m depending on whether there is one argument or more
|
||||
* given. */
|
||||
#define MOZ_ONE_OR_MORE_ARGS_IMPL2(_1, _2, _3, _4, _5, _6, _7, _8, _9, N, ...) \
|
||||
N
|
||||
#define MOZ_ONE_OR_MORE_ARGS_IMPL(args) MOZ_ONE_OR_MORE_ARGS_IMPL2 args
|
||||
#define MOZ_ONE_OR_MORE_ARGS(...) \
|
||||
MOZ_ONE_OR_MORE_ARGS_IMPL((__VA_ARGS__, m, m, m, m, m, m, m, m, 1, 0))
|
||||
|
||||
#define MOZ_MACRO_GLUE(a, b) a b
|
||||
#define MOZ_CONCAT2(a, b) a ## b
|
||||
#define MOZ_CONCAT1(a, b) MOZ_CONCAT2(a, b)
|
||||
#define MOZ_CONCAT(a, b) MOZ_CONCAT1(a, b)
|
||||
|
||||
/* Some magic to choose between log1 and logm depending on the number of
|
||||
* arguments */
|
||||
#define MOZ_CHOOSE_LOG(...) \
|
||||
MOZ_MACRO_GLUE(MOZ_CONCAT(log, MOZ_ONE_OR_MORE_ARGS(__VA_ARGS__)), \
|
||||
(__VA_ARGS__))
|
||||
|
||||
#define log1(format) fprintf(stderr, format "\n")
|
||||
#define logm(format, ...) fprintf(stderr, format "\n", __VA_ARGS__)
|
||||
#define log(...) MOZ_CHOOSE_LOG(__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_DEBUG_LINKER
|
||||
@ -19,4 +42,14 @@
|
||||
#define debug(...)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_64BIT_OS
|
||||
# define PRIxAddr "lx"
|
||||
# define PRIxSize "lx"
|
||||
# define PRIdSize "ld"
|
||||
#else
|
||||
# define PRIxAddr "x"
|
||||
# define PRIxSize "x"
|
||||
# define PRIdSize "d"
|
||||
#endif
|
||||
|
||||
#endif /* Logging_h */
|
||||
|
@ -446,7 +446,7 @@ MappableSeekableZStream::ensure(const void *addr)
|
||||
|
||||
/* Find corresponding chunk */
|
||||
off_t mapOffset = map->offsetOf(addrPage);
|
||||
size_t chunk = mapOffset / zStream.GetChunkSize();
|
||||
off_t chunk = mapOffset / zStream.GetChunkSize();
|
||||
|
||||
/* In the typical case, we just need to decompress the chunk entirely. But
|
||||
* when the current mapping ends in the middle of the chunk, we want to
|
||||
@ -457,8 +457,8 @@ MappableSeekableZStream::ensure(const void *addr)
|
||||
* going to call mmap (which adds lazyMaps) while this function is
|
||||
* called. */
|
||||
size_t length = zStream.GetChunkSize(chunk);
|
||||
size_t chunkStart = chunk * zStream.GetChunkSize();
|
||||
size_t chunkEnd = chunkStart + length;
|
||||
off_t chunkStart = chunk * zStream.GetChunkSize();
|
||||
off_t chunkEnd = chunkStart + length;
|
||||
std::vector<LazyMap>::iterator it;
|
||||
for (it = map; it < lazyMaps.end(); ++it) {
|
||||
if (chunkEnd <= it->endOffset())
|
||||
@ -513,7 +513,7 @@ MappableSeekableZStream::ensure(const void *addr)
|
||||
length = reinterpret_cast<uintptr_t>(end)
|
||||
- reinterpret_cast<uintptr_t>(start);
|
||||
|
||||
debug("mprotect @%p, 0x%x, 0x%x", start, length, map->prot);
|
||||
debug("mprotect @%p, 0x%" PRIxSize ", 0x%x", start, length, map->prot);
|
||||
if (mprotect(const_cast<void *>(start), length, map->prot) == 0)
|
||||
return true;
|
||||
|
||||
@ -525,7 +525,7 @@ void
|
||||
MappableSeekableZStream::stats(const char *when, const char *name) const
|
||||
{
|
||||
size_t nEntries = zStream.GetChunksNum();
|
||||
debug("%s: %s; %ld/%ld chunks decompressed",
|
||||
debug("%s: %s; %" PRIdSize "/%" PRIdSize " chunks decompressed",
|
||||
name, when, chunkAvailNum, nEntries);
|
||||
|
||||
size_t len = 64;
|
||||
|
@ -61,7 +61,7 @@ bool
|
||||
SeekableZStream::DecompressChunk(void *where, size_t chunk, size_t length)
|
||||
{
|
||||
if (chunk >= offsetTable.numElements()) {
|
||||
log("DecompressChunk: chunk #%ld out of range [0-%ld)",
|
||||
log("DecompressChunk: chunk #%" PRIdSize " out of range [0-%" PRIdSize ")",
|
||||
chunk, offsetTable.numElements());
|
||||
return false;
|
||||
}
|
||||
@ -73,7 +73,8 @@ SeekableZStream::DecompressChunk(void *where, size_t chunk, size_t length)
|
||||
if (length == 0 || length > chunkLen)
|
||||
length = chunkLen;
|
||||
|
||||
debug("DecompressChunk #%ld @%p (%ld/%ld)", chunk, where, length, chunkLen);
|
||||
debug("DecompressChunk #%" PRIdSize " @%p (%" PRIdSize "/% " PRIdSize ")",
|
||||
chunk, where, length, chunkLen);
|
||||
z_stream zStream;
|
||||
memset(&zStream, 0, sizeof(zStream));
|
||||
zStream.avail_in = (isLastChunk ? totalSize : uint32_t(offsetTable[chunk + 1]))
|
||||
|
@ -173,8 +173,9 @@ ZipCollection::Forget(Zip *zip)
|
||||
{
|
||||
debug("ZipCollection::Forget(\"%s\")", zip->GetName());
|
||||
std::vector<Zip *>::iterator it = std::find(zips.begin(), zips.end(), zip);
|
||||
if (*it == zip)
|
||||
if (*it == zip) {
|
||||
zips.erase(it);
|
||||
else
|
||||
} else {
|
||||
debug("ZipCollection::Forget: didn't find \"%s\" in bookkeeping", zip->GetName());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user