mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1200075 - Do not avoid sqlite3 using _msize. r=froydnj
It was setup this way in bug 719579 for legitimate reasons (because _msize would end up using the system symbol, which would crash trying to get the size information from jemalloc allocations), but these reasons don't apply anymore: back then the linking situation was different, and nowadays, mozglue.dll exports its own _msize which plugs into mozjemalloc, and sqlite is folded into nss3.dll, which links against mozglue.dll, such that using _msize on mozjemalloc allocations works. For some reason, while _msize (and other similar functions) are exported from mozglue.dll without an explicit instruction to do so on clang-cl builds, that's not the case for mingw builds (presumably related to the definition of these functions in system headers, or lack thereof). So we also add MOZ_EXPORT for them. Differential Revision: https://phabricator.services.mozilla.com/D81286
This commit is contained in:
parent
a39f7c1e96
commit
eb6d411650
@ -4851,7 +4851,7 @@ MOZ_EXPORT void* (*__memalign_hook)(size_t, size_t) = memalign_impl;
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
void* _recalloc(void* aPtr, size_t aCount, size_t aSize) {
|
||||
MOZ_EXPORT void* _recalloc(void* aPtr, size_t aCount, size_t aSize) {
|
||||
size_t oldsize = aPtr ? AllocInfo::Get(aPtr).Size() : 0;
|
||||
CheckedInt<size_t> checkedSize = CheckedInt<size_t>(aCount) * aSize;
|
||||
|
||||
@ -4876,7 +4876,7 @@ void* _recalloc(void* aPtr, size_t aCount, size_t aSize) {
|
||||
|
||||
// This impl of _expand doesn't ever actually expand or shrink blocks: it
|
||||
// simply replies that you may continue using a shrunk block.
|
||||
void* _expand(void* aPtr, size_t newsize) {
|
||||
MOZ_EXPORT void* _expand(void* aPtr, size_t newsize) {
|
||||
if (AllocInfo::Get(aPtr).Size() >= newsize) {
|
||||
return aPtr;
|
||||
}
|
||||
@ -4884,5 +4884,7 @@ void* _expand(void* aPtr, size_t newsize) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t _msize(void* aPtr) { return DefaultMalloc::malloc_usable_size(aPtr); }
|
||||
MOZ_EXPORT size_t _msize(void* aPtr) {
|
||||
return DefaultMalloc::malloc_usable_size(aPtr);
|
||||
}
|
||||
#endif
|
||||
|
9
third_party/sqlite3/src/moz.build
vendored
9
third_party/sqlite3/src/moz.build
vendored
@ -67,11 +67,10 @@ if CONFIG['OS_TARGET'] == 'Android':
|
||||
# default to user readable only to fit Android security model
|
||||
DEFINES['SQLITE_DEFAULT_FILE_PERMISSIONS'] = '0600'
|
||||
|
||||
# Force using malloc_usable_size when building with jemalloc because _msize
|
||||
# causes assertions on Win64. See bug 719579.
|
||||
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MEMORY']:
|
||||
DEFINES['HAVE_MALLOC_USABLE_SIZE'] = True
|
||||
DEFINES['SQLITE_WITHOUT_MSIZE'] = True
|
||||
# Force using _msize on mingw, as sqlite3 only enables it with MSVC.
|
||||
if CONFIG['OS_TARGET'] == 'WINNT' and CONFIG['CC_TYPE'] != 'clang-cl':
|
||||
DEFINES['SQLITE_USE_MALLOC_H'] = True
|
||||
DEFINES['SQLITE_USE_MSIZE'] = True
|
||||
|
||||
# Omit unused functions to save some library footprint.
|
||||
DEFINES['SQLITE_OMIT_DEPRECATED'] = True
|
||||
|
Loading…
Reference in New Issue
Block a user