clang-llvm exceptions problem powerpc-apple-darwin

I am getting assembler errors on clang-llvm-2.9 output for a program with
exceptions that I do not get when using the installed g++

Mac OS-X 10.4 powerpc-apple-darwin

> as -version
Apple Computer, Inc. version cctools-590.23.2.obj~17, GNU assembler version 1.38

the folks at gnu-binutils assure me this is an assembler bug, but also that this isn't
a recognizable "gnu" version number for gas.

1) ----------
this has to be a well know problem with the apple powerpc assembler,
is there an upgrade ? or is there a version of gnu-binutils that is consistent
with Apple/MachO/OSX-10.4 that I can build myself ?

2) ----------
I still have not been able to figure out in detail how g++ avoids hitting this
assembler bug. I am able to modifying by hand the clang-llvm output to work
around the problem, doing this transformation

Ltmp123 = Label1 - Label2
  .long Ltmp123

gets turned into this

  .long Label1 - Label2

unfortunately always doing one or always doing the other causes either
assembler errors or linker errors. the transformation has to be applied
very selectively...

3) ----------
so far I am unsuccessful in modifying llvm to work around the problem,
I have tried all the variations below, and always end up with either
assembler or linker errors

void AsmPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const {
   const TargetLoweringObjectFile &TLOF = getObjFileLowering();

   const MCExpr *Exp =
     TLOF.getExprForDwarfReference(Sym, Mang, MMI, Encoding, OutStreamer);

   const MCSectionMachO * SecCur = dyn_cast<MCSectionMachO>(getCurrentSection());
   const MCSectionMachO * SecRef = dyn_cast<MCSectionMachO>(&Sym- >getSection());

#if 0
   OutStreamer.EmitAbsValue(Exp, GetSizeOfEncodedValue(Encoding));
#elif 0
   if (SecRef->getType() == MCSectionMachO::S_COALESCED)
     OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding));
   else
     OutStreamer.EmitAbsValue(Exp, GetSizeOfEncodedValue(Encoding));
#else
   if (SecCur->getType() == MCSectionMachO::S_COALESCED ||
       SecRef->getType() == MCSectionMachO::S_COALESCED)
     OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding));
   else
     OutStreamer.EmitAbsValue(Exp, GetSizeOfEncodedValue(Encoding));
#endif
}

if anyone has any insight into g++'s selective use of ".set A-B" verses ".long A-B"
I would appreciate hearing about it ?

thanks,
Peter Lawrence.

I am getting assembler errors on clang-llvm-2.9 output for a program
with
exceptions that I do not get when using the installed g++

Mac OS-X 10.4 powerpc-apple-darwin

There's zero work going into powerpc darwin these days. You may wish
to try a newer version (out of top of tree clang/llvm), but there
are no guarantees that it'll change the outcome.

as -version

Apple Computer, Inc. version cctools-590.23.2.obj~17, GNU assembler
version 1.38

the folks at gnu-binutils assure me this is an assembler bug, but
also that this isn't
a recognizable "gnu" version number for gas.

It isn't. It's a version of the apple tools. Your best bet is to install
the last version of xcode shipped for powerpc 10.4 systems.

-eric