I saw that there is a define TC_PARSE_CONS_EXPRESSION that can be used to install a hook. I just wanted to make sure I was not missing something simpler.
-----Original Message----- From: Adhemerval Zanella Netto <adhemerval.zane...@linaro.org> Sent: Thursday, June 22, 2023 3:36 PM To: zac.wal...@linaro.org; linaro-toolchain@lists.linaro.org Subject: Re: Need emit_expr to write right shifted value. On 22/06/23 10:18, zac.wal...@linaro.org wrote: > Hi, > > In binutils I need to write an offset between two symbols shifted right by 2 > bits. This offset is written to the xdata section. My > code currently looks like this: > > exp.X_op = O_subtract; > exp.X_add_symbol = symbol1; > exp.X_op_symbol = symbol2; > emit_expr (&exp, 2); > > This works fine but obviously the result value is not shifted. Anyone have a > good option is to shift the output of emit_expr at > write time? > > I cannot use resolve_expression because the symbols do not have correct > addresses at the time this code executes. The 'struct expressionS' has the additional 'X_md' which is used by some targets to add extra rules for the expression. I am not very knowledge on this code, but I would expect that ld has a callback to handle the expressions prior the written. _______________________________________________ linaro-toolchain mailing list -- linaro-toolchain@lists.linaro.org To unsubscribe send an email to linaro-toolchain-le...@lists.linaro.org