http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46916
--- Comment #64 from Jack Howarth <howarth at nitro dot med.uc.edu> 2010-12-15 14:34:03 UTC --- Iain, My old radar bug report numbered 7289379, "linker warnings when no unwind labels are emitted while targeting 10.6", my be have some useful information. The report was... 08-Oct-2009 11:17 PM Jack Howarth: When the following patch is used in FSF gcc trunk to leverage the fact that unwind labels are no longer required when targeting 10.6... 2009-10-08 Jack Howarth <howa...@bromo.med.uc.edu> PR c++/41313 * gcc/config/darwin.c: Suppress unwind labels when targeting 10.6 or later. Disable -freorder-blocks-and-partition for exception handling and when the target requested unwind info. Index: gcc/config/darwin.c =================================================================== --- gcc/config/darwin.c (revision 152583) +++ gcc/config/darwin.c (working copy) @@ -1454,7 +1454,8 @@ { char *lab; - if (! for_eh) + /* Suppress unwind labels when targeting 10.6 or later. */ + if ((! for_eh) || (darwin_macosx_version_min && strverscmp(darwin_macosx_version_min, "10.6") >= 0)) return; lab = concat (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), ".eh", NULL); @@ -1697,6 +1698,16 @@ if (dwarf_strict < 0) dwarf_strict = 1; + /* Disable -freorder-blocks-and-partition for exception handling or when + the target requested unwind info. */ + if (flag_reorder_blocks_and_partition && (flag_exceptions || flag_unwind_tables)) + { + inform (input_location, + "-freorder-blocks-and-partition does not work with exceptions on this architecture"); + flag_reorder_blocks_and_partition = 0; + flag_reorder_blocks = 1; + } + if (flag_mkernel || flag_apple_kext) { /* -mkernel implies -fapple-kext for C++ */ Two FSF gcc fail their compilation excessive errors test due to warnings of the form... ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o output is: ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o ld: warning: can't add line info to anonymous symbol anon-func-0xF40 from /var/tmp//ccrw73YL.o The resulting binaries run fine however which suggest these warnings are non-fatal. They should be suppressed if the warnings are incorrectly being emitted by the compiler. I have attached an archive, no_unwind_label_link_bug.tar.bz2, which contains both failing test cases... FAIL: g++.dg/tree-prof/partition1.C compilation, -g -fprofile-use UNRESOLVED: g++.dg/tree-prof/partition1.C execution, -g -fprofile-use FAIL: g++.dg/tree-prof/partition1.C compilation, -O3 -g -fprofile-use UNRESOLVED: g++.dg/tree-prof/partition1.C execution, -O3 -g -fprofile-use as case1 and case2 subdirectories respectively. A link_it shell script is provided in each to allow the linker warning to be reproduced. The common feature in the failing test cases appear to be the addition of the -g flag. Other similar partition1.C testcase runs which don't use -g do not produce these unexpected linker warnings. 'no_unwind_label_link_bug.tar.bz2' was successfully uploaded 08-Oct-2009 11:43 PM Jack Howarth: Minor correction, the actual patch applied to FSF gcc trunk was... Index: gcc/config/darwin.c =================================================================== --- gcc/config/darwin.c (revision 152583) +++ gcc/config/darwin.c (working copy) @@ -1454,7 +1454,8 @@ { char *lab; - if (! for_eh) + /* Suppress unwind labels when targeting 10.6 or later. */ + if ((! for_eh) || (darwin_macosx_version_min && strverscmp(darwin_macosx_version_min, "10.6") >= 0)) return; lab = concat (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), ".eh", NULL); @@ -1697,6 +1698,18 @@ if (dwarf_strict < 0) dwarf_strict = 1; + /* Disable -freorder-blocks-and-partition for exception handling or when + the target requested unwind info when targeting earlier than 10.6. */ + if (flag_reorder_blocks_and_partition + && (darwin_macosx_version_min && strverscmp(darwin_macosx_version_min, "10.6") < 0) + && (flag_exceptions || flag_unwind_tables)) + { + inform (input_location, + "-freorder-blocks-and-partition does not work with exceptions on this architecture"); + flag_reorder_blocks_and_partition = 0; + flag_reorder_blocks = 1; + } + if (flag_mkernel || flag_apple_kext) { /* -mkernel implies -fapple-kext for C++ */ 16-Nov-2009 03:17 PM Jack Howarth: See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42070#c1. and Apple's response to the uploaded test case was... 11-Nov-2009 06:25 PM YVONNE VILLA : Engineering has provided the following information: In the sample you supplied, the warning is because there is code in the __TEXT/__unlikely section and there is dwarf debug information that says it part of a function. The linker sanity checks how it broke up the .o file into "atoms" by checking it against the dwarf debug info. I think the __unlikely section should be avoided on darwin until it is shown to work with the linker. At a minimum each chunk in the __unlikely section should have a label on it with a name based on the function it came from. Those labels would also help debugging. This warning does not have anything to do removing labels from __eh_frame section.