This is the mail archive of the binutils@sourceware.cygnus.com 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]

PowerPC GAS quirk



The PPC version of GAS allows you to do the following:

  addi LR,r13,-16

Astute PPC assembly language programmers will quickly point out
that addi is of the form rD,rA,SIMM so that a rD of LR should be
invalid.

What's the deal? When GAS converts/evaluates the operands, LR is
converted into 8 (as in spr8) and thus the insn thinks it received r8,
which of course is valid.

The culprit is function reg_name_search() which is invoked from
register_name() in file binutils/gas/config/tc-ppc.c. The two functions
combined do not differentiate between gprs, fprs or sprs. Thus [most]
anywhere a register is expected, [most] any valid gpr/fpr/spr will do.

A cursory glance at fixing this problem suggests modifying
opcodes/ppc-opc.c
to add specific operand types for GPRs, FPRs and SPRs. Then
register_name()
and reg_name_search() would need to know which type of register in the
lookup process in order to correctly identify a register number.

If nobody has complained about this after four+ years, there probably
isn't
any real reason to fix it.

Eric

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