From sacadmin Fri May 15 10:28:42 2009
Received: from sac.sfbay.sun.com (localhost [127.0.0.1])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n4FHSgZu022654;
	Fri, 15 May 2009 10:28:42 -0700 (PDT)
Received: (from ab196087@localhost)
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8/Submit) id n4FHSfKx022650;
	Fri, 15 May 2009 10:28:41 -0700 (PDT)
Date: Fri, 15 May 2009 10:28:41 -0700 (PDT)
From: Ali Bahrami <ab196087@sac.sfbay.sun.com>
Message-Id: <200905151728.n4FHSfKx022650@sac.sfbay.sun.com>
To: PSARC-record@sac.sfbay.sun.com
Subject: ld -32 option [PSARC/2009/305 Self Review]
Status: RO
Content-Length: 544


Template Version: @(#)sac_nextcase 1.68 02/23/09 SMI
This information is Copyright 2009 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
	 ld -32 option
    1.2. Name of Document Author/Supplier:
	 Author:  Ali Bahrami
    1.3  Date of This Document:
	15 May, 2009
4. Technical Description
    See the case directory for more detail

6. Resources and Schedule
    6.4. Steering Committee requested information
   	6.4.1. Consolidation C-team Name:
		on
    6.5. ARC review type: Automatic
    6.6. ARC Exposure: open


From Ali.Bahrami@sun.com Fri May 15 13:00:28 2009
Received: from sunmail3mpk.sfbay.sun.com (sunmail3mpk.SFBay.Sun.COM [129.146.11.52])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n4FK0SX6023102
	for <psarc-ext@sac.sfbay.sun.com>; Fri, 15 May 2009 13:00:28 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail3mpk.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n4FK0QN4028055
	for <@sunmail2sca.sfbay.sun.com:psarc-ext@sun.com>; Fri, 15 May 2009 13:00:27 -0700 (PDT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KJP0020TBKNMO00@nwk-avmta-2.sfbay.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Fri, 15 May 2009 13:00:23 -0700 (PDT)
Received: from brmea-mail-2.sun.com ([192.18.98.43])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KJP00EF6BKM97C0@nwk-avmta-2.sfbay.sun.com> for
 psarc-ext@sun.com (ORCPT psarc-ext@sun.com); Fri,
 15 May 2009 13:00:22 -0700 (PDT)
Received: from fe-amer-10.sun.com ([192.18.109.80])
	by brmea-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id n4FK0QF6000225	for
 <psarc-ext@sun.com>; Fri, 15 May 2009 20:00:26 +0000 (GMT)
Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009))
 id <0KJP00F00BIC0X00@mail-amer.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Fri, 15 May 2009 14:00:26 -0600 (MDT)
Received: from [172.20.25.67] ([unknown] [172.20.25.67])
 by mail-amer.sun.com (Sun Java(tm) System Messaging Server 7u2-7.02 64bit
 (built Apr 16 2009)) with ESMTPSA id <0KJP00AT8BK7Y1E0@mail-amer.sun.com> for
 psarc-ext@sun.com (ORCPT psarc-ext@sun.com); Fri,
 15 May 2009 14:00:07 -0600 (MDT)
Date: Fri, 15 May 2009 13:59:07 -0600
From: Ali Bahrami <Ali.Bahrami@sun.com>
Subject: PSARC 2009/305  ld -32 option
Sender: Ali.Bahrami@sun.com
To: psarc-ext@sun.com
Message-id: <4A0DC98B.10604@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
User-Agent: Thunderbird 2.0.0.21 (X11/20090323)
Status: RO
Content-Length: 4225

I am sponsoring the following self-reviewed case for myself.

It adds new option (-32) to the Solaris link-editor (ld). I believe
it qualifies for self review:

     - It is a straightforward variation on the existing -64 option.

     - It follows established convention for linker related
       tools (i.e, moe(1) already documents a -32 option).

This option can be used to tell the link-editor that a
32-bit output object is required. I expect it to be used
in rare cases where an archive contains both 32 and 64-bit
objects and a 32-bit result is required. It will be integrated
as part of:

    6784790 ld should examine archives to determine output object class/machine

Diffs for the changes to the proposed new ld(1) manpage are shown below.

-----

Release Binding:				Patch/Micro

New ld options:
	-32					Committed

-----

--- ld.orig	Wed May 13 13:47:12 2009
+++ ld.new	Fri May 15 11:44:45 2009
@@ -10,7 +10,7 @@
       ld - link-editor for object files

  SYNOPSIS
-     ld [-64] [-a | -r] [-b] [-Bdirect | nodirect]
+     ld [-32 | -64] [-a | -r] [-b] [-Bdirect | nodirect]
       [-B dynamic | static] [-B eliminate] [-B group] [-B local]
       [-B reduce] [-B symbolic] [-c name] [-C] [-d y | n]
       [-D token,...] [-e epsym] [-f name | -F name] [-G] [-h name]
@@ -120,7 +120,7 @@
       the command line to govern the mode in which to operate. The
       mixing of 32-bit objects and 64-bit objects is  not  permit-
       ted.  Similarly,  only  objects of a single machine type are
-     allowed.  See  the  -64  and  -z  target  options,  and  the
+     allowed.  See the -32, -64  and  -z target options, and  the
       LD_NOEXEC_64 environment variable.


@@ -168,17 +168,29 @@
  OPTIONS
       The following options are supported.

-     -64
+     -32 | -64

-         Creates a 64-bit object. By default, the  class  of  the
-         object  being generated is determined from the first ELF
-         object processed from the command line. This  option  is
-         useful  when  creating  an object directly with ld whose
-         input is solely from an archive library  or  a  mapfile.
-         See  The  32-bit  link-editor  and 64-bit link-editor in
-         Linker and Libraries Guide.
+        Creates a 32-bit, or 64-bit object.

+        By default, the class of the object being generated is
+        determined from the first ELF object processed from the
+        command line. If no objects are specified, the class is
+        determined by the first object encountered within the
+        first archive processed from the command line. If there
+        are no objects or archives, the link-editor creates a
+        32-bit object.

+        The -64 option is required to create a 64-bit object
+        solely from a mapfile.
+
+        The -32 or -64 options can also be used in the rare case
+        of linking entirely from an archive that contains a
+        mixture of 32-bit and 64-bit objects. If the first object
+        in the archive is not the class of the object that is
+        required to be created, then the -32 or -64 option can be
+        used to direct the link-edit. See The 32-bit link-editor
+        and 64-bit link-editor in Linker and Libraries Guide.
+
       -a

           In static mode only, produces an executable object file.
@@ -1327,9 +1339,16 @@


           the first ELF object processed from  the  command  line.
+	 If no objects are specified, the machine type is determined
+	 by the first object encountered within the first archive
+	 processed from the command line. If there are no objects
+	 or archives, the link-editor assumes the native machine.
           This  option  is useful when creating an object directly
-         with ld whose input is solely from an archive library or
-         a mapfile. See the -M option. See The 32-bit link-editor
+         with ld whose input is solely from a mapfile. It can also
+	 be useful in the rare case of linking entirely from an
+	 archive that that contains objects of different machine
+	 types for which the first object is not of the desired
+	 machine type. See the -M option. See The 32-bit link-editor
           and 64-bit link-editor in Linker and Libraries Guide.


