Page MenuHomePhabricator

cdavis5x (Charles Davis)
User

Projects

User does not belong to any projects.

User Details

User Since
Nov 5 2012, 11:59 AM (362 w, 6 d)

Recent Activity

Mon, Oct 7

cdavis5x closed D19908: [X86] Support the "ms-hotpatch" attribute..
Mon, Oct 7, 6:50 AM · Restricted Project

Dec 13 2018

cdavis5x added a comment to D55674: [libunwind] [SEH] Add initial support for AArch64.

LGTM, but I'd feel better if someone else signed off on this, too.

Dec 13 2018, 3:29 PM

Dec 12 2018

cdavis5x accepted D55610: [libunwind] Avoid code duplication in the SEH version of UnwindCursor::getRegisterName. NFC..
Dec 12 2018, 1:35 PM

Oct 17 2018

cdavis5x added a comment to D52995: [CMake] Fix the -nodefaultlibs check..

Ping.

Oct 17 2018, 7:40 AM

Oct 8 2018

cdavis5x created D52995: [CMake] Fix the -nodefaultlibs check..
Oct 8 2018, 11:51 AM
cdavis5x updated the diff for D51657: [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON..
  • Detect libgcc.
Oct 8 2018, 11:08 AM

Sep 24 2018

cdavis5x added reviewers for D51657: [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON.: mstorsjo, rnk.
Sep 24 2018, 12:28 PM

Sep 17 2018

cdavis5x added a comment to D51657: [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON..

Ping.

Sep 17 2018, 11:43 AM

Sep 12 2018

cdavis5x added a comment to D51657: [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON..

Ping.

Sep 12 2018, 12:18 PM

Sep 4 2018

cdavis5x created D51657: [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON..
Sep 4 2018, 2:06 PM
cdavis5x added a reviewer for D51645: [CMake] Don't use -rtlib=compiler-rt with -nodefaultlibs.: beanz.
Sep 4 2018, 12:35 PM
cdavis5x created D51645: [CMake] Don't use -rtlib=compiler-rt with -nodefaultlibs..
Sep 4 2018, 10:45 AM
cdavis5x added inline comments to D51644: [CMake] Remove variable reference that isn't used..
Sep 4 2018, 10:07 AM
cdavis5x created D51644: [CMake] Remove variable reference that isn't used..
Sep 4 2018, 9:54 AM

Aug 31 2018

cdavis5x added inline comments to D51508: Export public functions implemented in assembly on Windows..
Aug 31 2018, 6:56 AM
cdavis5x accepted D51530: [libunwind] Fix existing code for SEH on ARM to compile correctly.
Aug 31 2018, 6:40 AM

Aug 30 2018

cdavis5x abandoned D50413: [libunwind][include] Add some missing definitions to <unwind.h>..

Consensus seems clear to me. Patch abandoned.

Aug 30 2018, 6:08 PM
cdavis5x created D51509: [AddressSpace] Use the macro to set hidden visibility on LocalAddressSpace..
Aug 30 2018, 2:45 PM
cdavis5x created D51508: Export public functions implemented in assembly on Windows..
Aug 30 2018, 2:38 PM

Aug 28 2018

cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

Ping.

Aug 28 2018, 3:25 PM

Aug 24 2018

cdavis5x updated the diff for D50564: Add support for SEH unwinding on Windows..
  • Move DISPATCHER_CONTEXT definition into UnwindCursor.hpp.
Aug 24 2018, 4:49 PM
cdavis5x updated the diff for D50564: Add support for SEH unwinding on Windows..
  • Remove case we'll never realistically hit.
  • Add back include I removed earlier.
  • Add a comment clarifying that some environments use SEH without Windows runtime support.
Aug 24 2018, 12:25 PM

Aug 23 2018

cdavis5x added inline comments to D50564: Add support for SEH unwinding on Windows..
Aug 23 2018, 12:45 PM
cdavis5x updated the diff for D50564: Add support for SEH unwinding on Windows..
  • Remove unnecessary code.
  • Guard against rogue personality functions returning wrong values.
  • Add a comment clarifying the purpose of the new_ctx variable.
Aug 23 2018, 12:45 PM

Aug 21 2018

cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

OK, I've removed some of the dependencies on Windows-specific types. The code in Unwind-seh.cpp is very Windows-specific, though, so I left it alone.

Aug 21 2018, 1:26 PM
cdavis5x updated the diff for D50564: Add support for SEH unwinding on Windows..
  • Make a bit more friendly to non-Windows.
  • Fix bits that depend on D50413.
Aug 21 2018, 1:24 PM
cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

I'm all for this change except the core issue is that you're using libunwind as a shim around the actual unwinding API provided by Windows. It would be nice to have something that did not have to do that and was capable of performing unwinding of SEH-style exceptions without needing additional runtime support.

It would be nice, but that would require extra work. We'd have to implement reading and interpreting unwind codes, and calling any handlers present at each frame (which all have a different calling convention from Itanium handlers), and handling chained unwind info... Or we could use the implementation that MS provided to us for free--and which gets loaded into every process anyway by virtue of being in NTDLL, and which is extremely well tested. Given all that, I'm wondering what implementing all that ourselves would gain us. I suppose we could eventually do all that, but for now, I think this is outside the scope of my change.

+1. I guess such a library would be very nice to have, but from the point of view of implementing exception handling, using the underlying APIs probably is the way to go. The other question, as posted before, is whether we want to wrap the whole CONTEXT structs in the UnwindCursor class and expose it via the unw_* set of APIs. It gives quite a significant amount of extra code here compared to libgcc's unwind-seh.c which is <500 loc altogether, providing only the _Unwind_* API, implementing it directly with the Windows Rtl* APIs from ntdll. That would give only a partial libunwind, with only the higher level API available, but that's the only part used for exception handling at least.

That still makes the underlying assumption that SEH is exclusive to Windows (and by that virtue PE/COFF) which doesn't necessarily hold true. There is also the issue of generic names like _LIBUNWIND_SUPPORT_SEH_UNWIND to guard includes of Windows specific headers which ties into my previous point. Would it be possible to somehow abstract away the Windows runtime function call and Windows specific header includes, even if it's via CMake options.

I'm raising this issue as there are other implementations of SEH that share the same (or extremely similar, depending on SDK versions) structures, but would not have the Windows headers available when compiling libunwind, and while the runtime function call to the Rtl* API is easy to change later on, separating rest of it from Windows headers is slightly messier.

Would it, at very least, be possible to decouple most of it from a dependency on Windows headers and if possible use things like void* in place of PVOID or anything that's stdint.h/inttypes.h friendly? It's an excellent patch regardless but loosening the Windows SDK dependencies a bit would make it a lot better.

Would be much appreciated, as I'm going through a backlog of patches I'd like to put up for review one of which includes SEH for x86_64 Linux (ELF) implemented using RT signals and additional compiler runtime glue code, currently residing within compiler-rt builtins (one of the issues I want to address before). It's quite a wonky ABI since I tried to keep as much compatible with 64-bit Windows SEH (.xdata variation) in terms of frame lowering etc, but run-time mechanisms differ vastly for obvious reasons. Having it interop with libunwind smoothly without rewriting much of existing code in this patch would be nice, or even worse resorting to a million preprocessor guards to cover all the cases.

Aug 21 2018, 11:45 AM

Aug 20 2018

cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

I'm all for this change except the core issue is that you're using libunwind as a shim around the actual unwinding API provided by Windows. It would be nice to have something that did not have to do that and was capable of performing unwinding of SEH-style exceptions without needing additional runtime support.

Aug 20 2018, 12:44 PM
cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

Ping...

Aug 20 2018, 11:48 AM
cdavis5x added a comment to D50413: [libunwind][include] Add some missing definitions to <unwind.h>..

Are y'all waiting for me to do something?

Aug 20 2018, 11:48 AM

Aug 17 2018

cdavis5x added a comment to D50413: [libunwind][include] Add some missing definitions to <unwind.h>..

Ping.

Aug 17 2018, 1:09 PM
cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

Ping.

Aug 17 2018, 1:08 PM

Aug 14 2018

cdavis5x updated the diff for D50564: Add support for SEH unwinding on Windows..
  • Get rid of DISPATCHER_CONTEXT def for ARM. We only support ARM on Win8+ anyway.
Aug 14 2018, 12:01 PM
cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

...And it turns out Phab marked the comments as done when I uploaded the new change. I didn't know it would do that. That's useful to know.

Aug 14 2018, 10:48 AM
cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

Marked some comments as done. (Phab won't let me post an empty comment, so...)

Aug 14 2018, 10:47 AM
cdavis5x updated the diff for D50564: Add support for SEH unwinding on Windows..
  • Update checks for DISPATCHER_CONTEXT definition.
  • Add link to KJK::Hyperion's articles on SEH.
Aug 14 2018, 10:46 AM
cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

Special thanks to KJK::Hyperion for his excellent series of articles on how EH works on x86-64 Windows. (Seriously, check it out. It's awesome.)

Can you give some links to it? A brief googling didn't turn up much else than the PSEH library.

I can't seem to find it either. I wonder if it's vanished from the Internet. Maybe the IA will have something.

Aug 14 2018, 10:27 AM
cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

Could somebody verify that the DISPATCHER_CONTEXT struct is defined in <winnt.h> for the Win8 and Win10 SDKs? I can't install them right now.

Aug 14 2018, 8:06 AM

Aug 13 2018

cdavis5x added a comment to D50413: [libunwind][include] Add some missing definitions to <unwind.h>..

Ping.

Aug 13 2018, 1:06 PM

Aug 10 2018

cdavis5x added a comment to D50564: Add support for SEH unwinding on Windows..

Special thanks to KJK::Hyperion for his excellent series of articles on how EH works on x86-64 Windows. (Seriously, check it out. It's awesome.)

Can you give some links to it? A brief googling didn't turn up much else than the PSEH library.

Aug 10 2018, 3:29 PM
cdavis5x updated the diff for D50564: Add support for SEH unwinding on Windows..
  • Fix outdated comment.
  • Make preprocessor conditional more consistent.
  • Make some private functions used only in a single file static.
Aug 10 2018, 3:25 PM
cdavis5x added inline comments to D50564: Add support for SEH unwinding on Windows..
Aug 10 2018, 3:25 PM
cdavis5x added inline comments to D50564: Add support for SEH unwinding on Windows..
Aug 10 2018, 3:16 PM
cdavis5x created D50564: Add support for SEH unwinding on Windows..
Aug 10 2018, 9:04 AM
cdavis5x added a comment to D50413: [libunwind][include] Add some missing definitions to <unwind.h>..

@cdavis5x I presume the fact that this one turned out tricky is blocking submitting the SEH unwinding patch.

Would it be worth to rework that patch to just use the basic types just like libunwind does today, e.g. having _Unwind_GetRegionStart return plain uintptr_t instead of _Unwind_Ptr, which also would be consistent with the existing entry points in Unwind-EHABI.cpp, Unwind-sjlj.c and UnwindLevel1.c, in order to be able to submit it before this one gets sorted out?

Aug 10 2018, 9:04 AM

Aug 8 2018

cdavis5x added a comment to D50413: [libunwind][include] Add some missing definitions to <unwind.h>..

NetBSD uses typedef void *_Unwind_Ptr; unconditionally in its <unwind.h>... if that has to be matched.

Done.

Additionally: typedef long _Unwind_Word;.

Done.

Aug 8 2018, 8:49 AM
cdavis5x updated the diff for D50413: [libunwind][include] Add some missing definitions to <unwind.h>..
  • Add NetBSD-specific definitions.
  • Pull out common declaration of __personality_routine.
Aug 8 2018, 8:49 AM
cdavis5x added inline comments to D50413: [libunwind][include] Add some missing definitions to <unwind.h>..
Aug 8 2018, 8:34 AM
cdavis5x updated the diff for D50414: [libunwind][include] Add SEH declarations to <unwind.h>..
  • Remove unneeded preprocessor condition.
Aug 8 2018, 7:52 AM
cdavis5x added a comment to D50414: [libunwind][include] Add SEH declarations to <unwind.h>..

Should we maybe add the same declaration of _GCC_specific_handler to clang's unwind.h? That would allow removing the forward declaration in libcxxabi from D49638.

Probably. I believe it's present in GCC's <unwind.h>, too.

Do you plan on implementing these SEH specific bits in libunwind,

Already have. Patch forthcoming.

Aug 8 2018, 6:50 AM

Aug 7 2018

cdavis5x created D50414: [libunwind][include] Add SEH declarations to <unwind.h>..
Aug 7 2018, 3:53 PM
cdavis5x created D50413: [libunwind][include] Add some missing definitions to <unwind.h>..
Aug 7 2018, 3:49 PM
cdavis5x retitled D50412: [libunwind] Fix pointer-to-integer cast warnings on LLP64. from Fix pointer-to-integer cast warnings on LLP64. to [libunwind] Fix pointer-to-integer cast warnings on LLP64..
Aug 7 2018, 3:44 PM
cdavis5x updated the diff for D50412: [libunwind] Fix pointer-to-integer cast warnings on LLP64..

Rebasing against HEAD.

Aug 7 2018, 3:43 PM
cdavis5x created D50412: [libunwind] Fix pointer-to-integer cast warnings on LLP64..
Aug 7 2018, 3:28 PM

Aug 2 2018

cdavis5x added a comment to D50199: [MinGW] Predefine UNICODE if -municode is specified during compilation.

Are you sure this shouldn't also define _UNICODE? looks Hmm... GCC doesn't define it. I wonder if we should anyway. A user who set -municode may also be using <tchar.h>, and thus may want those macros set to their Unicode counterparts.

Aug 2 2018, 2:31 PM

Apr 4 2017

cdavis5x added a comment to D20449: [Basic] Change x86_64-windows-macho targets to use Windows-style va_lists..

Extremely belated ping.

Apr 4 2017, 11:12 AM

Aug 17 2016

cdavis5x updated the diff for D19908: [X86] Support the "ms-hotpatch" attribute..

Fix the build error we saw in trunk.

Aug 17 2016, 11:48 AM · Restricted Project
cdavis5x reopened D19908: [X86] Support the "ms-hotpatch" attribute..

I think I've figured out why the build broke when I landed this. (Sorry that took so long.)

Aug 17 2016, 11:46 AM · Restricted Project

Aug 3 2016

cdavis5x added inline comments to D19909: [Attr] Add support for the `ms_hook_prologue` attribute..
Aug 3 2016, 4:11 PM
cdavis5x updated the diff for D19909: [Attr] Add support for the `ms_hook_prologue` attribute..

Update for merge conflicts.

Aug 3 2016, 4:08 PM
cdavis5x updated the diff for D19908: [X86] Support the "ms-hotpatch" attribute..

Merge with a more recent revision.

Aug 3 2016, 3:57 PM · Restricted Project

Jul 18 2016

cdavis5x planned changes to D19908: [X86] Support the "ms-hotpatch" attribute..

Unfortunately, this patch needs revision due to a merge conflict. :\

Jul 18 2016, 11:52 PM · Restricted Project
cdavis5x added a comment to D19908: [X86] Support the "ms-hotpatch" attribute..

@sanjoy: Ping.

Jul 18 2016, 1:24 PM · Restricted Project

Jul 6 2016

cdavis5x added a comment to D19908: [X86] Support the "ms-hotpatch" attribute..

Ping.

Jul 6 2016, 11:13 AM · Restricted Project

Jun 30 2016

cdavis5x added inline comments to D19908: [X86] Support the "ms-hotpatch" attribute..
Jun 30 2016, 1:48 PM · Restricted Project
cdavis5x updated the diff for D19908: [X86] Support the "ms-hotpatch" attribute..

Factor emission of the patchable instruction into a TTI hook.

Jun 30 2016, 1:23 PM · Restricted Project

May 19 2016

cdavis5x retitled D20449: [Basic] Change x86_64-windows-macho targets to use Windows-style va_lists. from to [Basic] Change x86_64-windows-macho targets to use Windows-style va_lists..
May 19 2016, 1:52 PM
cdavis5x added a comment to D19909: [Attr] Add support for the `ms_hook_prologue` attribute..

For now, I've disallowed it with naked and always_inline/__forceinline attributes. Do any other attributes affect prologue generation in a way that might interfere with ms_hook_prologue? AFAICT, GCC only disallows ms_hook_prologue on a) nested functions and b) functions compiled with -mfentry (neither of which we support, AFAIK).

May 19 2016, 1:36 PM
cdavis5x updated the diff for D19909: [Attr] Add support for the `ms_hook_prologue` attribute..
  • Add Sema tests for the ms_hook_prologue attribute.
  • Disallow ms_hook_prologue on architectures that Windows doesn't support.
  • Disallow ms_hook_prologue with the naked and always_inline attributes.
May 19 2016, 1:35 PM
cdavis5x added inline comments to D19908: [X86] Support the "ms-hotpatch" attribute..
May 19 2016, 1:24 PM · Restricted Project
cdavis5x updated the diff for D19908: [X86] Support the "ms-hotpatch" attribute..
  • Clarify that x86-64 doesn't use a special magic no-op.
  • Don't emit patch space with MSVC. The linker adds it for us there.
  • Don't force 64-bit functions to use a stack frame. That's only needed for 32-bit.
  • Test that, when we do emit the patch space, we emit it before the alignment directive.
May 19 2016, 1:21 PM · Restricted Project

May 17 2016

cdavis5x added inline comments to D19908: [X86] Support the "ms-hotpatch" attribute..
May 17 2016, 12:36 PM · Restricted Project

May 16 2016

cdavis5x added inline comments to D19909: [Attr] Add support for the `ms_hook_prologue` attribute..
May 16 2016, 1:26 PM
cdavis5x updated the diff for D19909: [Attr] Add support for the `ms_hook_prologue` attribute..
  • Use Sanjoy's patchable-function attribute.
  • Add documentation for this new attribute.
May 16 2016, 1:23 PM
cdavis5x added inline comments to D19908: [X86] Support the "ms-hotpatch" attribute..
May 16 2016, 1:14 PM · Restricted Project
cdavis5x updated the diff for D19908: [X86] Support the "ms-hotpatch" attribute..
  • Use Sanjoy's "patchable-function" attribute.
  • Override EmitConstantPool() instead of EmitFunctionEntryLabel().
  • Clarify why we're emitting 0xcc bytes (int3 instructions) instead of NOPs.
May 16 2016, 1:12 PM · Restricted Project

May 4 2016

cdavis5x retitled D19909: [Attr] Add support for the `ms_hook_prologue` attribute. from to [Attr] Add support for the `ms_hook_prologue` attribute..
May 4 2016, 1:55 AM
cdavis5x added a child revision for D19908: [X86] Support the "ms-hotpatch" attribute.: D19909: [Attr] Add support for the `ms_hook_prologue` attribute..
May 4 2016, 1:55 AM · Restricted Project
cdavis5x retitled D19908: [X86] Support the "ms-hotpatch" attribute. from to [X86] Support the "ms-hotpatch" attribute..
May 4 2016, 1:47 AM · Restricted Project

Apr 9 2016

cdavis5x added inline comments to D18471: [CodeGen] Don't assume that fixed stack objects are aligned in a stack-realigned function..
Apr 9 2016, 4:41 PM

Apr 5 2016

cdavis5x added a comment to D18471: [CodeGen] Don't assume that fixed stack objects are aligned in a stack-realigned function..

Ping^3.

Apr 5 2016, 11:28 AM

Apr 1 2016

cdavis5x added a comment to D18471: [CodeGen] Don't assume that fixed stack objects are aligned in a stack-realigned function..

Ping...

Apr 1 2016, 2:08 PM

Mar 29 2016

cdavis5x added a comment to D18471: [CodeGen] Don't assume that fixed stack objects are aligned in a stack-realigned function..

Ping.

Mar 29 2016, 11:02 AM

Mar 24 2016

cdavis5x retitled D18471: [CodeGen] Don't assume that fixed stack objects are aligned in a stack-realigned function. from to [CodeGen] Don't assume that fixed stack objects are aligned in a stack-realigned function..
Mar 24 2016, 11:07 PM

Sep 17 2015

cdavis5x closed D1623: Support __builtin_ms_va_list..
Sep 17 2015, 1:58 PM
cdavis5x added a comment to D1623: Support __builtin_ms_va_list..

Ping...

Sep 17 2015, 1:36 PM

Sep 14 2015

cdavis5x added inline comments to D1623: Support __builtin_ms_va_list..
Sep 14 2015, 1:44 PM
cdavis5x updated the diff for D1623: Support __builtin_ms_va_list..

Address review comments.

Sep 14 2015, 1:43 PM

Sep 10 2015

cdavis5x updated the diff for D1623: Support __builtin_ms_va_list..
  • Rebase onto rL247238.
  • Run clang-format on this patch.
  • Push va_arg emission down into the ABIInfo hierarchy.
Sep 10 2015, 12:14 AM

Sep 3 2015

cdavis5x added inline comments to D1623: Support __builtin_ms_va_list..
Sep 3 2015, 9:04 PM
cdavis5x updated the diff for D1623: Support __builtin_ms_va_list..

Address @rsmith's comments.

Sep 3 2015, 9:03 PM

Aug 28 2015

cdavis5x updated the diff for D1623: Support __builtin_ms_va_list..
  • Rebase onto rL246348.
  • Register the __builtin_ms_va_list predef decl. Fixes a nasty interaction with modules.
  • Mark __builtin_ms_va_start builtin as manually type-checked.
Aug 28 2015, 4:27 PM

Aug 25 2015

cdavis5x closed D1622: Make variable argument intrinsics behave correctly in a Win64 CC function..

Closing manually because Phabricator for some reason didn't close it for me...

Aug 25 2015, 5:19 PM
cdavis5x abandoned D11777: [Target/X86] Allow LowerVAARG to work on FreeBSD, too..

Abandoning since I gutted the assert(3) in D1622.

Aug 25 2015, 4:30 PM
cdavis5x updated the diff for D1622: Make variable argument intrinsics behave correctly in a Win64 CC function..

Just call X86Subtarget::isCallingConvWin64 in LowerVAARG.

Aug 25 2015, 12:37 AM

Aug 24 2015

cdavis5x added inline comments to D1622: Make variable argument intrinsics behave correctly in a Win64 CC function..
Aug 24 2015, 12:12 PM

Aug 20 2015

cdavis5x updated the diff for D1622: Make variable argument intrinsics behave correctly in a Win64 CC function..

Gut target OS assertion from LowerVAARG.

Aug 20 2015, 6:00 PM

Aug 5 2015

cdavis5x retitled D11777: [Target/X86] Allow LowerVAARG to work on FreeBSD, too. from to [Target/X86] Allow LowerVAARG to work on FreeBSD, too..
Aug 5 2015, 1:56 PM

Jul 27 2015

cdavis5x updated the diff for D1622: Make variable argument intrinsics behave correctly in a Win64 CC function..

Big belated update:

  • Rebase onto rL243284.
  • Go back to checking if the containing function uses the Win64 ABI. Opaque pointer types make checking the va_list type difficult.
  • Don't do the "don't save XMM registers" dance in a variadic Win64 ABI function on a SysV platform. (This was something I missed last time.)
Jul 27 2015, 12:40 PM