groups.c revision ef16f6b5e980be84e2248939502c5aa269ef026d
/*
* 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
*/
/*
*/
#include <stdio.h>
#include <string.h>
#include <link.h>
#include <debug.h>
#include "msg.h"
#include "_libld.h"
/*
* 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 a groups avl tree if required.
*/
return (S_ERROR);
}
/*
* An SHT_GROUP section is identified by the name of its signature
* symbol rather than section name. Although the section names are
* often unique, this is not required, and some compilers set it to
* a generic name like ".group".
*/
return (1);
}
/*
* This is a new group - so keep 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);
}
/*
* When creating a .debug_macro section, in an attempt to make certain DWARF
* macro information shareable, the GNU compiler must construct group sections
* with a repeatable signature symbol while nevertheless having no actual
* symbol to refer to (because it relates to macros).
*
* We use this as yet another way to clue ourselves in that sloppy relocation
* will likely be required.
*
* The format of these gensym'd names is:
* wm<offset size>.<encoded path name>.<lineno>.<32byte hash>
* Where the encoded file name may be absent.
*/
static boolean_t
is_header_gensym(const char *name)
{
const char *c = NULL;
/* No room for leader, hash, and periods */
if (len < 37)
return (B_FALSE);
return (B_FALSE);
if (*c++ != '.')
return (B_FALSE);
for (; *c != '\0'; c++) {
if (!(((*c >= 'a') && (*c <= 'f')) ||
((*c >= '0') && (*c <= '9')))) {
return (B_FALSE);
}
}
return (B_TRUE);
}
{
const char *str;
int gnu_stt_section;
/*
* 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.
*/
/*
* The GNU assembler can use section symbols as the signature symbol
* as described by this comment in the gold linker (found via google):
*
* It seems that some versions of gas will create a section group
* associated with a section symbol, and then fail to give a name
* to the section symbol. In such a case, use the name of the
* section.
*
* In order to support such objects, we do the same.
*/
if (gnu_stt_section)
/*
* Generate a group descriptor.
*/
/*
* If this group is a COMDAT group, validate the signature symbol.
*/
/* If section symbol, construct a printable name for it */
(void) ld_stt_section_sym_name(gisc);
}
return (0);
}
/*
* If the signature symbol is a name generated by the GNU compiler to
* refer to a header, we need sloppy relocation.
*/
if (is_header_gensym(str)) {
}
/*
* 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);
}