On x86_64-apple-darwin* and i*86-apple-darwin*, a number of lto failures remain at -m32 which are of the form... /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/ c_lto_20081111_0.o c_lto_20081111_1.o -O0 -fwhopr -m32 -o gcc-dg-lto-20081111-01 /var/folders/1C/1CdoNxmNFHyOIjNBLNuJh++++TM/-Tmp-//ccogqVKS.s:15:non-relocatable subtraction expression, "_mumble" minus "L00000000001$pb" /var/folders/1C/1CdoNxmNFHyOIjNBLNuJh++++TM/-Tmp-//ccogqVKS.s:15:symbol: "_mumble" can't be undefined in a subtraction expression /var/folders/1C/1CdoNxmNFHyOIjNBLNuJh++++TM/-Tmp-//ccogqVKS.s:13:non-relocatable subtraction expression, "_mumble" minus "L00000000001$pb" /var/folders/1C/1CdoNxmNFHyOIjNBLNuJh++++TM/-Tmp-//ccogqVKS.s:13:symbol: "_mumble" can't be undefined in a subtraction expression /var/folders/1C/1CdoNxmNFHyOIjNBLNuJh++++TM/-Tmp-//ccogqVKS.s:10:non-relocatable subtraction expression, "_mumble" minus "L00000000001$pb" /var/folders/1C/1CdoNxmNFHyOIjNBLNuJh++++TM/-Tmp-//ccogqVKS.s:10:symbol: "_mumble" can't be undefined in a subtraction expression lto-wrapper: /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/xgcc returned 1 exit status
Created attachment 21082 [details] assembly file 20081111_0.s /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/ -O0 -fwhopr --save-temps -c -m32 -o c_lto_20081111_0.o /sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100703/gcc/testsuite/gcc.dg/lto/20081111_0.c
Created attachment 21084 [details] assembly file 20081111_1.s /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/ -O0 -fwhopr -c -m32 --save-temps -o c_lto_20081111_1.o /sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100703/gcc/testsuite/gcc.dg/lto/20081111_1.c
Created attachment 21085 [details] assembly file gcc-dg-lto-20081111-01.ltrans0.s /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/ c_lto_20081111_0.o c_lto_20081111_1.o -O0 -fwhopr --save-temps -m32 -o gcc-dg-lto-20081111-01
At -m32 on x86_64-apple-darwin10, the test cases which fail due to symbols being optimized away include... FAIL: g++.dg/lto/20081118-1 cp_lto_20081118-1_0.o-cp_lto_20081118-1_1.o link, -O2 -fwhopr FAIL: g++.dg/lto/20081119-1 cp_lto_20081119-1_0.o-cp_lto_20081119-1_1.o link, -fPIC -fwhopr -r -nostdlib FAIL: g++.dg/lto/20081125 cp_lto_20081125_0.o-cp_lto_20081125_1.o link, -fwhopr FAIL: g++.dg/lto/20081209 cp_lto_20081209_0.o-cp_lto_20081209_1.o link, -O0 -fwhopr FAIL: g++.dg/lto/20081209 cp_lto_20081209_0.o-cp_lto_20081209_1.o link, -O2 -fwhopr FAIL: g++.dg/lto/20081211-1 cp_lto_20081211-1_0.o-cp_lto_20081211-1_1.o link, -O0 -fwhopr FAIL: g++.dg/lto/20081211-1 cp_lto_20081211-1_0.o-cp_lto_20081211-1_1.o link, -O2 -fwhopr FAIL: g++.dg/lto/20090302 cp_lto_20090302_0.o-cp_lto_20090302_1.o link, -fPIC -fwhopr -r -nostdlib FAIL: g++.dg/lto/20090311-1 cp_lto_20090311-1_0.o-cp_lto_20090311-1_1.o link, -O0 -fwhopr FAIL: g++.dg/lto/20090311-1 cp_lto_20090311-1_0.o-cp_lto_20090311-1_1.o link, -O2 -fwhopr FAIL: g++.dg/lto/20090311 cp_lto_20090311_0.o-cp_lto_20090311_1.o link, -O0 -fwhopr FAIL: g++.dg/lto/20090312 cp_lto_20090312_0.o-cp_lto_20090312_1.o link, -O0 -fwhopr FAIL: g++.dg/lto/20090312 cp_lto_20090312_0.o-cp_lto_20090312_1.o link, -O2 -fwhopr FAIL: g++.dg/lto/20090315 cp_lto_20090315_0.o-cp_lto_20090315_1.o link, -O0 -fwhopr FAIL: g++.dg/lto/20090315 cp_lto_20090315_0.o-cp_lto_20090315_1.o link, -O2 -fwhopr FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o-cp_lto_20091210-1_1.o link, -O0 -fwhopr FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o-cp_lto_20091210-1_1.o link, -O2 -fwhopr FAIL: g++.dg/torture/pr43879-1_1.C -O2 -fwhopr (test for excess errors) FAIL: gcc.dg/lto/20081111 c_lto_20081111_0.o-c_lto_20081111_1.o link, -O0 -fwhopr FAIL: gcc.dg/lto/20081111 c_lto_20081111_0.o-c_lto_20081111_1.o link, -O2 -fwhopr FAIL: gcc.dg/lto/20081112 c_lto_20081112_0.o-c_lto_20081112_1.o link, -O2 -fwhopr FAIL: gcc.dg/lto/20090213 c_lto_20090213_0.o-c_lto_20090213_1.o link, -O2 -fwhopr FAIL: gcc.dg/lto/20090218 c_lto_20090218_0.o-c_lto_20090218_3.o link, -O2 -fwhopr FAIL: gcc.dg/lto/20090717 c_lto_20090717_0.o-c_lto_20090717_1.o link, -O0 -fwhopr FAIL: gcc.dg/lto/20090717 c_lto_20090717_0.o-c_lto_20090717_1.o link, -O2 -fwhopr FAIL: gcc.dg/lto/20091005-1 c_lto_20091005-1_0.o-c_lto_20091005-1_1.o link, -O0 -fwhopr FAIL: gcc.dg/lto/20100227-1 c_lto_20100227-1_0.o-c_lto_20100227-1_1.o link, -O0 -fwhopr FAIL: gcc.dg/lto/20100227-1 c_lto_20100227-1_0.o-c_lto_20100227-1_1.o link, -O2 -fwhopr FAIL: gcc.dg/lto/ipacp c_lto_ipacp_0.o-c_lto_ipacp_1.o link, -O1 -fwhopr -fipa-cp -fipa-cp-clone FAIL: gcc.dg/lto/ipareference2 c_lto_ipareference2_0.o-c_lto_ipareference2_1.o link, -O1 -fwhopr -fwhole-program FAIL: gcc.dg/lto/materialize-1 c_lto_materialize-1_0.o-c_lto_materialize-1_1.o link, -O3 -fwhopr FAIL: gcc.dg/torture/pr43879_1.c -O2 -fwhopr (test for excess errors) ...which represents almost the entirety of the lto related failures at -m32 on darwin.
Hmm, the problem seems to be that partitioning puts mumble into one partition, while in first partition it uses local (IP) relative way to access it: movl _mumble-L00000000001$pb(%ebx), %eax and assembler refuse it. What is proper way to access hidden symbol from other .s file?
The same errors appear on powerpc-apple-darwin9 with both -m32 and -m64 (see http://gcc.gnu.org/ml/gcc-testresults/2010-08/msg00777.html ).
(In reply to comment #5) > Hmm, the problem seems to be that partitioning puts mumble into one partition, > while in first partition it uses local (IP) relative way to access it: > movl _mumble-L00000000001$pb(%ebx), %eax > and assembler refuse it. What is proper way to access hidden symbol from other > .s file? > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43729#c33 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43729#c37 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43729#c42
the following testcase: __attribute__((visibility ("hidden"))) extern int mumble; extern void abort (void); extern void exit (int); int main () { if (++mumble != 42) abort (); exit (0); } should compile to pretty much the same as the partition. We get: call ___i686.get_pc_thunk.bx L00000000001$pb: subl $24, %esp LCFI1: movl L_mumble$non_lazy_ptr-L00000000001$pb(%ebx), %edx movl (%edx), %eax addl $1, %eax cmpl $42, %eax movl %eax, (%edx) je L2 call _abort and later L_mumble$non_lazy_ptr: .long _mumble while in the partitoin we get: CFI1: movl _mumble-L00000000001$pb(%ebx), %eax addl $1, %eax cmpl $42, %eax movl %eax, _mumble-L00000000001$pb(%ebx) je L2 call _abort L2: movl $0, (%esp) call _exit LFE0: and no later mention of it...
(In reply to comment #5) > Hmm, the problem seems to be that partitioning puts mumble into one partition, > while in first partition it uses local (IP) relative way to access it: > movl _mumble-L00000000001$pb(%ebx), %eax > and assembler refuse it. What is proper way to access hidden symbol from other > .s file? Take a look at the output of compilation without lto .. .. the symbol is indirected - since it cannot be guaranteed to be within reach otherwise; so (by convention) _mumble-L00000000001$pb => L__mumble$non_lazy_ptr-L00000000001$pb ...... .non_lazy_symbol_pointer L_mumble$non_lazy_ptr: .indirect_symbol _mumble .long 0
(In reply to comment #9) > (In reply to comment #5) > > Hmm, the problem seems to be that partitioning puts mumble into one partition, > > while in first partition it uses local (IP) relative way to access it: > > movl _mumble-L00000000001$pb(%ebx), %eax > > and assembler refuse it. What is proper way to access hidden symbol from other > > .s file? > > Take a look at the output of compilation without lto .. > .. the symbol is indirected - since it cannot be guaranteed to be within reach > otherwise; > which you already posted, I don't think the hidden attribute is relevant, looking at other fails. local symbols need to be registered with machopic_define_symbol() (see config/darwin.h ASM_DECLARE_OBJECT_NAME). they are processed via machopic_finish() called from darwin_file_end () [config/darwin.c] which , I assume is still called in the lto case?
essentially to turn the last comment around: IIUC, if whopr changes a symbol from "external" to "local" then it needs to register that symbol with machopic_define_symbol () -- and ensure that (* targetm.encode_section_info) (DECL, DECL_RTL (DECL), false); gets called too..
Subject: Re: m32 lto produces non-relocatable subtraction expression errors Hmm, actually the symbol is not changed, since it is externally visible symbol. I guess the problem would be that the symbol is used by 2 units, so both of them gets the declaration, but both of them gets the declaration with initializer (not extern). To avoid duplicate definitions, varpool.c is testing in_other_partition and prevents calling assemble_variable on them. This works just fine on ELF since extern vars don't need to be announced. Here we apparently need to get it assembled, but it is not getting via assemble_external. Rebuilding the decl to DECL_EXTERN is probably possible, but somewhat hackish. Honza
(In reply to comment #12) > Subject: Re: m32 lto produces non-relocatable subtraction > expression errors > > Hmm, actually the symbol is not changed, since it is externally visible symbol. ah, OK. > assemble_external (). is a no-op on darwin (unless the symbol is weak). since we don't declare ASM_OUTPUT_EXTERNAL. There might be some trick with marking the symbols weak/weak_import but I know nothing of the internals of lto to comment further.
What about Mike's suggestions from Comment 33 of PR43729 ... "If one bundles all the code into the wpa file, one can preserve _good_ codegen, which is the other way to fix this."
Created attachment 21567 [details] patch to effectively mark symbol as weak_import
Marking the symbols in_other_partitions as weak eliminates almost all of the failures. I still get... Running target unix/-m32 FAIL: gcc.dg/lto/20090213 c_lto_20090213_0.o-c_lto_20090213_1.o link, -O2 -fwhopr UNRESOLVED: gcc.dg/lto/20090213 c_lto_20090213_0.o-c_lto_20090213_1.o execute -O2 -fwhopr FAIL: gcc.dg/lto/20090218 c_lto_20090218_0.o-c_lto_20090218_3.o link, -O2 -fwhopr UNRESOLVED: gcc.dg/lto/20090218 c_lto_20090218_0.o-c_lto_20090218_3.o execute -O2 -fwhopr which still have the "non-relocatable subtraction expression"..."can't be undefined in a subtraction expression" errors. This might suggest the same problem exists somewhere else in varpool.c.
Testresults with proposed patch at http://gcc.gnu.org/ml/gcc-testresults/2010-08/msg02586.html.
Jan's alternative patch... Index: lto-cgraph.c =================================================================== --- lto-cgraph.c (revision 163494) +++ lto-cgraph.c (working copy) @@ -1109,6 +1109,8 @@ node->analyzed = node->finalized; node->used_from_other_partition = bp_unpack_value (&bp, 1); node->in_other_partition = bp_unpack_value (&bp, 1); + if (node->in_other_partition) + DECL_EXTERNAL (node->decl) = 1; aliases_p = bp_unpack_value (&bp, 1); if (node->finalized) varpool_mark_needed_node (node); works only slightly worse than marking the symbols weak. This produces the failures... Running target unix/-m32 FAIL: gcc.dg/lto/20090213 c_lto_20090213_0.o-c_lto_20090213_1.o link, -O2 -fwhopr UNRESOLVED: gcc.dg/lto/20090213 c_lto_20090213_0.o-c_lto_20090213_1.o execute -O2 -fwhopr FAIL: gcc.dg/lto/20090218 c_lto_20090218_0.o-c_lto_20090218_3.o link, -O2 -fwhopr UNRESOLVED: gcc.dg/lto/20090218 c_lto_20090218_0.o-c_lto_20090218_3.o execute -O2 -fwhopr FAIL: gcc.dg/lto/ipareference2 c_lto_ipareference2_0.o-c_lto_ipareference2_1.o execute -O1 -fwhopr -fwhole-program in the gcc testsuite. The last failure was suppressed in the previous case.
With the patch in comment #18, with -m64 I see the following failure FAIL: gcc.dg/lto/ipareference2 c_lto_ipareference2_0.o-c_lto_ipareference2_1.o execute -O1 -fwhopr -fwhole-program which was only present with -m32 without the patch. Otherwise the patch fixes many failures for the gcc and g++ test suites.
The patch in comment #18 works also on powerpc-apple-darwin9: Running target unix/-m32 Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.6-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.6-work/gcc/testsuite/gcc.dg/lto/lto.exp ... FAIL: gcc.dg/lto/20090213 c_lto_20090213_0.o-c_lto_20090213_1.o link, -O2 -fwhopr FAIL: gcc.dg/lto/20090218 c_lto_20090218_0.o-c_lto_20090218_3.o link, -O2 -fwhopr FAIL: gcc.dg/lto/ipareference2 c_lto_ipareference2_0.o-c_lto_ipareference2_1.o execute -O1 -fwhopr -fwhole-program === gcc Summary for unix/-m32 === # of expected passes 613 # of unexpected failures 3 # of unresolved testcases 2 # of unsupported tests 8 Running target unix/-m64 Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.6-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.6-work/gcc/testsuite/gcc.dg/lto/lto.exp ... FAIL: gcc.dg/lto/20090116 c_lto_20090116_0.o-c_lto_20090116_0.o link, -O1 -fwhopr -fPIC (internal compiler error) FAIL: gcc.dg/lto/20090213 c_lto_20090213_0.o-c_lto_20090213_1.o link, -O2 -fwhopr FAIL: gcc.dg/lto/20090218 c_lto_20090218_0.o-c_lto_20090218_3.o link, -O2 -fwhopr FAIL: gcc.dg/lto/ipareference2 c_lto_ipareference2_0.o-c_lto_ipareference2_1.o execute -O1 -fwhopr -fwhole-program === gcc Summary for unix/-m64 === # of expected passes 612 # of unexpected failures 4 # of unresolved testcases 3 # of unsupported tests 8 === gcc Summary === # of expected passes 1225 # of unexpected failures 7 # of unresolved testcases 5 # of unsupported tests 16 /opt/gcc/darwin_buildw/gcc/xgcc version 4.6.0 20100825 (experimental) [trunk revision 163553p1] (GCC) with an extra ICE for gcc.dg/lto/20090116.
Created attachment 21575 [details] patch which completely eliminates -m32 darwin lto failures
The m32_lto_fix2.diff patch expands the usage of DECL_WEAK into gcc/lto-cgraph.c and is sufficient to eliminate all of the darwin-specific lto failures at -m32. The only remaining ones are... FAIL: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o link, -fcompare-debug -flto (internal compiler error) UNRESOLVED: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o execute -fcompare-debug -flto FAIL: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o link, -fcompare-debug -fwhopr (internal compiler error) UNRESOLVED: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o execute -fcompare-debug -fwhopr
With the patch in comment #21 I get for powerpc-apple-darwin9 Running target unix/-m32 Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.6-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.6-work/gcc/testsuite/gcc.dg/lto/lto.exp ... === gcc Summary for unix/-m32 === # of expected passes 618 # of unsupported tests 8 Running target unix/-m64 Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.6-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.6-work/gcc/testsuite/gcc.dg/lto/lto.exp ... FAIL: gcc.dg/lto/20090116 c_lto_20090116_0.o-c_lto_20090116_0.o link, -O1 -fwhopr -fPIC (internal compiler error) === gcc Summary for unix/-m64 === # of expected passes 617 # of unexpected failures 1 # of unresolved testcases 1 # of unsupported tests 8 === gcc Summary === # of expected passes 1235 # of unexpected failures 1 # of unresolved testcases 1 # of unsupported tests 16 /opt/gcc/darwin_buildw/gcc/xgcc version 4.6.0 20100825 (experimental) [trunk revision 163553p1b] (GCC) and Running target unix/-m32 Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.6-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/lto/lto.exp ... FAIL: g++.dg/lto/20081109 cp_lto_20081109_0.o-cp_lto_20081109_1.o execute -O2 -fwhopr FAIL: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o link, -fcompare-debug -flto (internal compiler error) FAIL: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o link, -fcompare-debug -fwhopr (internal compiler error) === g++ Summary for unix/-m32 === # of expected passes 459 # of unexpected failures 3 # of unresolved testcases 2 # of unsupported tests 1 Running target unix/-m64 Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.6-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/lto/lto.exp ... FAIL: g++.dg/lto/20081109 cp_lto_20081109_0.o-cp_lto_20081109_1.o execute -O2 -fwhopr FAIL: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o link, -fcompare-debug -flto (internal compiler error) FAIL: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o link, -fcompare-debug -fwhopr (internal compiler error) === g++ Summary for unix/-m64 === # of expected passes 459 # of unexpected failures 3 # of unresolved testcases 2 # of unsupported tests 1 === g++ Summary === # of expected passes 918 # of unexpected failures 6 # of unresolved testcases 4 # of unsupported tests 2 /opt/gcc/darwin_buildw/gcc/testsuite/g++/../../g++ version 4.6.0 20100825 (experimental) [trunk revision 163553p1b] (GCC)
Testsuite results for m32_to_fix2.diff at http://gcc.gnu.org/ml/gcc-testresults/2010-08/msg02690.html. This approach completely fixes the darwin-specific lto failures on x86_64-apple-darwin10.
Created attachment 21577 [details] m32 darwin lto fix using external
(In reply to comment #25) > Created an attachment (id=21577) [edit] > m32 darwin lto fix using external > This version almost works. However I get the following c++ lto failures... FAIL: g++.dg/lto/20081022 cp_lto_20081022_0.o-cp_lto_20081022_1.o link, -O0 -fwhopr UNRESOLVED: g++.dg/lto/20081022 cp_lto_20081022_0.o-cp_lto_20081022_1.o execute -O0 -fwhopr FAIL: g++.dg/lto/20081125 cp_lto_20081125_0.o-cp_lto_20081125_1.o link, -fwhopr UNRESOLVED: g++.dg/lto/20081125 cp_lto_20081125_0.o-cp_lto_20081125_1.o execute -fwhopr FAIL: g++.dg/lto/20081203 cp_lto_20081203_0.o-cp_lto_20081203_1.o link, -O0 -fwhopr UNRESOLVED: g++.dg/lto/20081203 cp_lto_20081203_0.o-cp_lto_20081203_1.o execute -O0 -fwhopr FAIL: g++.dg/lto/20090311 cp_lto_20090311_0.o-cp_lto_20090311_1.o link, -O0 -fwhopr UNRESOLVED: g++.dg/lto/20090311 cp_lto_20090311_0.o-cp_lto_20090311_1.o execute -O0 -fwhopr FAIL: g++.dg/lto/20090311 cp_lto_20090311_0.o-cp_lto_20090311_1.o link, -O2 -fwhopr UNRESOLVED: g++.dg/lto/20090311 cp_lto_20090311_0.o-cp_lto_20090311_1.o execute -O2 -fwhopr FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o-cp_lto_20091210-1_1.o link, -O0 -fwhopr UNRESOLVED: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o-cp_lto_20091210-1_1.o execute -O0 -fwhopr FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o-cp_lto_20091210-1_1.o link, -O2 -fwhopr UNRESOLVED: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o-cp_lto_20091210-1_1.o execute -O2 -fwhopr FAIL: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o link, -fcompare-debug -flto (internal compiler error) UNRESOLVED: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o execute -fcompare-debug -flto FAIL: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o link, -fcompare-debug -fwhopr (internal compiler error) UNRESOLVED: g++.dg/lto/20100723-1 cp_lto_20100723-1_0.o-cp_lto_20100723-1_0.o execute -fcompare-debug -fwhopr Executing on host: /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/testsuite/g++/../../g++ -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/gcc/testsuite/g++/../../ cp_lto_20081022_0.o cp_lto_20081022_1.o -nostdinc++ -I/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.5.0/i386/libstdc++-v3/include/x86_64-apple-darwin10.5.0 -I/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.5.0/i386/libstdc++-v3/include -I/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100826/libstdc++-v3/libsupc++ -I/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100826/libstdc++-v3/include/backward -I/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100826/libstdc++-v3/testsuite/util -fmessage-length=0 -O0 -fwhopr -L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.5.0/i386/libstdc++-v3/src/.libs -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.5.0/i386/libstdc++-v3/src/.libs -L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.5.0/i386/libstdc++-v3/src/.libs -L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.5.0/i386/libiberty -multiply_defined suppress -m32 -o g++-dg-lto-20081022-01 (timeout = 300) Undefined symbols:^M "__ZN3foo3barEv", referenced from:^M __Z1gP3foo in ccxsAxgO.ltrans0.ltrans.o^M __Z1fP3foo in ccxsAxgO.ltrans1.ltrans.o^M ld: symbol(s) not found^M On the positive side, all of the original non-relocatable subtraction expression errors are gone.
Created attachment 21578 [details] corrected m32 darwin lto fix using external
(In reply to comment #27) > Created an attachment (id=21578) [edit] > corrected m32 darwin lto fix using external > My mistake. The additional assemble_external() calls weren't needed in lto-cgraph.c and this reduced patch produces the same errors. Any idea of what is happening to ltrans such that the symbols become undefined now?
(In reply to comment #12) > Subject: Re: m32 lto produces non-relocatable subtraction > expression errors > > Hmm, actually the symbol is not changed, since it is externally visible symbol. > I guess the problem would be that the symbol is used by 2 units, so both of > them gets the declaration, but both of them gets the declaration with > initializer (not extern). To avoid duplicate definitions, varpool.c is testing > in_other_partition and prevents calling assemble_variable on them. so one gets emitted and the other doesn't? This works > just fine on ELF since extern vars don't need to be announced. we don't need to announce them either ... (assemble_external() is a no-op). Here we > apparently need to get it assembled, but it is not getting via > assemble_external. we need to get the right entry into the machopic tables - if the var is local to the TU ... > > Rebuilding the decl to DECL_EXTERN is probably possible, but somewhat hackish. I guess this is just allowing it to be assembled... === It is possible that the following is the root of the problem; when deciding how to output a var darwin/macho-pic takes the presence of an initializer as evidence that the var is defined in the current TU and that, therefore, it can reference it locally and doesn't need to output the other stuff. unless the var passes through assemble_var () this will not get done. assemble_external () seems a bit hackish too... I'm not clear why the two instances are not coalesced by the whopr process? Is that to cater for file-scope vars?
Original -m32 lto testsuite failures due to "non-relocatable subtraction expression" errors were made latent by the commit... Author: ak Date: Tue Aug 31 16:58:46 2010 New Revision: 163680 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163680 Log: * common.opt (fwhopr=): Update for -fwhopr=jobserver * doc/invoke.texi (fwhopr): Document -fwhopr=jobserver. * lto-wrapper.c (run_gcc): Add jobserver mode. * opts.c (common_handle_option): Fix OPT_fwhopr for non numeric argument. Modified: trunk/gcc/ChangeLog trunk/gcc/common.opt trunk/gcc/doc/invoke.texi trunk/gcc/lto-wrapper.c trunk/gcc/opts.c
Subject: Re: m32 lto produces non-relocatable subtraction expression errors > Original -m32 lto testsuite failures due to "non-relocatable subtraction > expression" errors were made latent by the commit... Hmm, this does not make much sense. What changed? Honza
Subject: Bug 44812 Author: hubicka Date: Fri Sep 3 12:26:24 2010 New Revision: 163811 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163811 Log: PR lto/44812 * lto-cgraph.c (intput_node, input_varpool_node): Set DECL_EXTERNAL on functions/variables in other partition. Modified: trunk/gcc/ChangeLog trunk/gcc/lto-cgraph.c
Fixed at r163811.