/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1988 AT&T
* All Rights Reserved
*
*/
/*
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
* Publicly available flags are defined in ld(1). The following flags are
* private, and may be removed at any time.
*
* OPTION MEANING
*
* -z dtrace=symbol assigns symbol to PT_SUNWDTRACE segment,
* providing scratch area for dtrace processing.
*
* -z noreloc suppress relocation processing. This provides
* a mechanism for validating kernel module symbol
* resolution that would normally incur fatal
* relocation errors.
*
* -z rtldinfo=symbol assigns symbol to SUNW_RTLDINF dynamic tag,
* providing pre-initialization specific routines
* for TLS initialization.
*
* -z nointerp suppress the addition of an interpreter
* section. This is used to generate the kernel,
* but makes no sense to be used by anyone else.
*
* -z norelaxreloc suppress the automatic addition of relaxed
*
* -z nosighandler suppress the registration of the signal handler
* used to manage SIGBUS.
*/
/*
* The following flags are committed, and will not be removed, but are
* not publically documented, either because they are obsolete, or because
* they exist to work around defects in other software and are not of
* sufficient interest otherwise.
*
* OPTION MEANING
*
* -Wl,... compiler drivers and configuration tools
* have been known to pass this compiler option
* to ld(1). Strip off the "-Wl," prefix and
* process the remainder (...) as a normal option.
*/
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <elf.h>
#include <unistd.h>
#include <debug.h>
#include "msg.h"
#include "_libld.h"
/*
* Define a set of local argument flags, the settings of these will be
* verified in check_flags() and lead to the appropriate output file flags
* being initialized.
*/
typedef enum {
SET_FALSE = 0,
} Setstate;
/*
* ztflag's state is set by pointing it to the matching string:
* text | textoff | textwarn
*/
/*
* Remember the guidance flags that result from the initial -z guidance
* option, so that they can be compared to any that follow. We only want
* to issue a warning when they differ.
*/
/*
* Print usage message to stderr - 2 modes, summary message only,
* and full usage message.
*/
static void
{
return;
}
/*
* Rescan the archives seen on the command line in order
* to handle circularly dependent archives, stopping when
* no further member extraction occurs.
*
* entry:
* ofl - Output file descriptor
* isgrp - True if this is a an archive group search, False
* to search starting with argv[1] through end_arg_ndx
* end_arg_ndx - Index of final argv element to consider.
*/
static uintptr_t
{
/* If not to starting index yet, skip it */
continue;
/*
* If this archive was processed with -z allextract,
* then all members have already been extracted.
*/
continue;
/*
* Reestablish any archive specific command line flags.
*/
/*
* Re-process the archive. Note that a file descriptor
* is unnecessary, as the file is already available in
* memory.
*/
return (S_ERROR);
return (1);
}
}
return (1);
}
/*
* Checks the command line option flags for consistency.
*/
static uintptr_t
{
/*
* If the user specified -zguidance=noall, then we can safely disable
* the entire feature. The purpose of -zguidance=noall is to allow
* the user to override guidance specified from a makefile via
* the LD_OPTIONS environment variable, and so, we want to behave
* in exactly the same manner we would have if no option were present.
*/
if (rflag) {
if (dflag == SET_UNKNOWN)
/*
* Combining relocations when building a relocatable
* object isn't allowed. Warn the user, but proceed.
*/
} else {
/*
* Translating object capabilities to symbol capabilities is
* only meaningful when creating a relocatable object.
*/
/*
* If the user hasn't explicitly requested that relocations
* not be combined, combine them by default.
*/
}
if (zinflag)
if (sflag)
if (Blflag)
if (Beflag)
/*
* Set -Bdynamic on by default, setting is rechecked as input
* files are processed.
*/
if (aflag)
if (bflag)
}
/*
* If the use of default library searching has been suppressed
* but no runpaths have been provided we're going to have a hard
* job running this object.
*/
/*
* By default, text relocation warnings are given when building
* an executable unless the -b flag is specified. This option
* implies that unclean text can be created, so no warnings are
* generated unless specifically asked for.
*/
}
/*
* Create a dynamic object. -Bdirect indicates that all
* references should be bound directly. This also
* enables lazyloading. Individual symbols can be
* bound directly (or not) using mapfiles and the
* DIRECT (NODIRECT) qualifier. With this capability,
* each syminfo entry is tagged SYMINFO_FLG_DIRECTBIND.
* Prior to this per-symbol direct binding, runtime
* direct binding was controlled via the DF_1_DIRECT
* flag. This flag affected all references from the
* object. -Bdirect continues to set this flag, and
* thus provides a means of taking a newly built
* direct binding object back to older systems.
*
* NOTE, any use of per-symbol NODIRECT bindings, or
* -znodirect, will disable the creation of the
* DF_1_DIRECT flag. Older runtime linkers do not
* have the capability to do per-symbol direct bindings.
*/
}
/*
* -Bnodirect disables directly binding to any symbols
* exported from the object being created. Individual
* references to external objects can still be affected
* by -zdirect or mapfile DIRECT directives.
*/
}
}
/*
* Dynamically linked executable.
*/
/*
* -z textwarn is the default for executables, and
* only an explicit -z text* option can change that,
* so there's no need to provide additional guidance.
*/
if (Bsflag)
if (ofl->ofl_soname)
} else if (!rflag) {
/*
* Shared library.
*/
/*
* By default, print text relocation warnings for
* executables but *not* for shared objects. However,
* if -z guidance is on, issue warnings for shared
* objects as well.
*
* If -z textwarn is explicitly specified, also issue
* guidance messages if -z guidance is on, but not
* for -z text or -z textoff.
*/
}
if (Bsflag) {
/*
* -Bsymbolic, and -Bnodirect make no sense.
*/
}
} else {
/*
* Dynamic relocatable object.
*/
if (ofl->ofl_interp)
}
} else {
if (bflag)
if (ofl->ofl_soname)
if (ofl->ofl_depaudit)
if (ofl->ofl_config)
if (ztflag)
if (Gflag)
if (rflag) {
/*
* We can only strip the symbol table and string table
* if no output relocations will refer to them.
*/
if (sflag)
if (ofl->ofl_interp)
} else {
/*
* Static executable.
*/
}
}
/*
* If the user didn't supply an output file name supply a default.
*/
/*
* We set the entrance criteria after all input argument processing as
* it is only at this point we're sure what the output image will be
* (static or dynamic).
*/
return (S_ERROR);
/*
* Does the host currently running the linker have the same
* byte order as the target for which the object is being produced?
* If not, set FLG_OF1_ENCDIFF so relocation code will know
* to check.
*/
/*
* If the target has special executable section filling requirements,
* register the fill function with libelf
*/
/*
* Initialize string tables. Symbol definitions within mapfiles can
* result in the creation of input sections.
*/
return (S_ERROR);
/*
* so this must come after the default entrance criteria are established
* (above).
*/
const char *name;
return (S_ERROR);
if (!ld_map_post_process(ofl))
return (S_ERROR);
}
/*
* If a mapfile has been used to define a single symbolic scope of
* interfaces, -Bsymbolic is established. This global setting goes
* beyond individual symbol protection, and ensures all relocations
* (even those that reference section symbols) are processed within
* the object being built.
*/
}
/*
* If -zloadfltr is set, verify that filtering is in effect. Filters
* are either established from the command line, and affect the whole
* object, or are set on a per-symbol basis from a mapfile.
*/
if (zlflag) {
}
/*
* Check that we have something to work with. This check is carried out
* after mapfile processing as its possible a mapfile is being used to
* define symbols, in which case it would be sufficient to build the
* output file purely from the mapfile.
*/
if ((Vflag ||
(argc == 2)) {
} else {
return (S_ERROR);
}
}
return (1);
}
/*
* Decompose the string pointed by optarg into argv[][] so that argv[][] can be
* used as an argument to getopt().
*
* If the second argument 'usage' is not NULL, then this is called from the
* first pass. Else this is called from the second pass.
*/
static uintptr_t
{
/*
* The argument being examined is either:
* ld32= or
* ld64=
*/
#if defined(_LP64)
return (0);
#else
return (0);
#endif
/*
* Count the number of arguments.
*/
while (*p0) {
/*
* Pointing at non-separator character.
*/
if (*p0 != ',') {
argc++;
p0++;
continue;
}
/*
* Pointing at a separator character.
*/
if (*p0 == ',') {
while (*p0 == ',')
p0++;
continue;
}
}
if (argc == 0)
return (0);
/*
* Allocate argument vector.
*/
return (S_ERROR);
return (S_ERROR);
while (*p0) {
char *p;
/*
* Pointing at the beginning of non-separator character string.
*/
if (*p0 != ',') {
p = p0;
p0++;
if (*p0) {
*p0 = '\0';
p0++;
}
continue;
}
/*
* Pointing at the beginining of separator character string.
*/
if (*p0 == ',') {
while (*p0 == ',')
p0++;
continue;
}
}
optind = 0;
/*
* Dispatch to pass1 or pass2
*/
if (usage)
else
return (ret);
}
/*
* Parse the items in a '-z guidance' value, and set the ofl_guideflags.
* A guidance option looks like this:
*
* -z guidance[=item1,item2,...]
*
* Where each item specifies categories of guidance messages to suppress,
* each starting with the prefix 'no'. We allow arbitrary whitespace between
* the items, allow multiple ',' delimiters without an intervening item, and
* quietly ignore any items we don't recognize.
*
* - Such items are likely to be known to newer versions of the linker,
* and we do not want an older version of the linker to
* complain about them.
*
* - Times and standards can change, and so we wish to reserve the
* right to make an old item that no longer makes sense go away.
* Quietly ignoring unrecognized items facilitates this.
*
* However, we always display unrecognized items in debug output.
*
* entry:
* ofl - Output descriptor
* optarg - option string to be processed. This will either be a NULL
* terminated 'guidance', or it will be 'guidance=' followed
* by the item tokens as described above.
*
* exit:
* Returns TRUE (1) on success, FALSE (0) on failure.
*
*/
static Boolean
{
typedef struct {
const char *name;
} item_desc;
{ NULL, 0 }
};
/*
* Skip the 'guidance' prefix. If NULL terminated, there are no
* item values to parse. Otherwise, skip the '=' and parse the items.
*/
if (*optarg == '=') {
optarg++;
return (FALSE);
do {
break;
continue;
}
}
}
/*
* If -zguidance is used more than once, we take the first one. We
* do this quietly if they have identical options, and with a warning
* otherwise.
*/
if ((initial_guidance_flags & FLG_OFG_ENABLE) &&
(ofl_guideflags != initial_guidance_flags)) {
return (TRUE);
}
/*
* First time: Save the flags for comparison to any subsequent
* -z guidance that comes along, and OR the resulting flags into
* the flags kept in the output descriptor.
*/
return (TRUE);
}
/*
* Parse the -z assert-deflib option. This option can appear in two different
* forms:
* -z assert-deflib
* -z assert-deflib=libfred.so
*
* Either form enables this option, the latter form marks libfred.so as an
* exempt library from the check. It is valid to have multiple invocations of
* the second form. We silently ignore mulitple occurrences of the first form
* and multiple invocations of the first form when the second form also occurs.
*
* We only return false when we have an internal error, such as the failure of
* aplist_append. Every other time we return true, but we have the appropriate
* fatal flags set beacuse of the ld_eprintf.
*/
static int
{
/* Minimum size of assert-deflib=lib%s.so */
if (olen > MSG_ARG_ASSDEFLIB_SIZE) {
return (TRUE);
}
return (TRUE);
}
return (FALSE);
}
return (TRUE);
}
static int optitle = 0;
/*
* Parsing options pass1 for process_flags().
*/
static uintptr_t
{
/*
* The -32, -64 and -ztarget options are special, in that we validate
* them, but otherwise ignore them. libld.so (this code) is called
* from the ld front end program. ld has already examined the
* arguments to determine the output class and machine type of the
* output object, as reflected in the version (32/64) of ld_main()
* that was called and the value of the 'mach' argument passed.
* By time execution reaches this point, these options have already
* been seen and acted on.
*/
switch (c) {
case '3':
/*
* -32 is processed by ld to determine the output class.
* Here we sanity check the option incase some other
* -3* option is mistakenly passed to us.
*/
if (optarg[0] != '2')
continue;
case '6':
/*
* -64 is processed by ld to determine the output class.
* Here we sanity check the option incase some other
* -6* option is mistakenly passed to us.
*/
if (optarg[0] != '4')
continue;
case 'a':
break;
case 'b':
/*
* This is a hack, and may be undone later.
* The -b option is only used to build the Unix
* kernel and its related kernel-mode modules.
* We do not want those files to get a .SUNW_ldynsym
* section. At least for now, the kernel makes no
* use of .SUNW_ldynsym, and we do not want to use
* the space to hold it. Therefore, we overload
* the use of -b to also imply -znoldynsym.
*/
break;
case 'c':
if (ofl->ofl_config)
else
break;
case 'C':
demangle_flag = 1;
break;
case 'd':
if (dflag != SET_UNKNOWN)
else
if (dflag != SET_UNKNOWN)
else
} else {
}
break;
case 'e':
else
break;
case 'f':
if (ofl->ofl_filtees &&
} else {
if ((ofl->ofl_filtees =
(const char *)S_ERROR)
return (S_ERROR);
}
break;
case 'F':
if (ofl->ofl_filtees &&
} else {
if ((ofl->ofl_filtees =
(const char *)S_ERROR)
return (S_ERROR);
}
break;
case 'h':
if (ofl->ofl_soname)
else
break;
case 'i':
break;
case 'I':
if (ofl->ofl_interp)
else
break;
case 'l':
/*
* For now, count any library as a shared object. This
* is used to size the internal symbol cache. This
* value is recalculated later on actual file processing
* to get an accurate shared object count.
*/
ofl->ofl_soscnt++;
break;
case 'm':
break;
case 'o':
else
break;
case 'p':
/*
* Multiple instances of this option may occur. Each
* additional instance is effectively concatenated to
* the previous separated by a colon.
*/
if (*optarg != '\0') {
return (S_ERROR);
}
break;
case 'P':
/*
* Multiple instances of this option may occur. Each
* additional instance is effectively concatenated to
* the previous separated by a colon.
*/
if (*optarg != '\0') {
if ((ofl->ofl_depaudit =
return (S_ERROR);
}
break;
case 'r':
break;
case 'R':
/*
* Multiple instances of this option may occur. Each
* additional instance is effectively concatenated to
* the previous separated by a colon.
*/
if (*optarg != '\0') {
return (S_ERROR);
}
break;
case 's':
break;
case 't':
break;
case 'u':
break;
case 'z':
/*
* For specific help, print our usage message and exit
* immediately to ensure a 0 return code.
*/
MSG_ARG_HELP_SIZE) == 0) {
exit(0);
}
/*
* For some options set a flag - further consistancy
* checks will be carried out in check_flags().
*/
MSG_ARG_LD32_SIZE) == 0) ||
MSG_ARG_LD64_SIZE) == 0)) {
return (S_ERROR);
} else if (
if (zdflag != SET_UNKNOWN)
else
MSG_ORIG(MSG_ARG_NODEFS)) == 0) {
if (zdflag != SET_UNKNOWN)
else
MSG_ORIG(MSG_ARG_TEXT)) == 0) {
if (ztflag &&
ztflag);
MSG_ORIG(MSG_ARG_TEXTOFF)) == 0) {
if (ztflag &&
ztflag);
MSG_ORIG(MSG_ARG_TEXTWARN)) == 0) {
if (ztflag &&
ztflag);
/*
* For other options simply set the ofl flags directly.
*/
MSG_ORIG(MSG_ARG_RESCAN)) == 0) {
MSG_ORIG(MSG_ARG_ABSEXEC)) == 0) {
MSG_ORIG(MSG_ARG_LOADFLTR)) == 0) {
MSG_ORIG(MSG_ARG_NORELOC)) == 0) {
MSG_ORIG(MSG_ARG_NOVERSION)) == 0) {
MSG_ORIG(MSG_ARG_MULDEFS)) == 0) {
MSG_ORIG(MSG_ARG_REDLOCSYM)) == 0) {
MSG_ORIG(MSG_ARG_INITFIRST)) == 0) {
MSG_ORIG(MSG_ARG_NODELETE)) == 0) {
MSG_ORIG(MSG_ARG_NOPARTIAL)) == 0) {
MSG_ORIG(MSG_ARG_NOOPEN)) == 0) {
MSG_ORIG(MSG_ARG_NOW)) == 0) {
MSG_ORIG(MSG_ARG_ORIGIN)) == 0) {
MSG_ORIG(MSG_ARG_NODEFAULTLIB)) == 0) {
MSG_ORIG(MSG_ARG_NODUMP)) == 0) {
MSG_ORIG(MSG_ARG_ENDFILTEE)) == 0) {
MSG_ORIG(MSG_ARG_VERBOSE)) == 0) {
MSG_ORIG(MSG_ARG_COMBRELOC)) == 0) {
MSG_ORIG(MSG_ARG_NOCOMBRELOC)) == 0) {
MSG_ORIG(MSG_ARG_NOCOMPSTRTAB)) == 0) {
MSG_ORIG(MSG_ARG_NOINTERP)) == 0) {
MSG_ORIG(MSG_ARG_INTERPOSE)) == 0) {
MSG_ORIG(MSG_ARG_IGNORE)) == 0) {
MSG_ORIG(MSG_ARG_RELAXRELOC)) == 0) {
MSG_ORIG(MSG_ARG_NORELAXRELOC)) == 0) {
MSG_ORIG(MSG_ARG_NOLDYNSYM)) == 0) {
MSG_ORIG(MSG_ARG_GLOBAUDIT)) == 0) {
MSG_ORIG(MSG_ARG_NOSIGHANDLER)) == 0) {
MSG_ORIG(MSG_ARG_SYMBOLCAP)) == 0) {
/*
* Check archive group usage
* -z rescan-start ... -z rescan-end
* to ensure they don't overlap and are well formed.
*/
MSG_ORIG(MSG_ARG_RESCAN_START)) == 0) {
if (ofl->ofl_ars_gsandx == 0) {
} else if (ofl->ofl_ars_gsandx > 0) {
/* Another group is still open */
/* Don't report cascading errors */
}
MSG_ORIG(MSG_ARG_RESCAN_END)) == 0) {
if (ofl->ofl_ars_gsandx > 0) {
ofl->ofl_ars_gsandx = 0;
} else if (ofl->ofl_ars_gsandx == 0) {
/* There was no matching begin */
/* Don't report cascading errors */
}
/*
* If -z wrap is seen, enter the symbol to be wrapped
* into the wrap AVL tree.
*/
MSG_ARG_WRAP_SIZE) == 0) {
if (ld_wrap_enter(ofl,
return (S_ERROR);
MSG_ARG_ASLR_SIZE) == 0) {
char *p = optarg + MSG_ARG_ASLR_SIZE;
if (*p == '\0') {
} else if (*p == '=') {
p++;
if ((strcmp(p,
MSG_ORIG(MSG_ARG_ENABLED)) == 0) ||
(strcmp(p,
MSG_ORIG(MSG_ARG_ENABLE)) == 0)) {
} else if ((strcmp(p,
MSG_ORIG(MSG_ARG_DISABLED)) == 0) ||
(strcmp(p,
MSG_ORIG(MSG_ARG_DISABLE)) == 0)) {
} else {
MSG_ORIG(MSG_ARG_ZASLR), p);
return (S_ERROR);
}
} else {
return (S_ERROR);
}
MSG_ARG_GUIDE_SIZE) == 0) &&
return (S_ERROR);
MSG_ORIG(MSG_ARG_FATWARN)) == 0) {
} else {
}
MSG_ORIG(MSG_ARG_NOFATWARN)) == 0) {
else
/*
* Process everything related to -z assert-deflib. This
* must be done in pass 1 because it gets used in pass
* 2.
*/
MSG_ARG_ASSDEFLIB_SIZE) == 0) {
return (S_ERROR);
/*
* The following options just need validation as they
* are interpreted on the second pass through the
* command line arguments.
*/
} else if (
}
break;
case 'D':
/*
* If we have not yet read any input files go ahead
* and process any debugging options (this allows any
* argument processing, entrance criteria and library
* initialization to be displayed). Otherwise, if an
* input file has been seen, skip interpretation until
* process_files (this allows debugging to be turned
* on and off around individual groups of files).
*/
Dflag = 1;
if (ofl->ofl_objscnt == 0) {
return (S_ERROR);
}
/*
* A diagnostic can only be provided after dbg_setup().
* As this is the first diagnostic that can be produced
* by ld(1), issue a title for timing and basic output.
*/
if ((optitle == 0) && DBG_ENABLED) {
optitle++;
}
break;
case 'B':
} else {
}
MSG_ORIG(MSG_ARG_NODIRECT)) == 0) {
} else {
}
MSG_ORIG(MSG_STR_SYMBOLIC)) == 0)
MSG_ORIG(MSG_STR_ELIMINATE)) == 0)
MSG_ORIG(MSG_ARG_TRANSLATOR)) == 0) {
}
break;
case 'G':
break;
case 'L':
break;
case 'M':
AL_CNT_OFL_MAPFILES) == NULL)
return (S_ERROR);
break;
case 'N':
break;
case 'Q':
if (Qflag != SET_UNKNOWN)
else
if (Qflag != SET_UNKNOWN)
else
} else {
}
break;
case 'S':
AL_CNT_SUPPORT) == NULL)
return (S_ERROR);
break;
case 'V':
if (!Vflag)
break;
case 'Y':
if (Llibdir)
else
if (Ulibdir)
else
if (Plibpath)
else
} else {
}
break;
case '?':
/*
* If the option character is '-', we're looking at a
* long option which couldn't be translated, display a
* more useful error.
*/
if (optopt == '-') {
} else {
}
(*usage)++;
break;
default:
break;
}
/*
* Update the argument index for the next getopt() iteration.
*/
}
return (1);
}
/*
* Parsing options pass2 for
*/
static uintptr_t
{
switch (c) {
case 'l':
optarg));
return (S_ERROR);
break;
case 'B':
optarg));
MSG_ORIG(MSG_STR_LD_DYNAMIC)) == 0) {
else {
}
MSG_ORIG(MSG_ARG_STATIC)) == 0)
break;
case 'L':
optarg));
return (S_ERROR);
break;
case 'N':
optarg));
/*
* Record DT_NEEDED string
*/
AL_CNT_OFL_LIBS) == NULL))
return (S_ERROR);
break;
case 'D':
optarg));
break;
case 'u':
optarg));
return (S_ERROR);
break;
case 'z':
optarg));
MSG_ARG_LD32_SIZE) == 0) ||
MSG_ARG_LD64_SIZE) == 0)) {
return (S_ERROR);
MSG_ORIG(MSG_ARG_ALLEXTRT)) == 0) {
MSG_ORIG(MSG_ARG_WEAKEXT)) == 0) {
MSG_ORIG(MSG_ARG_DFLEXTRT)) == 0) {
ofl->ofl_flags1 &=
~(FLG_OF1_ALLEXRT |
MSG_ORIG(MSG_ARG_DIRECT)) == 0) {
MSG_ORIG(MSG_ARG_NODIRECT)) == 0) {
MSG_ORIG(MSG_ARG_IGNORE)) == 0) {
MSG_ORIG(MSG_ARG_RECORD)) == 0) {
MSG_ORIG(MSG_ARG_LAZYLOAD)) == 0) {
MSG_ORIG(MSG_ARG_NOLAZYLOAD)) == 0) {
MSG_ORIG(MSG_ARG_GROUPPERM)) == 0) {
MSG_ORIG(MSG_ARG_NOGROUPPERM)) == 0) {
MSG_ARG_INITARRAY_SIZE) == 0) {
MSG_STR_COMMAND)) ==
return (S_ERROR);
MSG_ARG_FINIARRAY_SIZE) == 0) {
MSG_STR_COMMAND)) ==
return (S_ERROR);
MSG_ARG_PREINITARRAY_SIZE) == 0) {
MSG_STR_COMMAND)) ==
return (S_ERROR);
MSG_ARG_RTLDINFO_SIZE) == 0) {
MSG_STR_COMMAND)) ==
return (S_ERROR);
MSG_ARG_DTRACE_SIZE) == 0) {
MSG_STR_COMMAND)) ==
return (S_ERROR);
MSG_ORIG(MSG_ARG_RESCAN_NOW)) == 0) {
return (S_ERROR);
MSG_ORIG(MSG_ARG_RESCAN_START)) == 0) {
MSG_ORIG(MSG_ARG_RESCAN_END)) == 0) {
return (S_ERROR);
MSG_ORIG(MSG_ARG_DEFERRED)) == 0) {
MSG_ORIG(MSG_ARG_NODEFERRED)) == 0) {
}
default:
break;
}
/*
* Update the argument index for the next getopt() iteration.
*/
}
return (1);
}
/*
*
* Pass 1 -- process_flags: collects all options and sets flags
*/
static uintptr_t
{
/*
* If we detect some more options return to getopt().
* Checking argv[optind][1] against null prevents a forever
* loop if an unadorned `-' argument is passed to us.
*/
return (S_ERROR);
continue;
}
break;
ofl->ofl_objscnt++;
}
/* Did an unterminated archive group run off the end? */
if (ofl->ofl_ars_gsandx > 0) {
return (S_ERROR);
}
return (1);
}
{
if (argc < 2) {
return (S_ERROR);
}
/*
* Option handling
*/
opterr = 0;
optind = 1;
return (S_ERROR);
/*
* Having parsed everything, did we have any usage errors.
*/
if (usage) {
return (S_ERROR);
}
}
/*
* Pass 2 -- process_files: skips the flags collected in pass 1 and processes
* files.
*/
static uintptr_t
{
int fd;
char *path;
/*
* If we detect some more options return to getopt().
* Checking argv[optind][1] against null prevents a forever
* loop if an unadorned `-' argument is passed to us.
*/
return (S_ERROR);
continue;
}
break;
continue;
}
if (fd != -1)
return (S_ERROR);
/*
* Check for mismatched input.
*/
return (1);
}
}
return (1);
}
{
/*
* Process command line files (taking into account any applicable
* preceding flags). Return if any fatal errors have occurred.
*/
opterr = 0;
optind = 1;
return (S_ERROR);
return (1);
/*
*
* This is a backstop for the case where the link had no dependencies.
* Otherwise, it will get caught by ld_process_ifl(). We need both,
* because -z direct is positional, and its value at the time where
* the first dependency is seen might be different than it is now.
*/
}
/*
* Now that all command line files have been processed see if there are
* any additional `needed' shared object dependencies.
*/
if (ofl->ofl_soneed)
return (S_ERROR);
/*
* If rescanning archives is enabled, do so now to determine whether
* there might still be members extracted to satisfy references from any
* explicit objects. Continue until no new objects are extracted. Note
* that this pass is carried out *after* processing any implicit objects
* (above) as they may already have resolved any undefined references
* from any explicit dependencies.
*/
return (S_ERROR);
return (1);
}
/*
* If debugging, provide statistics on each archives extraction, or flag
* any archive that has provided no members. Note that this could be a
* nice place to free up much of the archive infrastructure, as we've
* extracted any members we need. However, as we presently don't free
* anything under ld(1) there's not much point in proceeding further.
*/
/*
* If any version definitions have been established, either via input
* from a mapfile or from the input relocatable objects, make sure any
* version dependencies are satisfied, and version symbols created.
*/
if (ofl->ofl_verdesc)
return (S_ERROR);
/*
* If input section ordering was specified within some segment
* using a mapfile, verify that the expected sections were seen.
*/
return (1);
}
{
stflags = 0;
else
return (S_ERROR);
return (0);
}