This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Using S_SET_VOLATILE in md_undefined_symbol crashes as
- From: HoraK-FDF <horak-fdf at yandex dot com>
- To: binutils at sourceware dot org
- Date: Mon, 7 Aug 2017 08:32:07 +0200
- Subject: Using S_SET_VOLATILE in md_undefined_symbol crashes as
- Authentication-results: sourceware.org; auth=none
- Authentication-results: smtp1o.mail.yandex.net; dkim=pass header.i=@yandex.com
Hi,
i'm currently porting the old 8051 patch for binutils 2.12.2 to 2.28. It
compiles fine but at the first testrun i encountered a problem that the
2.12.2 version did not had. The problem is I have a source file where
all registers for the EZ-USB FX2LP are listed and some of them are also
defined within the 8051 patch now if as reaches such an symbol it trows
an error "symbol ... is already defined" in assign_symbol in read.c. So
thought i just add a S_SET_VOLATILE to md_undefined symbol so that it
redefines it if needed but all that happens is that as crashes with
that. I have tryed many other things like deleteng the symbol and
reassigning it but that leads to another error that "reassigned symbol
cannot be used in reloc" (write.c). Now i could remove the register
definitions from the source file but i want to keep this file as it is,
because its also compatible with other assemblers. Is there a way to do
that or is it impossible with the 2.28 version? Could someone please
tell me what I'm missing or what other steps i have to do that this
works? Here is the md_undefined_symbol that i currently use:
symbolS *
md_undefined_symbol (name)
char *name;
{
symbolS *symbolP;
extract_op (name, op, sizeof (op));
oper = (struct i51_directop_s *) hash_find (i51_operand, op);
if (oper == NULL) return 0;
if ((oper->ref == 'D') || (oper->ref == 'B'))
{
symbolP = symbol_new (name, absolute_section, oper->value,
&zero_address_frag);
S_SET_VOLATILE (symbolP);
return symbolP;
}
else if (oper->ref == 'U')
{
if (regbank == 0xFF)
{
as_bad (_("missing .using"));
return 0;
}
symbolP = symbol_new (name, absolute_section, regbank +
oper->value, &zero_address_frag);
S_SET_VOLATILE (symbolP);
return symbolP;
}
else return 0;
}