public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
@ 2011-03-14  9:37 iains at gcc dot gnu.org
  2011-03-14 10:23 ` [Bug objc/48109] " mikestump at comcast dot net
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: iains at gcc dot gnu.org @ 2011-03-14  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Objective-C class defs/refs are lost under LTO on
                    Darwin for ABI0/1
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: objc
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: iains@gcc.gnu.org
              Host: *-apple-darwin*
            Target: *-apple-darwin*
             Build: *-apple-darwin*


This is a FE bug that manifests only on Darwin/NeXT (m32) under LTO.

(originally reported as part of PR48094)

e.g.

-L/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/x86_64-apple-darwin10.7.0/i386/libobjc/.libs
  -lobjc     -m32 -o objc-dg-lto-trivial-1-21    (timeout = 300)
ld: warning: section __OBJC/__image_info has unexpectedly large size 16 in
/var/tmp//ccMlEsXS.lto.o^M
Undefined symbols for architecture i386:^M
  ".objc_class_name_myRootObject", referenced from:^M
      pointer-to-literal-objc-class-name in ccMlEsXS.lto.o^M
      pointer-to-literal-objc-class-name in ccMlEsXS.lto.o^M
ld: symbol(s) not found for architecture i386^M

---

The reason is an anachronism in using target macros to emit efficient
representations of class presence and requirement
(ASM_DECLARE_CLASS_REFERENCE/ASM_DECLARE_UNRESOLVED_REFERENCE).

.. because of this, there are no real vars representing the
presence/requirement for the classes and, when LTO is engaged, the information
is lost.

The separate external defs/refs are required because the class metadata
structures are all local to a given TU.  The refs meet the linkage
requirements.

For the m64 ABI-2 this is not longer an issue, since class metadata definitions
are now external and thus visible without additional action.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
@ 2011-03-14 10:23 ` mikestump at comcast dot net
  2011-03-14 10:29 ` iains at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mikestump at comcast dot net @ 2011-03-14 10:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Mike Stump <mikestump at comcast dot net> 2011-03-14 10:23:19 UTC ---
Not sure it matters, but, marking them as used should be enough...  Note, there
are a couple of ways to mark things.  TREE_USED and the lto incantation.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
  2011-03-14 10:23 ` [Bug objc/48109] " mikestump at comcast dot net
@ 2011-03-14 10:29 ` iains at gcc dot gnu.org
  2011-03-14 11:27 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: iains at gcc dot gnu.org @ 2011-03-14 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.03.14 10:29:40
     Ever Confirmed|0                           |1

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> 2011-03-14 10:29:40 UTC ---
(In reply to comment #1)
> Not sure it matters, but, marking them as used should be enough...  Note, there
> are a couple of ways to mark things.  TREE_USED and the lto incantation.

they never exist to be marked:


handle_next_class_ref (tree chain)
{
  const char *name = IDENTIFIER_POINTER (TREE_VALUE (chain));
  char *string = (char *) alloca (strlen (name) + 30);

  sprintf (string, ".objc_class_name_%s", name);

#ifdef ASM_DECLARE_UNRESOLVED_REFERENCE
  ASM_DECLARE_UNRESOLVED_REFERENCE (asm_out_file, string);

>>>>  this just emits .lazy_reference .objc_class_name_xxxxx

#else
  return ; /* NULL build for targets other than Darwin.  */
#endif
}


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
  2011-03-14 10:23 ` [Bug objc/48109] " mikestump at comcast dot net
  2011-03-14 10:29 ` iains at gcc dot gnu.org
@ 2011-03-14 11:27 ` rguenth at gcc dot gnu.org
  2011-03-14 11:36 ` iains at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-14 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-14 11:27:31 UTC ---
I suppose a special kind of alias could be invented here.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-03-14 11:27 ` rguenth at gcc dot gnu.org
@ 2011-03-14 11:36 ` iains at gcc dot gnu.org
  2011-03-14 18:20 ` iains at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: iains at gcc dot gnu.org @ 2011-03-14 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> 2011-03-14 11:36:29 UTC ---
(In reply to comment #3)
> I suppose a special kind of alias could be invented here.

I was thinking of a normal var - tagged with our ObjC meta-data attribute - and
then handled in the back end.

- this is supposing that varasm.c would be a valid place to recognize
ASM_DECLARE_CLASS_REFERENCE/ASM_DECLARE_UNRESOLVED_REFERENCE (or a suitable
hook to replace them)

- alternatively, the var could be zero-sized, which (together with the ObjC
meta-data attribute) can be picked up in darwin.c (but that's maybe kinda
hacky).


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-03-14 11:36 ` iains at gcc dot gnu.org
@ 2011-03-14 18:20 ` iains at gcc dot gnu.org
  2011-03-14 18:31 ` iains at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: iains at gcc dot gnu.org @ 2011-03-14 18:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> 2011-03-14 18:20:15 UTC ---
Created attachment 23653
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23653
possible fix - shifting the special case output of objc_class_name_xxxx to the
back-end.

this solves the problem of propagating the class refs/defs through LTO
... although it reveals that we have further issues when -flto-partition=none
is used 
   (duplicate meta-data definitions - however, this latter problem is not
specific to darwin and will be posted as a different PR)

... only lightly tested on i686-darwin9.

opinions?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-03-14 18:20 ` iains at gcc dot gnu.org
@ 2011-03-14 18:31 ` iains at gcc dot gnu.org
  2011-03-14 20:51 ` iains at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: iains at gcc dot gnu.org @ 2011-03-14 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.1

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> 2011-03-14 18:31:13 UTC ---
BTW, if we go this route (or almost any I can think of) we could have a
separate patch to remove 
ASM_DECLARE_CLASS_REFERENCE/ASM_DECLARE_UNRESOLVED_REFERENCE which are only
used for this one purpose AFAICT.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-03-14 18:31 ` iains at gcc dot gnu.org
@ 2011-03-14 20:51 ` iains at gcc dot gnu.org
  2011-03-14 23:39 ` mikestump at comcast dot net
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: iains at gcc dot gnu.org @ 2011-03-14 20:51 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #23653|0                           |1
        is obsolete|                            |

--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> 2011-03-14 20:51:24 UTC ---
Created attachment 23655
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23655
possible fix v2 - shifting the special case output of objc_class_name_xxxx to
the back-end.

improved version (more logical in that it actually makes the reference into a
real reference in the absence of the hook).

built on i686-linux as well as i686-darwin9 ... seems to produce the expected
output on both.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2011-03-14 20:51 ` iains at gcc dot gnu.org
@ 2011-03-14 23:39 ` mikestump at comcast dot net
  2011-04-28 16:12 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mikestump at comcast dot net @ 2011-03-14 23:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Mike Stump <mikestump at comcast dot net> 2011-03-14 23:39:21 UTC ---
Seems reasonable to me...


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2011-03-14 23:39 ` mikestump at comcast dot net
@ 2011-04-28 16:12 ` rguenth at gcc dot gnu.org
  2011-06-29 20:09 ` iains at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-28 16:12 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.6.1                       |---


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2011-04-28 16:12 ` rguenth at gcc dot gnu.org
@ 2011-06-29 20:09 ` iains at gcc dot gnu.org
  2012-07-09  8:43 ` iains at gcc dot gnu.org
  2013-09-01 20:11 ` iains at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: iains at gcc dot gnu.org @ 2011-06-29 20:09 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #23655|0                           |1
        is obsolete|                            |
         AssignedTo|unassigned at gcc dot       |iains at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #9 from Iain Sandoe <iains at gcc dot gnu.org> 2011-06-29 20:08:33 UTC ---
Created attachment 24641
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24641
updated to trunk @175628.

this patch posted to GCC-patches:

http://gcc.gnu.org/ml/gcc-patches/2011-06/msg02268.html


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2011-06-29 20:09 ` iains at gcc dot gnu.org
@ 2012-07-09  8:43 ` iains at gcc dot gnu.org
  2013-09-01 20:11 ` iains at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: iains at gcc dot gnu.org @ 2012-07-09  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Iain Sandoe <iains at gcc dot gnu.org> 2012-07-09 08:43:33 UTC ---
this is now fixed on trunk by:
http://gcc.gnu.org/viewcvs?view=revision&revision=188793

We will have to consider whether it is a reasonable back-port (at least to
4.7). Although it touches objc and doc, it is localized in effect to Darwin.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug objc/48109] Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1
  2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2012-07-09  8:43 ` iains at gcc dot gnu.org
@ 2013-09-01 20:11 ` iains at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: iains at gcc dot gnu.org @ 2013-09-01 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from Iain Sandoe <iains at gcc dot gnu.org> ---
back-ported to 4.7 (sorry it took so long) as 202155, thus fixed.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-09-01 20:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-14  9:37 [Bug objc/48109] New: Objective-C class defs/refs are lost under LTO on Darwin for ABI0/1 iains at gcc dot gnu.org
2011-03-14 10:23 ` [Bug objc/48109] " mikestump at comcast dot net
2011-03-14 10:29 ` iains at gcc dot gnu.org
2011-03-14 11:27 ` rguenth at gcc dot gnu.org
2011-03-14 11:36 ` iains at gcc dot gnu.org
2011-03-14 18:20 ` iains at gcc dot gnu.org
2011-03-14 18:31 ` iains at gcc dot gnu.org
2011-03-14 20:51 ` iains at gcc dot gnu.org
2011-03-14 23:39 ` mikestump at comcast dot net
2011-04-28 16:12 ` rguenth at gcc dot gnu.org
2011-06-29 20:09 ` iains at gcc dot gnu.org
2012-07-09  8:43 ` iains at gcc dot gnu.org
2013-09-01 20:11 ` iains at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).