How to resolve MCSymbolRefExpr when parsing asm files?

Background: I’m trying to use MC component to implement MMIXAL for architecture MMIX in TAOCP, and produce the MMO format described in the document.

My problem is, MMO is a non relocatable format, all symbols should be resolved during assembly time and MMIXAL allow arithmetic operations on symbols, as a 64 bits unsigned integer immediate, but MCExpr which contains MCSymbolRefExpr cannot be evaluated at this time.
Currently, I maintain a program counter in AsmParser and set symbol values manually, but it is too straightforward.
So in which stage I can resolve these symbols? Thanks in advance.

This is probably not going to help you much but about 3/4 years ago I implemented Clang support for MMIXAL. Was really fun:

So the goal was compiling C down to .mmo files instead of supporting necessarily all of MMIXAL itself. I did get as far as compiling simple functions.

I didn’t get as far as supporting arithmetic operations on symbols though, but I did allow for relocatables to work with the compiler. So I made up my own relocatables where suitable. Intermediate object files would still contain them but the resulting assembly or .mmo file would not.

Thanks, I will take a look.

have you tried evaluateAsAbsolute or evaluateAsValue?

evaluateAsAbsolute returns false and the result of evaluateAsValue is not absolute.