PSARC 2009/305 ld -32 option

Ali Bahrami Ali.Bahrami at sun.com
Fri May 15 12:59:07 PDT 2009


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.




More information about the opensolaris-arc mailing list