Closed Bug 1432790 Opened 2 years ago Closed 2 years ago

Sandbox MinGW Compilation error: undefined reference to `_ReturnAddress'


(Core :: Security: Process Sandboxing, defect)

Not set



Tracking Status
firefox60 --- fixed


(Reporter: tjr, Assigned: tjr)



(Whiteboard: [tor][mingw-upstream-pending])


(1 file)

In Bug 1431621 I thought I had fixed it by calling mingw's _ReturnAddress() function, but this caused an error on the linking step (below).  _ReturnAddress() was just a #define in MinGW to __builtin_return_address - so I'm just going to restore the original code but fix the stray \

[task 2018-01-24T00:44:34.562Z] 00:44:34     INFO -  ../../security/sandbox/process_handle_win.o: In function `ZN4base3win19GenericScopedHandleINS0_12HandleTraitsENS0_14VerifierTraitsEE3SetEPv':
[task 2018-01-24T00:44:34.562Z] 00:44:34     INFO -  /builds/worker/workspace/build/src/security/sandbox/chromium/base/win/scoped_handle.h:70: undefined reference to `_ReturnAddress'
[task 2018-01-24T00:44:34.562Z] 00:44:34     INFO -  ../../security/sandbox/process_handle_win.o: In function `ZN4base3win19GenericScopedHandleINS0_12HandleTraitsENS0_14VerifierTraitsEE5CloseEv':
[task 2018-01-24T00:44:34.563Z] 00:44:34     INFO -  /builds/worker/workspace/build/src/security/sandbox/chromium/base/win/scoped_handle.h:95: undefined reference to `_ReturnAddress'

(This does compile btw)
Summary: Sandbox MinGW Compilation error: → Sandbox MinGW Compilation error: undefined reference to `_ReturnAddress'
Comment on attachment 8945080 [details]
Bug 1432790 Fix MinGW Sandbox linking error about not being able to find _ReturnAddress()

::: security/sandbox/chromium-shim/patches/with_update/mingw_base_win_get_caller.patch:7
(Diff revision 2)
> -Bug 1431621 Remove the gcc variant of BASE_WIN_GET_CALLER, because MinGW defines _ReturnAddress() ?rbobowen
> +Bug XXXX Fix a stray \ in MinGW code
> -Note that MinGW defines it without __builtin_extract_return_addr which
> -means we're dropping that, but the gcc documentation indicates that
> +This is a bastardized pseudo-commit of Bug 1431621 and Bug 1432790.
> +It removes a stray \ in the code that causes MinGW to not compile.

Please make this just be a commit message (and patch) as if it had been done like this from the start for bug 1431621.

::: security/sandbox/chromium-shim/patches/with_update/mingw_base_win_get_caller.patch:19
(Diff revision 2)
>  MozReview-Commit-ID: 4D5bIT9Fei4
>  diff --git a/security/sandbox/chromium/base/win/scoped_handle.h b/security/sandbox/chromium/base/win/scoped_handle.h
>  --- a/security/sandbox/chromium/base/win/scoped_handle.h
>  +++ b/security/sandbox/chromium/base/win/scoped_handle.h
>  @@ -1,31 +1,26 @@

@@ -13,17 +13,17 @@

::: security/sandbox/chromium-shim/patches/with_update/mingw_base_win_get_caller.patch:20
(Diff revision 2)
>   // Copyright (c) 2012 The Chromium Authors. All rights reserved.
>   // Use of this source code is governed by a BSD-style license that can be
>   // found in the LICENSE file.
> -+#include <intrin.h>
>   #include <windows.h>
>   #include "base/base_export.h"
>   #include "base/gtest_prod_util.h"
>   #include "base/location.h"

Delete these ...

::: security/sandbox/chromium-shim/patches/with_update/mingw_base_win_get_caller.patch:50
(Diff revision 2)
>   // the ScopedFILE class with two additions:
>   //   - IsValid() method can tolerate multiple invalid handle values such as NULL

... and these.
Attachment #8945080 - Flags: review?(bobowencode) → review+
Okay I think I corrected it. I generated the patch file using real hg commands instead of editing it manually, but I guess I'd prefer you to double check it before I commit it.
Flags: needinfo?(bobowencode)
Yes, looks good to me, thanks.
Flags: needinfo?(bobowencode)
Keywords: checkin-needed
Pushed by
Fix MinGW Sandbox linking error about not being able to find _ReturnAddress() r=bobowen
Keywords: checkin-needed
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in before you can comment on or make changes to this bug.