groups.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 2004 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"
/*
* Given a group signature symbol - scan through the global list
* If this is the first time we see a group signature - add it to the
* global list.
*
* Returns:
* 0 - Group kept and added to global list.
* 1 - Group should be discarded.
*/
{
Group_desc * _gdesc;
/*
* Scan through global list - if we find a group of the
* same name - we return 0 saying this new group should
* be discarded (since only COMDAT's get here currently).
*/
return (1);
}
return (S_ERROR);
return (0);
}
{
/*
* If this is the first section of with the SHF_GROUP flag
* set - then we havn't yet scanned for - and found our
* group sections. If thats so - do it now.
*/
const char *symname;
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;
}
return ((Group_desc *)S_ERROR);
/*
* If this group is a COMDAT group - then we
* need to find the 'signature' symbol to determine
* if this is group is to be kept or discarded.
*/
== S_ERROR)
return ((Group_desc *)S_ERROR);
}
}
return ((Group_desc *)S_ERROR);
}
}
/*
* Now we scan through the GROUP sections associated with
* this file - to find the matching group section.
*/
size_t i;
return (gdesc);
}
continue;
}
return (gdesc);
}
}
}
return ((Group_desc *)0);
}