[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-09-03 Thread hubicka at gcc dot gnu dot org


--- Comment #32 from hubicka at gcc dot gnu dot org  2010-09-03 12:26 
---
Subject: Bug 44812

Author: hubicka
Date: Fri Sep  3 12:26:24 2010
New Revision: 163811

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=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


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-09-03 Thread howarth at nitro dot med dot uc dot edu


--- Comment #33 from howarth at nitro dot med dot uc dot edu  2010-09-03 
23:36 ---
Fixed at r163811.


-- 

howarth at nitro dot med dot uc dot edu changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-09-01 Thread howarth at nitro dot med dot uc dot edu


--- Comment #30 from howarth at nitro dot med dot uc dot edu  2010-09-01 
14:38 ---
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=gccview=revrev=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


-- 


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



Re: [Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-09-01 Thread Jan Hubicka
 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


[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-09-01 Thread hubicka at ucw dot cz


--- Comment #31 from hubicka at ucw dot cz  2010-09-01 14:42 ---
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


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-27 Thread dominiq at lps dot ens dot fr


--- Comment #23 from dominiq at lps dot ens dot fr  2010-08-27 10:30 ---
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 passes618
# 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 passes617
# of unexpected failures1
# of unresolved testcases   1
# of unsupported tests  8

=== gcc Summary ===

# of expected passes1235
# of unexpected failures1
# 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 passes459
# of unexpected failures3
# 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 passes459
# of unexpected failures3
# of unresolved testcases   2
# of unsupported tests  1

=== g++ Summary ===

# of expected passes918
# of unexpected failures6
# 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) 


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-27 Thread howarth at nitro dot med dot uc dot edu


--- Comment #24 from howarth at nitro dot med dot uc dot edu  2010-08-27 
12:10 ---
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.


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-27 Thread howarth at nitro dot med dot uc dot edu


--- Comment #25 from howarth at nitro dot med dot uc dot edu  2010-08-27 
13:54 ---
Created an attachment (id=21577)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21577action=view)
m32 darwin lto fix using external


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-27 Thread howarth at nitro dot med dot uc dot edu


--- Comment #26 from howarth at nitro dot med dot uc dot edu  2010-08-27 
13:59 ---
(In reply to comment #25)
 Created an attachment (id=21577)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21577action=view) [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.


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-27 Thread howarth at nitro dot med dot uc dot edu


--- Comment #27 from howarth at nitro dot med dot uc dot edu  2010-08-27 
14:13 ---
Created an attachment (id=21578)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21578action=view)
corrected m32 darwin lto fix using external


-- 

howarth at nitro dot med dot uc dot edu changed:

   What|Removed |Added

  Attachment #21577|0   |1
is obsolete||


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-27 Thread howarth at nitro dot med dot uc dot edu


--- Comment #28 from howarth at nitro dot med dot uc dot edu  2010-08-27 
14:15 ---
(In reply to comment #27)
 Created an attachment (id=21578)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21578action=view) [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?


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-27 Thread iains at gcc dot gnu dot org


--- Comment #29 from iains at gcc dot gnu dot org  2010-08-27 17:38 ---
(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?


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-26 Thread howarth at nitro dot med dot uc dot edu


--- Comment #17 from howarth at nitro dot med dot uc dot edu  2010-08-26 
10:18 ---
Testresults with proposed patch at
http://gcc.gnu.org/ml/gcc-testresults/2010-08/msg02586.html.


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-26 Thread howarth at nitro dot med dot uc dot edu


--- Comment #18 from howarth at nitro dot med dot uc dot edu  2010-08-26 
16:01 ---
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.


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-26 Thread dominiq at lps dot ens dot fr


--- Comment #19 from dominiq at lps dot ens dot fr  2010-08-26 20:03 ---
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.


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-26 Thread dominiq at lps dot ens dot fr


--- Comment #20 from dominiq at lps dot ens dot fr  2010-08-27 00:09 ---
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 passes613
# of unexpected failures3
# 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 passes612
# of unexpected failures4
# of unresolved testcases   3
# of unsupported tests  8

=== gcc Summary ===

# of expected passes1225
# of unexpected failures7
# 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.


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-26 Thread howarth at nitro dot med dot uc dot edu


--- Comment #21 from howarth at nitro dot med dot uc dot edu  2010-08-27 
00:42 ---
Created an attachment (id=21575)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21575action=view)
patch which completely eliminates -m32 darwin lto failures


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-26 Thread howarth at nitro dot med dot uc dot edu


--- Comment #22 from howarth at nitro dot med dot uc dot edu  2010-08-27 
00:44 ---
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


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-25 Thread howarth at nitro dot med dot uc dot edu


--- Comment #15 from howarth at nitro dot med dot uc dot edu  2010-08-26 
01:40 ---
Created an attachment (id=21567)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21567action=view)
patch to effectively mark symbol as weak_import


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-25 Thread howarth at nitro dot med dot uc dot edu


--- Comment #16 from howarth at nitro dot med dot uc dot edu  2010-08-26 
01:55 ---
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.


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread hubicka at gcc dot gnu dot org


--- Comment #5 from hubicka at gcc dot gnu dot org  2010-08-24 13:01 ---
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-L001$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=44812



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread dominiq at lps dot ens dot fr


--- Comment #6 from dominiq at lps dot ens dot fr  2010-08-24 13:17 ---
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 ).


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread howarth at nitro dot med dot uc dot edu


--- Comment #7 from howarth at nitro dot med dot uc dot edu  2010-08-24 
13:44 ---
(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-L001$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


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread hubicka at gcc dot gnu dot org


--- Comment #8 from hubicka at gcc dot gnu dot org  2010-08-24 13:44 ---
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
L001$pb:
subl$24, %esp
LCFI1:
movlL_mumble$non_lazy_ptr-L001$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-L001$pb(%ebx), %eax
addl$1, %eax
cmpl$42, %eax
movl%eax, _mumble-L001$pb(%ebx)
je  L2
call_abort
L2:
movl$0, (%esp)
call_exit
LFE0:   

and no later mention of it...


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread iains at gcc dot gnu dot org


--- Comment #9 from iains at gcc dot gnu dot org  2010-08-24 13:47 ---
(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-L001$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-L001$pb   = L__mumble$non_lazy_ptr-L001$pb

..

.non_lazy_symbol_pointer
L_mumble$non_lazy_ptr:
.indirect_symbol _mumble
.long   0


-- 

iains at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||iains at gcc dot gnu dot org


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread iains at gcc dot gnu dot org


--- Comment #10 from iains at gcc dot gnu dot org  2010-08-24 14:11 ---
(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-L001$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?


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread iains at gcc dot gnu dot org


--- Comment #11 from iains at gcc dot gnu dot org  2010-08-24 14:37 ---
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.. 


-- 


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



Re: [Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread Jan Hubicka
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


[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread hubicka at ucw dot cz


--- Comment #12 from hubicka at ucw dot cz  2010-08-24 15:04 ---
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


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread iains at gcc dot gnu dot org


--- Comment #13 from iains at gcc dot gnu dot org  2010-08-24 15:17 ---
(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.


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-08-24 Thread howarth at nitro dot med dot uc dot edu


--- Comment #14 from howarth at nitro dot med dot uc dot edu  2010-08-24 
15:40 ---
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.


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-07-15 Thread howarth at nitro dot med dot uc dot edu


--- Comment #4 from howarth at nitro dot med dot uc dot edu  2010-07-15 
13:19 ---
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/2008 c_lto_2008_0.o-c_lto_2008_1.o link, -O0
-fwhopr
FAIL: gcc.dg/lto/2008 c_lto_2008_0.o-c_lto_2008_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.


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-07-04 Thread howarth at nitro dot med dot uc dot edu


--- Comment #1 from howarth at nitro dot med dot uc dot edu  2010-07-04 
15:23 ---
Created an attachment (id=21082)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21082action=view)
assembly file 2008_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_2008_0.o
/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100703/gcc/testsuite/gcc.dg/lto/2008_0.c


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-07-04 Thread howarth at nitro dot med dot uc dot edu


--- Comment #2 from howarth at nitro dot med dot uc dot edu  2010-07-04 
15:24 ---
Created an attachment (id=21084)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21084action=view)
assembly file 2008_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_2008_1.o
/sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20100703/gcc/testsuite/gcc.dg/lto/2008_1.c


-- 


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



[Bug lto/44812] m32 lto produces non-relocatable subtraction expression errors

2010-07-04 Thread howarth at nitro dot med dot uc dot edu


--- Comment #3 from howarth at nitro dot med dot uc dot edu  2010-07-04 
15:25 ---
Created an attachment (id=21085)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21085action=view)
assembly file gcc-dg-lto-2008-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_2008_0.o
c_lto_2008_1.o -O0 -fwhopr --save-temps -m32 -o gcc-dg-lto-2008-01


-- 


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