/* This module handles expression trees.
- Copyright (C) 1991-2019 Free Software Foundation, Inc.
+ Copyright (C) 1991-2020 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
This file is part of the GNU Binutils.
#include "sysdep.h"
#include "bfd.h"
#include "bfdlink.h"
+#include "ctf-api.h"
#include "ld.h"
#include "ldmain.h"
etree_type *
exp_intop (bfd_vma value)
{
- etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->value));
+ etree_type *new_e = stat_alloc (sizeof (new_e->value));
new_e->type.node_code = INT;
new_e->type.filename = ldlex_filename ();
new_e->type.lineno = lineno;
etree_type *
exp_bigintop (bfd_vma value, char *str)
{
- etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->value));
+ etree_type *new_e = stat_alloc (sizeof (new_e->value));
new_e->type.node_code = INT;
new_e->type.filename = ldlex_filename ();
new_e->type.lineno = lineno;
etree_type *
exp_relop (asection *section, bfd_vma value)
{
- etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->rel));
+ etree_type *new_e = stat_alloc (sizeof (new_e->rel));
new_e->type.node_code = REL;
new_e->type.filename = ldlex_filename ();
new_e->type.lineno = lineno;
tree->name.name,
TRUE, FALSE, TRUE);
if (!h)
- einfo (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
+ {
+ if (expld.phase != lang_first_phase_enum)
+ einfo (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
+ }
else if (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak)
{
output_section = h->u.def.section->output_section;
if (output_section == NULL)
{
- if (expld.phase <= lang_mark_phase_enum)
+ if (expld.phase != lang_final_phase_enum)
new_rel (h->u.def.value, h->u.def.section);
else
einfo (_("%X%P:%pS: unresolvable symbol `%s'"
if (tree->type.node_code == SIZEOF)
val = (os->bfd_section->size
- / bfd_octets_per_byte (link_info.output_bfd));
+ / bfd_octets_per_byte (link_info.output_bfd,
+ os->bfd_section));
else
val = (bfd_vma)1 << os->bfd_section->alignment_power;
etree_type *
exp_binop (int code, etree_type *lhs, etree_type *rhs)
{
- etree_type *new_e = (etree_type *) stat_alloc (MAX (sizeof (new_e->binary),
- sizeof (new_e->value)));
+ etree_type *new_e = stat_alloc (MAX (sizeof (new_e->binary),
+ sizeof (new_e->value)));
new_e->type.node_code = code;
new_e->type.filename = lhs->type.filename;
new_e->type.lineno = lhs->type.lineno;
etree_type *
exp_trinop (int code, etree_type *cond, etree_type *lhs, etree_type *rhs)
{
- etree_type *new_e = (etree_type *) stat_alloc (MAX (sizeof (new_e->trinary),
- sizeof (new_e->value)));
+ etree_type *new_e = stat_alloc (MAX (sizeof (new_e->trinary),
+ sizeof (new_e->value)));
new_e->type.node_code = code;
new_e->type.filename = cond->type.filename;
new_e->type.lineno = cond->type.lineno;
etree_type *
exp_unop (int code, etree_type *child)
{
- etree_type *new_e = (etree_type *) stat_alloc (MAX (sizeof (new_e->unary),
- sizeof (new_e->value)));
+ etree_type *new_e = stat_alloc (MAX (sizeof (new_e->unary),
+ sizeof (new_e->value)));
new_e->unary.type.node_code = code;
new_e->unary.type.filename = child->type.filename;
new_e->unary.type.lineno = child->type.lineno;
etree_type *
exp_nameop (int code, const char *name)
{
- etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->name));
+ etree_type *new_e = stat_alloc (sizeof (new_e->name));
new_e->name.type.node_code = code;
new_e->name.type.filename = ldlex_filename ();
{
etree_type *n;
- n = (etree_type *) stat_alloc (sizeof (n->assign));
+ n = stat_alloc (sizeof (n->assign));
n->assign.type.node_code = '=';
n->assign.type.filename = src->type.filename;
n->assign.type.lineno = src->type.lineno;
{
etree_type *n;
- n = (etree_type *) stat_alloc (sizeof (n->assert_s));
+ n = stat_alloc (sizeof (n->assert_s));
n->assert_s.type.node_code = '!';
n->assert_s.type.filename = exp->type.filename;
n->assert_s.type.lineno = exp->type.lineno;