Menu

#263 dwarf2: emitting bad references to unused variables

None
closed-accepted
None
5
2016-01-18
2016-01-18
No

​Hello SDCC team,

I found this while compiling some ST STM8 libraries, which declare externs all over that are not all used.

code:

extern int something_non_existent;
int main(void)
{
  return 0;
}

1) with "--debug" this compiles fine.
2) with "--debug --out-fmt-elf" this fails.

It fails with undefined symbol in the linker.

This is because the dwarf 2 emitter indiscriminately emits symbols that are extern and never used.
This is wrong. It should not add such symbols to the REL file, unless they are used.

A small check in the dwarf2 emitter for this special case fixes it up.

Thanks,

/pedro

1 Attachments

Discussion

  • Philipp Klaus Krause

    • assigned_to: Philipp Klaus Krause
    • Group: -->
     
  • Philipp Klaus Krause

    • status: open --> closed-accepted
     
  • Philipp Klaus Krause

    Applied in revision #9465.

    Philipp

     

Log in to post a comment.