The cleanups to i386 prologue/epilogue generation (r162882 -r162891) cause 161
libstdc++ failures at -m32 on *86*-apple-darwin10 due to new warnings of the
form...

Executing on host: /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/./gcc/g++
-shared-libgcc -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/./gcc
-nostdinc++
-L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/i386/libstdc++-v3/src
-L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/i386/libstdc++-v3/src/.libs
-B/sw/lib/gcc4.6/x86_64-apple-darwin10.4.0/bin/
-B/sw/lib/gcc4.6/x86_64-apple-darwin10.4.0/lib/ -isystem
/sw/lib/gcc4.6/x86_64-apple-darwin10.4.0/include -isystem
/sw/lib/gcc4.6/x86_64-apple-darwin10.4.0/sys-include -m32
-B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/i386/libstdc++-v3/src/.libs
-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0 -ffunction-sections -fdata-sections
-g -O2 -g -O2 -DLOCALEDIR="." -nostdinc++
-I/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/i386/libstdc++-v3/include/x86_64-apple-darwin10.4.0
-I/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.4.0/i386/libstdc++-v3/include
-I/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libstdc++-v3/libsupc++
-I/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libstdc++-v3/include/backward
-I/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libstdc++-v3/testsuite/util
/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100803/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/39882.cc
  -std=gnu++0x ./libtestc++.a   -lm   -m32 -o ./39882.exe    (timeout = 600)
ld: warning: can't add line info to anonymous symbol initializer$0 from
/var/tmp//ccuyXXr3.o^M
output is:
ld: warning: can't add line info to anonymous symbol initializer$0 from
/var/tmp//ccuyXXr3.o^M

FAIL: 19_diagnostics/error_code/cons/39882.cc (test for excess errors)
Excess errors:
ld: warning: can't add line info to anonymous symbol initializer$0 from
/var/tmp//ccuyXXr3.o

This has been filed as radar://8274440, ld: warning: can't add line info to
anonymous symbol",
with two standalone testcases generated before and after the patches.

According the darwin linker developer, the explanation and possible workaround
are as follows...

---------------------------------------------------------
ld: warning: can't add line info to anonymous symbol initializer$0 from      
39882.o
[/tmp/anonymous_symbol_post]> size -l 39882.o
      ...
        Section (__TEXT, __textcoal_nt): 176 (addr 0x6580 offset 27668)
        Section (__DATA, __mod_init_func): 4 (addr 0x6630 offset 27844)
      ...

I suspect what is happening is that the dwarf debug line info has a
pc-range that goes from the last function in the __textcoal_nt section up
to the start of the __mod_init_func section.  When ld is parsing the debug
line info, it sees a pc address that is in the __mod_init_func section and
issues the warning.   The linker should be smarter and realize the pc
address is the *end* address and therefore ok to be also the beginning       
address of another section.

You could work around this by moving  the __textcoal_nt section to be
after the __text section.  That is, put a .section __TEXT,
__textcoal_nt,blah,blah directive at the top of the file before the
.section __DWARF, blah directives.  This would mean any edge cases in the  
end of the __textcoal_nt would be into the __DWARF sections with ld
ignores.
---------------------------------------------------------

    He also mentioned that this bug doesn't appear to exist in the Xcode 4.0
linker
(so it will go away in the future) and that it is in fact a non-fatal warning
(but that
the resulting dwarf line tables might be bad).


-- 
           Summary: ld: warning: can't add line info to anonymous symbol
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: howarth at nitro dot med dot uc dot edu
 GCC build triplet: *86*-apple-darwin10
  GCC host triplet: *86*-apple-darwin10
GCC target triplet: *86*-apple-darwin10


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

Reply via email to