pro_reloc.c revision 49d3bc91e27cd871b950d56c01398fa2f2e12ab4
/*
Copyright (C) 2000 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., 59 Temple Place - Suite 330, Boston MA 02111-1307,
USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
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"
/*Do initial alloc of newslots slots.
Fails only if malloc fails.
Supposed to be called before any relocs allocated.
Ignored if after any allocated.
Part of an optimization, so that for a known 'newslots'
relocations count we can preallocate the right size block.
Called from just 2 places.
returns DW_DLV_OK or DW_DLV_ERROR
*/
int
int rel_sec_index,
{
unsigned long len;
struct Dwarf_P_Relocation_Block_s *data;
unsigned long slots_in_blk = (unsigned long) newslots;
if (prel->pr_first_block)
return DW_DLV_OK; /* do nothing */
len = sizeof(struct Dwarf_P_Relocation_Block_s) +
data = (struct Dwarf_P_Relocation_Block_s *)
if (!data) {
return DW_DLV_ERROR;
}
here, as fallback in
case our origininal
estimate wrong.
When we call this we
presumably know what
we are doing, so
keep this count for
now */
data->rb_next_slot_to_use = 0;
((char *) data) + sizeof(struct Dwarf_P_Relocation_Block_s);
return DW_DLV_OK;
}
/*Do alloc of slots.
Fails only if malloc fails.
Only allocator used.
returns DW_DLV_OK or DW_DLV_ERROR
*/
int
{
unsigned long len;
struct Dwarf_P_Relocation_Block_s *data;
len = sizeof(struct Dwarf_P_Relocation_Block_s) +
data = (struct Dwarf_P_Relocation_Block_s *)
if (!data) {
return DW_DLV_ERROR;
}
if (prel->pr_first_block) {
} else {
}
data->rb_next_slot_to_use = 0;
((char *) data) + sizeof(struct Dwarf_P_Relocation_Block_s);
return DW_DLV_OK;
}
/*
Reserve a slot. return DW_DLV_OK if succeeds.
Return DW_DLV_ERROR if fails (malloc error).
Use the relrec_to_fill to pass back a pointer to
a slot space to use.
*/
int
int base_sec_index, void **relrec_to_fill)
{
struct Dwarf_P_Relocation_Block_s *data;
char *ret_addr;
if ((data == 0) ||
int res;
return res;
}
}
/* now we have an empty slot */
*relrec_to_fill = (void *) ret_addr;
return DW_DLV_OK;
}
/*
On success returns count of
.rel.* sections that are symbolic
thru count_of_relocation_sections.
On success, returns DW_DLV_OK.
If this is not a 'symbolic' run, returns
DW_DLV_NO_ENTRY.
No errors are possible.
*/
/*ARGSUSED*/ int
int *drd_buffer_version,
Dwarf_Error * error)
{
int i;
unsigned int count = 0;
for (i = 0; i < NUM_DEBUG_SECTIONS; ++i) {
++count;
}
}
return DW_DLV_OK;
}
return DW_DLV_NO_ENTRY;
}
int
Dwarf_Error * error)
{
int i;
for (i = next; i < NUM_DEBUG_SECTIONS; ++i) {
if (prel->pr_reloc_total_count > 0) {
/* ASSERT: prel->.pr_block_count == 1 */
return DW_DLV_OK;
}
}
}
return DW_DLV_NO_ENTRY;
}