[patch gas]: Add pseudos for generation of runtime function entries by gas
H.J. Lu
hjl.tools@gmail.com
Mon Aug 31 20:56:00 GMT 2009
On Tue, Aug 11, 2009 at 3:28 AM, Kai Tietz<ktietz70@googlemail.com> wrote:
> Hello,
>
> I would like to show the patch for .pdata and .xdata generation of
> pe-coff targets via gas, and to get some feed-back.
> This patch includes support for arm, ppc, arm, sh (3&4), mips, and
> x64. As for x86 there is no OS support for runtime function
> information, I spared this part. It would just increase executable
> size for x86 PE and there is no real gain for this target.
>
> Short overview:
> There are at the moment three different function entry formats preset.
> The first is the MIPS one (could be also used here for x86). The
> second version is for ARM, PPC, SH3, and SH4 mainly for Windows CE.
> The third is the IA64 and x64 version. Note, the IA64 isn't
> implemented yet, but to find information about it, please see
> specification about IA64 on
> http://download.intel.com/design/Itanium/Downloads/245358.pdf file.
>
> The first version has just entries in the pdata section:
> BeginAddress, EndAddress, ExceptionHandler, HandlerData, and
> PrologueEndAddress. Each value is a pointer to the corresponding data
> and has size of 4 bytes.
>
> The second variant has the following entries in the pdata section.
> BeginAddress, PrologueLength (8 bits), EndAddress (22 bits),
> Use-32-bit-instruction (1 bit), and Exception-Handler-Exists (1 bit).
> If the FunctionLength is zero, or the Exception-Handler-Exists bit is
> true, a PDATA_EH block is placed directly before function entry
> (expressed by .seh_eh pseudo).
>
> The third version has a function entry block of BeginAddress (RVA),
> EndAddress (RVA), and UnwindData (RVA). The description of the
> prologue, excepetion-handler, and additional SEH data is stored within
> the UNWIND_DATA field in the xdata section.
>
> The pseudos:
> .seh_proc <fct_name>
> This specifies, that a SEH block begins for the function
> <fct_name>. This is valid for all targets.
> .seh_endprologue
> By this pseudo the location of the prologue end-address (taken by
> the current code address of the appearance of this pseudo). Valid for
> all targets.
> .seh_handler <handler>[,<handler-data>]
> This pseudo specifies the handler function to be used. For version
> 2 the handler-data field specifies the user optional data block. For
> version 3 the handler-data field can be a rva to user-data (for
> FHANDLER), if the name is @unwind the UHANDLER unwind block is
> generated, and if it is @except (or not specified at all) EHANDLER
> exception block is generated.
> .seh_eh
> This pseudo is used for version 2 to indicate the location of the
> function begin in assembly. Here the PDATA_EH data is may stored to.
> .seh_32/.seh_no32
> This pseudos are just used for version 2 (see above for
> description). At the moment it defaults to no32, if not specified.
> .seh_endproc
> By this pseudo the end of the SEH block is specified.
> .seh_setframe <reg>,<offset>
> By this pseudo the frame-register and the offset (value between
> 0-240 with 16-byte alignment) can be specified. This is just used by
> version 3.
> .seh_stackalloc <size>
> By this stack allocation in code is described for version 3.
> .seh_pushreg <reg>
> By this a general register push in code is described for version 3.
> .seh_savereg <reg>
> By this a general register save to memory in code is described for
> version 3.
> .seh_savemm <mm>
> By this a mm register save to memory in code is described for version 3.
> .seh_savexmm
> By this a xmm register save to memory in code is described for version 3.
> .seh_pushframe
> By this information about entry kind can be described for version 3.
> .seh_scope <begin>,<end>,<handler>,<jump>
> By this SCOPED entries for unwind or exceptions can be specified
> for version 3. This is just valid for UHANDLE and EHANDLER xdata
> descriptor and a global handler has to be specified. For handler and
> jump arguments, names of @1,@0, and @null can be used and they are
> specifying that a constant instead of a rva has to be used.
>
> 2009-08-11 Kai Tietz <kai.tietz@onevision.com>
>
> * config/obj-coff-seh.c: New file.
> * config/obj-coff-seh.h: Likewise.
> * config/obj-coff.c (obj-coff-seh.c): Add include.
> (coff_pseudo_table): Add new .seh... commands.
> * config/obj-coff.h (obj_coff_seh_do_final): Add new
> function prototype.
> (obj_coff_generate_pdata): New obj-coff hook.
> * gas/write.c (size_seg): Avoid sizing of already sized
> sections.
> (write_object_file): Call conditional hook
> objc_coff_generate_pdata.
> * Makefile.in: Add dependencies for new files.
> * Makefile.am: Regenerated.
>
> Tested for x86_64-pc-mingw32, i686-pc-linux, x86_64-pc-linux,
> i686-pc-mingw32, and for cygwin. Base test I did for mips and arm.
> This patch needs additional documentation in gas, and a lot of tests,
> but first I would like to get response about it.
>
This patch has an accidental change in write.c:
-#ifdef tc_frob_file_after_relocs
+#ifdef tc_frob_file_after_reloc
tc_frob_file_after_relocs ();
#endif
#ifdef obj_frob_file_after_relocs
obj_frob_file_after_relocs ();
#endif
It caused:
http://sourceware.org/bugzilla/show_bug.cgi?id=10570
I checked in the enclosed patch to fix it.
--
H.J.
---
Index: ChangeLog
===================================================================
--- ChangeLog (revision 6668)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2009-08-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/10570
+ * write.c (write_object_file): Revert the accidental change
+ made in revision 1.124 on 2009-08-17.
+
2009-08-31 Jan Beulich <jbeulich@novell.com>
* config/obj-elf.c (obj_elf_change_section): Set default type
Index: write.c
===================================================================
--- write.c (revision 6668)
+++ write.c (working copy)
@@ -1894,12 +1894,13 @@ write_object_file (void)
#endif
bfd_map_over_sections (stdoutput, write_relocs, (char *) 0);
-#ifdef tc_frob_file_after_reloc
+#ifdef tc_frob_file_after_relocs
tc_frob_file_after_relocs ();
#endif
#ifdef obj_frob_file_after_relocs
obj_frob_file_after_relocs ();
#endif
+
bfd_map_over_sections (stdoutput, write_contents, (char *) 0);
}
More information about the Binutils
mailing list