mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-02-22 18:42:10 +00:00
Use stderr if config.map_file is not available. Do not print NULL trees.
This commit is contained in:
parent
1545243be0
commit
c7d701b094
@ -1,5 +1,10 @@
|
|||||||
2001-07-19 Nick Clifton <nickc@cambridge.redhat.com>
|
2001-07-19 Nick Clifton <nickc@cambridge.redhat.com>
|
||||||
|
|
||||||
|
* ldexp.c (exp_print_tree): Use stderr if config.map_file is not
|
||||||
|
available. Do not print NULL trees.
|
||||||
|
(exp_print_token): Print unknown tokens with values > 126 as
|
||||||
|
decimal values not ASCII characters.
|
||||||
|
|
||||||
* ldlang.c (lang_leave_overlay): If a region is specified assign
|
* ldlang.c (lang_leave_overlay): If a region is specified assign
|
||||||
it to all sections inside the overlay unless they have been
|
it to all sections inside the overlay unless they have been
|
||||||
assigned to the own, non-default, memory region.
|
assigned to the own, non-default, memory region.
|
||||||
|
82
ld/ldexp.c
82
ld/ldexp.c
@ -38,6 +38,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||||||
#include "ldexp.h"
|
#include "ldexp.h"
|
||||||
#include "ldgram.h"
|
#include "ldgram.h"
|
||||||
#include "ldlang.h"
|
#include "ldlang.h"
|
||||||
|
#include "libiberty.h"
|
||||||
|
|
||||||
static void exp_print_token PARAMS ((token_code_type code));
|
static void exp_print_token PARAMS ((token_code_type code));
|
||||||
static void make_abs PARAMS ((etree_value_type *ptr));
|
static void make_abs PARAMS ((etree_value_type *ptr));
|
||||||
@ -67,12 +68,14 @@ static void
|
|||||||
exp_print_token (code)
|
exp_print_token (code)
|
||||||
token_code_type code;
|
token_code_type code;
|
||||||
{
|
{
|
||||||
static CONST struct {
|
static CONST struct
|
||||||
|
{
|
||||||
token_code_type code;
|
token_code_type code;
|
||||||
char *name;
|
char * name;
|
||||||
} table[] = {
|
}
|
||||||
|
table[] =
|
||||||
|
{
|
||||||
{ INT, "int" },
|
{ INT, "int" },
|
||||||
{ REL, "relocateable" },
|
|
||||||
{ NAME, "NAME" },
|
{ NAME, "NAME" },
|
||||||
{ PLUSEQ, "+=" },
|
{ PLUSEQ, "+=" },
|
||||||
{ MINUSEQ, "-=" },
|
{ MINUSEQ, "-=" },
|
||||||
@ -92,37 +95,42 @@ exp_print_token (code)
|
|||||||
{ RSHIFT, ">>=" },
|
{ RSHIFT, ">>=" },
|
||||||
{ ALIGN_K, "ALIGN" },
|
{ ALIGN_K, "ALIGN" },
|
||||||
{ BLOCK, "BLOCK" },
|
{ BLOCK, "BLOCK" },
|
||||||
{ SECTIONS, "SECTIONS" },
|
|
||||||
{ SIZEOF_HEADERS, "SIZEOF_HEADERS" },
|
|
||||||
{ NEXT, "NEXT" },
|
|
||||||
{ SIZEOF, "SIZEOF" },
|
|
||||||
{ ADDR, "ADDR" },
|
|
||||||
{ LOADADDR, "LOADADDR" },
|
|
||||||
{ MEMORY, "MEMORY" },
|
|
||||||
{ DEFINED, "DEFINED" },
|
|
||||||
{ TARGET_K, "TARGET" },
|
|
||||||
{ SEARCH_DIR, "SEARCH_DIR" },
|
|
||||||
{ MAP, "MAP" },
|
|
||||||
{ QUAD, "QUAD" },
|
{ QUAD, "QUAD" },
|
||||||
{ SQUAD, "SQUAD" },
|
{ SQUAD, "SQUAD" },
|
||||||
{ LONG, "LONG" },
|
{ LONG, "LONG" },
|
||||||
{ SHORT, "SHORT" },
|
{ SHORT, "SHORT" },
|
||||||
{ BYTE, "BYTE" },
|
{ BYTE, "BYTE" },
|
||||||
|
{ SECTIONS, "SECTIONS" },
|
||||||
|
{ SIZEOF_HEADERS, "SIZEOF_HEADERS" },
|
||||||
|
{ MEMORY, "MEMORY" },
|
||||||
|
{ DEFINED, "DEFINED" },
|
||||||
|
{ TARGET_K, "TARGET" },
|
||||||
|
{ SEARCH_DIR, "SEARCH_DIR" },
|
||||||
|
{ MAP, "MAP" },
|
||||||
{ ENTRY, "ENTRY" },
|
{ ENTRY, "ENTRY" },
|
||||||
{ 0, (char *) NULL }
|
{ NEXT, "NEXT" },
|
||||||
|
{ SIZEOF, "SIZEOF" },
|
||||||
|
{ ADDR, "ADDR" },
|
||||||
|
{ LOADADDR, "LOADADDR" },
|
||||||
|
{ MAX_K, "MAX_K" },
|
||||||
|
{ REL, "relocateable" },
|
||||||
};
|
};
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
|
|
||||||
for (idx = 0; table[idx].name != (char *) NULL; idx++)
|
for (idx = ARRAY_SIZE (table); idx--;)
|
||||||
{
|
{
|
||||||
if (table[idx].code == code)
|
if (table[idx].code == code)
|
||||||
{
|
{
|
||||||
fprintf (config.map_file, "%s", table[idx].name);
|
fprintf (config.map_file, " %s ", table[idx].name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Not in table, just print it alone */
|
|
||||||
fprintf (config.map_file, "%c", code);
|
/* Not in table, just print it alone. */
|
||||||
|
if (code < 127)
|
||||||
|
fprintf (config.map_file, " %c ", code);
|
||||||
|
else
|
||||||
|
fprintf (config.map_file, " <code %d> ", code);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -335,6 +343,7 @@ fold_name (tree, current_section, allocation_done, dot)
|
|||||||
bfd_vma dot;
|
bfd_vma dot;
|
||||||
{
|
{
|
||||||
etree_value_type result;
|
etree_value_type result;
|
||||||
|
|
||||||
switch (tree->type.node_code)
|
switch (tree->type.node_code)
|
||||||
{
|
{
|
||||||
case SIZEOF_HEADERS:
|
case SIZEOF_HEADERS:
|
||||||
@ -597,7 +606,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
|
|||||||
case etree_provided:
|
case etree_provided:
|
||||||
if (tree->assign.dst[0] == '.' && tree->assign.dst[1] == 0)
|
if (tree->assign.dst[0] == '.' && tree->assign.dst[1] == 0)
|
||||||
{
|
{
|
||||||
/* Assignment to dot can only be done during allocation */
|
/* Assignment to dot can only be done during allocation. */
|
||||||
if (tree->type.node_class != etree_assign)
|
if (tree->type.node_class != etree_assign)
|
||||||
einfo (_("%F%S can not PROVIDE assignment to location counter\n"));
|
einfo (_("%F%S can not PROVIDE assignment to location counter\n"));
|
||||||
if (allocation_done == lang_allocating_phase_enum
|
if (allocation_done == lang_allocating_phase_enum
|
||||||
@ -622,10 +631,8 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
|
|||||||
+ current_section->bfd_section->vma);
|
+ current_section->bfd_section->vma);
|
||||||
if (nextdot < dot
|
if (nextdot < dot
|
||||||
&& current_section != abs_output_section)
|
&& current_section != abs_output_section)
|
||||||
{
|
|
||||||
einfo (_("%F%S cannot move location counter backwards (from %V to %V)\n"),
|
einfo (_("%F%S cannot move location counter backwards (from %V to %V)\n"),
|
||||||
dot, nextdot);
|
dot, nextdot);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
*dotp = nextdot;
|
*dotp = nextdot;
|
||||||
}
|
}
|
||||||
@ -740,9 +747,8 @@ exp_trinop (code, cond, lhs, rhs)
|
|||||||
(lang_output_section_statement_type *) NULL,
|
(lang_output_section_statement_type *) NULL,
|
||||||
lang_first_phase_enum);
|
lang_first_phase_enum);
|
||||||
if (r.valid_p)
|
if (r.valid_p)
|
||||||
{
|
|
||||||
return exp_intop (r.value);
|
return exp_intop (r.value);
|
||||||
}
|
|
||||||
new = (etree_type *) stat_alloc (sizeof (new->trinary));
|
new = (etree_type *) stat_alloc (sizeof (new->trinary));
|
||||||
memcpy ((char *) new, (char *) &value, sizeof (new->trinary));
|
memcpy ((char *) new, (char *) &value, sizeof (new->trinary));
|
||||||
return new;
|
return new;
|
||||||
@ -762,9 +768,8 @@ exp_unop (code, child)
|
|||||||
r = exp_fold_tree_no_dot (&value, abs_output_section,
|
r = exp_fold_tree_no_dot (&value, abs_output_section,
|
||||||
lang_first_phase_enum);
|
lang_first_phase_enum);
|
||||||
if (r.valid_p)
|
if (r.valid_p)
|
||||||
{
|
|
||||||
return exp_intop (r.value);
|
return exp_intop (r.value);
|
||||||
}
|
|
||||||
new = (etree_type *) stat_alloc (sizeof (new->unary));
|
new = (etree_type *) stat_alloc (sizeof (new->unary));
|
||||||
memcpy ((char *) new, (char *) &value, sizeof (new->unary));
|
memcpy ((char *) new, (char *) &value, sizeof (new->unary));
|
||||||
return new;
|
return new;
|
||||||
@ -785,9 +790,8 @@ exp_nameop (code, name)
|
|||||||
(lang_output_section_statement_type *) NULL,
|
(lang_output_section_statement_type *) NULL,
|
||||||
lang_first_phase_enum);
|
lang_first_phase_enum);
|
||||||
if (r.valid_p)
|
if (r.valid_p)
|
||||||
{
|
|
||||||
return exp_intop (r.value);
|
return exp_intop (r.value);
|
||||||
}
|
|
||||||
new = (etree_type *) stat_alloc (sizeof (new->name));
|
new = (etree_type *) stat_alloc (sizeof (new->name));
|
||||||
memcpy ((char *) new, (char *) &value, sizeof (new->name));
|
memcpy ((char *) new, (char *) &value, sizeof (new->name));
|
||||||
return new;
|
return new;
|
||||||
@ -810,9 +814,7 @@ exp_assop (code, dst, src)
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (exp_fold_tree_no_dot (&value, &result))
|
if (exp_fold_tree_no_dot (&value, &result))
|
||||||
{
|
|
||||||
return exp_intop (result);
|
return exp_intop (result);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
new = (etree_type *) stat_alloc (sizeof (new->assign));
|
new = (etree_type *) stat_alloc (sizeof (new->assign));
|
||||||
memcpy ((char *) new, (char *) &value, sizeof (new->assign));
|
memcpy ((char *) new, (char *) &value, sizeof (new->assign));
|
||||||
@ -857,6 +859,15 @@ void
|
|||||||
exp_print_tree (tree)
|
exp_print_tree (tree)
|
||||||
etree_type *tree;
|
etree_type *tree;
|
||||||
{
|
{
|
||||||
|
if (config.map_file == NULL)
|
||||||
|
config.map_file = stderr;
|
||||||
|
|
||||||
|
if (tree == NULL)
|
||||||
|
{
|
||||||
|
minfo ("NULL TREE\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (tree->type.node_class)
|
switch (tree->type.node_class)
|
||||||
{
|
{
|
||||||
case etree_value:
|
case etree_value:
|
||||||
@ -870,14 +881,10 @@ exp_print_tree (tree)
|
|||||||
case etree_assign:
|
case etree_assign:
|
||||||
#if 0
|
#if 0
|
||||||
if (tree->assign.dst->sdefs != (asymbol *) NULL)
|
if (tree->assign.dst->sdefs != (asymbol *) NULL)
|
||||||
{
|
|
||||||
fprintf (config.map_file, "%s (%x) ", tree->assign.dst->name,
|
fprintf (config.map_file, "%s (%x) ", tree->assign.dst->name,
|
||||||
tree->assign.dst->sdefs->value);
|
tree->assign.dst->sdefs->value);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
fprintf (config.map_file, "%s (UNDEFINED)", tree->assign.dst->name);
|
fprintf (config.map_file, "%s (UNDEFINED)", tree->assign.dst->name);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
fprintf (config.map_file, "%s", tree->assign.dst);
|
fprintf (config.map_file, "%s", tree->assign.dst);
|
||||||
exp_print_token (tree->type.node_code);
|
exp_print_token (tree->type.node_code);
|
||||||
@ -981,12 +988,9 @@ exp_get_abs_int (tree, def, name, allocation_done)
|
|||||||
res = exp_fold_tree_no_dot (tree, abs_output_section, allocation_done);
|
res = exp_fold_tree_no_dot (tree, abs_output_section, allocation_done);
|
||||||
|
|
||||||
if (res.valid_p)
|
if (res.valid_p)
|
||||||
{
|
|
||||||
res.value += res.section->bfd_section->vma;
|
res.value += res.section->bfd_section->vma;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
einfo (_("%F%S non constant expression for %s\n"), name);
|
einfo (_("%F%S non constant expression for %s\n"), name);
|
||||||
}
|
|
||||||
return res.value;
|
return res.value;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user