undefined reference to `__imp_mozalloc_abort' error in MinGW x64

RESOLVED FIXED in Firefox -esr60

Status

()

defect
RESOLVED FIXED
Last year
2 months ago

People

(Reporter: tjr, Assigned: tjr)

Tracking

unspecified
mozilla62
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox-esr60 fixed, firefox62 fixed)

Details

(Whiteboard: [tor])

Attachments

(1 attachment)

Assignee

Description

Last year
>  /builds/worker/workspace/build/src/obj-firefox/_virtualenv/bin/python /builds/worker/workspace/build/src/config/expandlibs_exec.py --uselist --  /builds/worker/workspace/build/src/sccache2/sccache /builds/worker/workspace/build/src/mingw32/bin/x86_64-w64-mingw32-g++ -mwindows -shared -Wl,--gc-sections -Wl,--out-implib > -Wl,libcrashinjectdll.a -o crashinjectdll.dll crashinjectdll.o ./module.res -lpthread -Wl,--build-id -static /builds/worker/workspace/build/src/build/win32/crashinjectdll/crashinjectdll.def        -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32
>  Executing: ../../../../sccache2/sccache ../../../../mingw32/bin/x86_64-w64-mingw32-g++ -mwindows -shared -Wl,--gc-sections -Wl,--out-implib -Wl,libcrashinjectdll.a -o crashinjectdll.dll /builds/worker/workspace/build/src/obj-firefox/build/win32/crashinjectdll/tmpAKUgnN.list module.res -lpthread -Wl,--build-id -static ../../../../build> /win32/crashinjectdll/crashinjectdll.def -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32
>  /builds/worker/workspace/build/src/obj-firefox/build/win32/crashinjectdll/tmpAKUgnN.list:
>      INPUT("crashinjectdll.o")
>  crashinjectdll.o: In function `__throw_bad_exception':
>  /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/throw_gcc.h:53: undefined reference to `__imp_mozalloc_abort'
>  crashinjectdll.o: In function `__throw_bad_alloc':
>  /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/throw_gcc.h:59: undefined reference to `__imp_mozalloc_abort'
>  crashinjectdll.o: In function `__throw_bad_cast':
>  /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/throw_gcc.h:65: undefined reference to `__imp_mozalloc_abort'
>  crashinjectdll.o: In function `__throw_bad_typeid':
>  /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/throw_gcc.h:71: undefined reference to `__imp_mozalloc_abort'
>  crashinjectdll.o: In function `__throw_bad_function_call':
>  /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/throw_gcc.h:78: undefined reference to `__imp_mozalloc_abort'
>  crashinjectdll.o:/builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/throw_gcc.h:84: more undefined references to `__imp_mozalloc_abort' follow
>  collect2: error: ld returned 1 exit status
>  /builds/worker/workspace/build/src/config/rules.mk:699: recipe for target 'crashinjectdll.dll' failed
>  make[4]: *** [crashinjectdll.dll] Error 1


crashinjectdll.o is trying import like so:

> nm crashinjectdll.o  | grep alloc_abort
>                 U __imp_mozalloc_abort

However it's exported like so:

> nm mozalloc_abort.o  | grep alloc_abort
> 0000000000000000 p .pdata$_Z14mozalloc_abortPKc
> 0000000000000000 t .text$_Z14mozalloc_abortPKc
> 0000000000000000 r .xdata$_Z14mozalloc_abortPKc
> 0000000000000000 T _Z14mozalloc_abortPKc

This looks like an extern C thing maybe?  Jacek do you have any thoughts?
Flags: needinfo?(jacek)

Comment 1

Last year
It indeed looks like extern C thing, although I don't see how crashinjectdll.o would try to import it as extern C. It uses MFBT_API in declaration, which is just dllimport/dllexport thing.

Anyway, does adding MOZ_EXTERN_C to mozalloc_abort.h so that we also export it as extern C help?
Flags: needinfo?(jacek)
Assignee

Comment 2

Last year
Found the issue. I'm not sure if mstackrealign is needed on x64 - Jacek?
Comment hidden (mozreview-request)

Comment 4

Last year
Great, nice catch! Ideally, we should not need mstackrealign. We needed it for x86 because GCC assumed aligned stack while MSVC didn't. I think that on x64 both compilers assume stack align (although I'm not 100% sure).

Looking at the patch, I'd suggest to move mstackrealign to be set around line 859 since it's not arch-specific.
Assignee

Updated

Last year
Blocks: 1448749

Comment 5

Last year
mozreview-review
Comment on attachment 8961926 [details]
Bug 1443823 Apply no-keep-inline-dllexport to MinGW x64 also

https://reviewboard.mozilla.org/r/230752/#review236864

::: js/src/old-configure.in:817
(Diff revision 1)
> +        elif test -n "$GNU_CC"; then
> +            CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
> +            CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"

It would be better to just move that out of the per-cpu-type checks.
Attachment #8961926 - Flags: review?(mh+mozilla)
Comment hidden (mozreview-request)

Comment 7

Last year
mozreview-review
Comment on attachment 8961926 [details]
Bug 1443823 Apply no-keep-inline-dllexport to MinGW x64 also

https://reviewboard.mozilla.org/r/230752/#review238598
Attachment #8961926 - Flags: review?(mh+mozilla) → review+

Comment 8

Last year
After some fair amount of bisecting on the weekend it turns out that this patch fixes bug 1392604 as well. It's not obvious to me yet why that's the case. Thus, I wonder if that fact alone could at least get mentioned in the commit message of this patch. I might help others to save some bisecting/debugging time in the future.
Assignee

Comment 9

Last year
Comment on attachment 8961926 [details]
Bug 1443823 Apply no-keep-inline-dllexport to MinGW x64 also

[Approval Request Comment]

This is one of several MinGW Build patches I'd like to land in esr60 for Tor. It will prevent them from carrying their own patches for the lifetime of esr60 and will enable us to keep the MinGW build functioning and know if/when/how it was broken by new commits into esr60.

This commit only affects the MinGW build configuration, so it is low-risk.
Attachment #8961926 - Flags: approval-mozilla-esr60?
Assignee

Updated

Last year
Keywords: checkin-needed

Comment 10

Last year
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/cab870519a15
Apply no-keep-inline-dllexport to MinGW x64 also r=glandium
Keywords: checkin-needed

Comment 11

Last year
bugherder
https://hg.mozilla.org/mozilla-central/rev/cab870519a15
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Comment on attachment 8961926 [details]
Bug 1443823 Apply no-keep-inline-dllexport to MinGW x64 also

mingw build fix, approved for 60.1esr
Attachment #8961926 - Flags: approval-mozilla-esr60? → approval-mozilla-esr60+
Assignee

Updated

2 months ago
See Also: → 1548624
You need to log in before you can comment on or make changes to this bug.