/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
For further information regarding this notice, see:
*/
#include "config.h"
#include "libdwarfdefs.h"
#include <stdio.h>
#include <string.h>
/*#include <elfaccess.h> */
#include "pro_incl.h"
#include "pro_section.h"
#include "pro_reloc.h"
#include "pro_reloc_symbolic.h"
/*
Return DW_DLV_ERROR on malloc error.
Return DW_DLV_OK otherwise
*/
int
int base_sec_index,
enum Dwarf_Rel_Type type,
int reltarget_length)
{
/* get a slot, fill in the slot entry */
void *relrec_to_fill = 0;
int res = 0;
return res;
return DW_DLV_OK;
}
/*
Return DW_DLV_ERROR on malloc error.
Return DW_DLV_OK otherwise
*/
int
int base_sec_index,
enum Dwarf_Rel_Type type,
int reltarget_length)
{
/* get a slot, fill in the slot entry */
void *relrec_to_fill = 0;
int res = 0;
return res;
return res;
/* ASSERT: type == dwarf_drt_first_of_length_type_pair */
return DW_DLV_OK;
}
/*
Reset whatever fields of Dwarf_P_Per_Reloc_Sect_s
we must to allow adding a fresh new single
block easily (block consolidation use only).
*/
static void
unsigned long ct)
{
/* Do not zero pr_sect_num_of_reloc_sect */
pblk->pr_reloc_total_count = 0;
pblk->pr_first_block = 0;
pblk->pr_last_block = 0;
pblk->pr_block_count = 0;
}
/*
Ensure each stream is a single buffer and
add that single buffer to the set of stream buffers.
By creating a new buffer and copying if necessary.
(If > 1 block, reduce to 1 block)
Free the input set of buffers if we consolidate.
We pass back *new_sec_count as zero because we
are not creating normal sections for a .o, but
symbolic relocations, separately counted.
Return -1 on error (malloc failure)
Return DW_DLV_OK on success. Any other return indicates
malloc failed.
*/
int
{
/* unsigned long total_size =0; */
int sec_index = 0;
int res = 0;
unsigned long i = 0;
for (i = 0; i < NUM_DEBUG_SECTIONS; ++i, ++p_reloc) {
int err;
if (ct == 0) {
continue;
}
/* len = dbg->de_relocation_record_size; */
++sec_count;
/* total_size = ct *len; */
if (sec_index == 0) {
/* Call de_callback_func or de_callback_func_b,
getting section number of reloc section. */
int rel_section_index = 0;
int int_name = 0;
/*
This is a bit of a fake, as we do not really have true
elf sections at all. Just the data such might contain.
But this lets the caller eventually link things
together: without this call we would not know what rel
data goes with what section when we are asked for the
real arrays. */
if (dbg->de_callback_func_b) {
/* type */ SHT_REL,
/* flags */ 0,
/* link to symtab, which we cannot
know */ SHN_UNDEF,
/* sec rels apply to */
dbg->de_elf_sects[i],
} else {
/* type */ SHT_REL,
/* flags */ 0,
/* link to symtab, which we cannot
know */ SHN_UNDEF,
/* sec rels apply to, in elf, sh_info */
}
if (rel_section_index == -1) {
{
return (DW_DLV_ERROR);
}
}
}
/* HACK , not normal interfaces, trashing p_reloc current
contents! */
/* Creating new single block for all 'ct' entries */
return res;
}
/* The following loop does the consolidation to a single
block and frees the input block(s). */
do {
unsigned long len =
p_blk_last = p_blk;
} while (p_blk);
/* ASSERT: sum of len copied == total_size */
/* have now created a single block, but no change in slots
used (pr_reloc_total_count) */
}
}
*new_sec_count = 0;
return DW_DLV_OK;
}