This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: Supporting quoted symbol/label names


Hi Guys,

  I have been looking at PR 18581, which complains about the ARM
  assembler not accepting function names containing a dash:

https://sourceware.org/bugzilla/show_bug.cgi?id=18581

  Initially I was going to reject the bug as invalid, since normally
  symbol names do not contain dashes, but two things changed my mind -
  the symbols were being provided inside double quotes, and technically
  there is nothing in any file format standard to forbid such names.
  (It also helped that this output was being produced by LLVM, so this
  is not just a theoretical problem).

  Although the PR talks about the ARM port, the problem is generic, and
  in fact that filer even includes an x86 test case.  So I have been
  looking at a solution.  It turns out however that there are some
  pretty deep assumptions in GAS about how symbol names can be extracted
  from the input stream, and changing them all can be quite daunting.
  Not one to be stymied however I gave it a go and the result is the
  attached patch.

  The solution I have chosen is to modify the get_symbol_end() function
  so that it will allow any text enclosed between double quotes.  This
  is the function that is used in most places in GAS to read a symbol,
  label or operand name, but it does have one drawback: the function is
  expected to return the character that terminated the symbol name -
  typically a colon, comma, newline or space.  But in the case of a
  quoted string, this character will be a double quote.  Much of the
  code that calls get_symbol_end is not expecting this, so I have had
  to do a lot of hacking to handle this eventuality.

  I have tested the patch on 127 different toolchains with no
  regressions, so I think that it probably does work.  But what do
  people think ?  Is supporting "double quoted" symbol names a good idea ?

Cheers
  Nick

Attachment: quoted-symbol-names.patch.xz
Description: application/xz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]