groups.c revision 0e233487902b546a8949e2147ff8af45b1afc77c
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <string.h>
#include <link.h>
#include <debug.h>
#include "msg.h"
#include "_libld.h"
/*
* Define an AVL node for maintain group names, together with a compare function
* for the Grp_node AVL tree.
*/
typedef struct {
const char *gn_name; /* group name */
} Grp_node;
static int
{
int rc;
return (1);
return (-1);
if (rc > 0)
return (1);
if (rc < 0)
return (-1);
return (0);
}
/*
* Determine whether a (COMDAT) group has already been encountered. If so,
* indicate that the group descriptor has an overriding group (gd_oisc). This
* indication triggers the ld_place_section() to discard this group, while the
* gd_oisc information provides for complete diagnostics of the override.
* Otherwise, this is the first occurrence of this group, therefore the group
* descriptor is saved for future comparisons.
*/
static uintptr_t
{
/*
* Create an avl tree if required.
*/
return (S_ERROR);
}
return (1);
}
/*
* This is a new group, save it.
*/
return (S_ERROR);
return (0);
}
{
/*
* Scan the GROUP sections associated with this file to find the
* matching group section.
*/
return (gdp);
continue;
}
return (gdp);
}
}
return (NULL);
}
{
char *str;
/*
* Confirm that the sh_link points to a valid section.
*/
return (0);
}
if (gshdr->sh_entsize == 0) {
return (0);
}
/*
* Get the associated symbol table. Sanity check the sh_info field
* (which points to the signature symbol table entry) against the size
* of the symbol table.
*/
return (0);
}
/*
* Get the symbol name from the associated string table.
*/
/*
* Generate a group descriptor.
*/
/*
* If this group is a COMDAT group, validate the signature symbol.
*/
/* FATAL or ignore? */
return (0);
}
/*
* Validate the section indices within the group. If this is a COMDAT
* group, mark each section as COMDAT.
*/
return (0);
}
}
/*
* If this is a COMDAT group, determine whether this group has already
* been encountered, or whether this is the first instance of the group.
*/
return (S_ERROR);
/*
* Associate the group descriptor with this input file.
*/
AL_CNT_IFL_GROUPS) == NULL)
return (S_ERROR);
return (1);
}