[Patch] Fix anonymous code atoms problem on Darwin.
IainS
developer@sandoe-acoustics.co.uk
Mon Dec 20 12:03:00 GMT 2010
Hi,
This problem became apparent during the resolution of PR46904/46916
(we have had to switch off freorder-and-partition to avoid regression).
--
Darwin's toolchain will not allow us to have code fragments that are
anonymous (i.e. isolated by section and preceded only by a local label).
The rule [as quoted by Mike] is:
All sections have zero or more atoms. An atom is 1 or more bytes with
a label (non-L) on the front of it.
function reordering or partitioning breaks this, manifesting in linker
warnings and non-functional debug.
The following patch creates and calls a target hook after mid-function
section switches that gives the target an opportunity to do whatever
is necessary to avoid orphan code fragments. The darwin
implementation of the hook post-fixes the function name with _$hot$ or
_$cold$ as appropriate.
OK for trunk?
Iain
gcc:
* target.def (function_switched_text_sections): New Hook.
* doc/tm.texi Regenerated.
* doc/tm.texi.in (TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS)
New.
* final.c (default_function_switched_text_sections): New.
(final_scan_insn): Call function_switched_text_sections when a mid-
function section
change occurs.
* output.h (default_function_switched_text_sections): Declare.
* config/darwin-protos.h (darwin_function_switched_text_sections) :
Likewise.
* config/darwin.c (darwin_function_switched_text_sections): New.
* config/darwin.h (TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS)
New.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 168084-code-atoms.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101220/45bfa97a/attachment.txt>
-------------- next part --------------
More information about the Gcc-patches
mailing list