public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Kai Tietz <ktietz70@googlemail.com>
To: Charles Davis <cdavis@mymail.mines.edu>
Cc: binutils@sourceware.org
Subject: Re: Proposal for Win64 exception handling directives
Date: Thu, 19 May 2011 05:52:00 -0000	[thread overview]
Message-ID: <BANLkTinxnF2tMGP_AHsiWnZkBMA_siHLSg@mail.gmail.com> (raw)
In-Reply-To: <4DD45235.5070300@mymail.mines.edu>

2011/5/19 Charles Davis <cdavis@mymail.mines.edu>:
> (Since I'm not subscribed to this mailing list, please reply to all when
> replying.)
>
> Hi,
>
> My name is Chip Davis, and I'm working on adding support for Win64-style
> exception handling to LLVM (at the behest of several people). I know
> there's interest in adding similar support to GCC.
>
> Right now, I'm working on assembler-level directives for emitting the
> required data for Win64-style exception handling. Since LLVM's
> integrated assembler was designed to be compatible with GAS, I'm writing
> you this message to make sure we're on the same page.
>
> So, in no particular order, here are the directives that I propose for
> emitting Win64 unwind data from the assembler. They're loosely based on
> MASM's directives, but augmented to support compilers such as Clang and GCC.
>
> - .w64_startproc <symbol> [, <ehandler>]
>
> Delimits the beginning of a function callable from <symbol> that has
> unwind data. If <ehandler> is specified, it is an exception handler to
> be used for this function (or an unwind handler; see below). Roughly
> equivalent to MASM's FRAME attribute on procedures.
>
> - .w64_endproc
>
> Delimits the end of a function with unwind data. MASM has no such
> directive, but it doesn't need it since it delimits functions with PROC
> and ENDP. We need it because GAS (and subsequently, LLVM) has no such
> mechanism.
>
> - .w64_startchained
>
> Starts an area of a function with additional operations to be undone in
> case of an exception. The unwind info struct is chained to the parent
> function. MASM has no equivalent; its support wasn't really designed for
> compilers.
>
> - .w64_endchained
>
> Ends an area of a function with additional operations to be undone in
> case of an exception. MASM has no equivalent; its support wasn't really
> designed for compilers.
>
> - .w64_unwind_only
>
> Indicates that this function doesn't handle any exceptions. If it has a
> handler specified in .w64_startproc, it is an unwind handler instead of
> an exception handler.
>
> MASM has no equivalent; its support wasn't really designed for compilers.
>
> - .w64_lsda <symbol>, <size>
>
> Specifies the location and <size> of the Language-Specific Data Area
> (LSDA). In Win64 EH, the LSDA is stored in the unwind info structure
> itself; the data will be copied into it upon emission.
>
> MASM has no equivalent; its support wasn't really designed for compilers.
>
> - .w64_pushreg <register>
>
> Specifies that the non-volatile <register> is pushed onto the stack.
> Equivalent to MASM's .pushreg directive.
>
> - .w64_setframe <regsiter>, <offset>
>
> Specifies the frame pointer register, and the offset (as a multiple of
> 16) from the stack pointer when the frame pointer is established.
> Equivalent to MASM's .setframe directive, and similar to the
> .cfi_def_cfa DWARF CFI directive.
>
> - .w64_allocstack <size>
>
> Specifies that some stack space was allocated. Equivalent to MASM's
> .allocstack directive.
>
> - .w64_savereg <register>, <offset>
>
> Specifies that the <register> was saved at an <offset> relative to the
> executable's base address. Only non-volatile registers should be
> indicated here. Equivalent to both MASM's .savereg and .savexmm128
> directives; I felt there was no need for a separate directive for XMM
> registers.
>
> - .w64_pushframe [code]
>
> Specifies that this is an interrupt handler. On x86-64, interrupt
> handlers have the original far stack pointer (SS:RSP), flags, and far
> program counter (CS:RIP) pushed onto the stack upon entry. If [code] is
> present, there is an error code on the stack in addition to the standard
> data. Equivalent to MASM's .pushframe directive.
>
> - .w64_endprolog
>
> Delimits the end of the function prolog. After this directive, no Win64
> EH directives other than a .w64_endproc (or .w64_endchained, if this is
> a chained unwind area) may appear. Equivalent to MASM's .endprolog
> directive.
>
> Comments and suggestions are welcome. (And please, no licensing flame
> wars.) Thanks for your time.
>
> Chip

Chip,

well, what you want to do here is already done fot binutils. Please
see in gas/condig/obj-coff-seh.c for the implementation of
pseudo-codes for SEH

Regards,
Kai

  reply	other threads:[~2011-05-19  5:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-18 23:12 Charles Davis
2011-05-19  5:52 ` Kai Tietz [this message]
2011-05-19 17:10   ` Charles Davis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTinxnF2tMGP_AHsiWnZkBMA_siHLSg@mail.gmail.com \
    --to=ktietz70@googlemail.com \
    --cc=binutils@sourceware.org \
    --cc=cdavis@mymail.mines.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).