At present, pubnames are not emitted when -freorder-blocks-and- partition is active. This causes debug linking to fail on Darwin. The following patch outputs code ranges for Dwarf >=3 and produces a work-around for Dwarf-2. With this patch [and the one in http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01553.html ] we can re-enable -freorder-blocks-and-partition on Darwin and debug works (at least for the partition cases in the test-suite). OK for trunk? Iain gcc: * dwarf2out.c (gen_subprogram_die): Add pubnames with code ranges for DWARF >= 3. Add pubnames for the primary section and a reduced DIE for the secondary code fragment when outputting for DWARF == 2.