On Thu, Jan 20, 2022 at 01:13:45PM -0800, Palmer Dabbelt wrote: > On Thu, 20 Jan 2022 02:45:53 PST (-0800), gcc-patches@gcc.gnu.org wrote: > > riscv*-*-* are the only modern targets that !HAVE_AS_LEB128 (apparently > > due to some aggressive linker optimizations). > > I don't really understand the rest of this, but we do have a subset of > LEB128 (constant expressions only). I'm not sure exactly what the > requirements are here, but one could imagine extending our assembler support > to cover them -- we might never have full support for LEB128 expressions > (because of linker relaxation), but we might be able to make more stuff > work. > > I'm not sure if that helps or hurts, though, as we'll still be a special > case.
HAVE_AS_LEB128 really needs to be able to handle both constants and difference of two labels in the same section. Most targets resolve something like that in the assembler as constant which they encode into sleb128 or uleb128 and put into the section that uses those directives (typically debugging sections). If a target performs aggressive linker relaxation, then probably some relocation would need to be added (but one that can encode the two symbols for the difference, so perhaps two relocations that must be consecutive or something similar) and resolve that by the linker. Though, that would mean that even in the debugging section offsets wouldn't be fixed during assembly... Jakub