groups.c revision cc7efc4fc1677c721670afcfbd54647b2269f394
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#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,
* tag the new group having the same name as discardable.
*/
{
/*
* Create an avl tree if required.
*/
return (S_ERROR);
}
return (1);
}
/*
* This is a new group, save it.
*/
return (S_ERROR);
return (0);
}
{
/*
* If this is the first SHF_GROUP section encountered for this file,
* establish what group sections exist.
*/
if (ifl->ifl_groups == 0) {
continue;
/*
* Confirm that the sh_link points to a valid section.
*/
continue;
}
if (shdr->sh_entsize == 0) {
continue;
}
/*
* Get associated symbol table.
*/
/*
* Sanity check the sh_link field (which points to
* a symbol table entry) against the size of the
* symbol table.
*/
_shdr->sh_entsize))) {
continue;
}
gd.gd_symname =
/*
* If this group is a COMDAT group, determine whether
* this 'signature' symbol has already been detected.
*/
return ((Group_desc *)S_ERROR);
return ((Group_desc *)S_ERROR);
}
}
/*
* Scan the GROUP sections associated with this file to find the
* matching group section.
*/
return (gdp);
continue;
}
return (gdp);
}
}
return (0);
}