Re: Weird 8051 assembler code generated by SDCC



"Desert Rat" <rhunt@xxxxxxxxxxxxxxxxxx> wrote:

I am using SDCC on a 8051 project and the C code uses a switch
statement which has some in-line assembler code in several spots. The
program compiles without any errors, but the assembler generates a
dozen or so "undefined symbol encountered during assembly" errors. The
errors all had to do with jump statements...
...
On each of those lines, the assembler claims the label
'00111$' is undefined. But you can see that the label '00111$' exists
at address 0179h (line 404). I have checked that it is the only symbol
with that name in the assembler code. But what is even more odd is
that on line 396 (about eight lines above the label) is another jump to
that same label, that did not generate an error, and the jump op code
is there with a legitimate address for '00111$'.
...
I am not familiar with that assembler and compiler, so this is just a
guess: Some assemblers support labels with a limited scope, to make
easier to generate temporary labels. (for destination of 'if'
statement branches, etc.) You can have several identical labels with
no conflict, since each one will be valid only between a limited range
of lines in the file. These labels have a special syntax, an the
"00???$" format suggests this. Their range is usually terminated by
"normal" labels.
So this is the guess: something in your in-line assembly (labels
probably) is terminating the range of the compiler generated
limited-scope labels, so the jump statements so no see them.
Try removing them temporarily to see if that is the case.


.



Relevant Pages

  • Re: Can a C compiler compete with assembler ?
    ... opinions or ratings or compiler versus assembler wars and the like, ... illiterate in assembler programming which has not always been the case. ... particularly related to writing assembler code. ...
    (comp.lang.asm.x86)
  • Re: Statically create a table of data in C: How?
    ... This compiler also has an assembler and ... > The C code can reference the table in the Assembler code and the ... to, say, generating a precomputed cosine table. ...
    (comp.lang.c)
  • Re: C/C++ Calling OBTAIN / IGC0002G
    ... Where do I need to put the asm routine to be found by the compiler? ... Assuming the assembler code is in file obtain.s and your ... For IBM-MAIN subscribe / signoff / archive access instructions, ...
    (bit.listserv.ibm-main)
  • Re: when to use proc
    ... > Here's what I understand about your macros. ... * RosAsm is a PE Assembler and PEs are 32 Bits. ... Simply A86-like Local Labels. ... wrote that MASM does not output what you write... ...
    (alt.lang.asm)
  • Re: A couple of debug questions
    ... controlling flow. ... was really the province of assembler and BASIC. ... And if you think about it, why did you jump to ... Line numbers and jump labels did not *by themselves* make that any ...
    (comp.lang.clipper)

Loading