http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52795

             Bug #: 52795
           Summary: FAIL: gcc.dg/tree-prof/pr34999.c compilation,
                    -fprofile-use -D_PROFILE_USE on
                    {x86_64,i386}-apple-darwin{10,11} at -m64
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: howa...@nitro.med.uc.edu


The failure...

FAIL: gcc.dg/tree-prof/pr34999.c compilation,  -fprofile-use -D_PROFILE_USE
UNRESOLVED: gcc.dg/tree-prof/pr34999.c execution,    -fprofile-use
-D_PROFILE_USE

occurs at -m64 on {x86_64,i386}-apple-darwin{10,11}. This occurs as a linker
failure of the form...

Assertion failed: (cfiStartsArray[i] != cfiStartsArray[i-1]), function parse,
file /SourceCache/ld64/ld64-128.2/src/ld/parsers/macho_relocatable_file.cpp,
line 1519.
0  0x10c62d1df  __assert_rtn + 79
1  0x10c648ae5 
mach_o::relocatable::Parser<x86_64>::parse(mach_o::relocatable::ParserOptions
const&) + 917
2  0x10c63632e  mach_o::relocatable::Parser<x86_64>::parse(unsigned char
const*, unsigned long long, char const*, long, unsigned int,
mach_o::relocatable::ParserOptions const&) + 286
3  0x10c632b2b  mach_o::relocatable::parse(unsigned char const*, unsigned long
long, char const*, long, unsigned int, mach_o::relocatable::ParserOptions
const&) + 91
4  0x10c66b6fd  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool)
+ 653
5  0x10c66ccfb  ld::tool::InputFiles::InputFiles(Options&, char const**) + 651
6  0x10c62d426  main + 358

This was filed as radr://10960042 and Apple's analysis was...

pr34999 is failing because the third FDE points to (LCOLDB2) which has no
non-local label preceding it, so the assembler creates a local relocation.  But
that loses information, and the linker cannot recover what the FDE is supposed
to point to.  A simple fix in the compiler is to not use relocations in the
__eh_frame section:

--- /tmp/pr34999.org/pr34999.s    2012-02-29 18:59:32.000000000 -0800
+++ /tmp/pr34999.fix/pr34999.s    2012-03-14 17:37:56.000000000 -0700
@@ -210,7 +210,8 @@
     .long L$set$9
 LASFDE5:
     .long    LASFDE5-EH_frame1
-    .quad    LCOLDB2-.
+    .set L$set$temp,LCOLDB2-.
+    .quad    L$set$temp
     .set L$set$10,LCOLDE2-LCOLDB2
     .quad L$set$10
     .byte    0

The darwin linker knows how to parse __eh_frame. It does not need relocations.

Reply via email to