Hi Bill, Bill Wendling <mo...@google.com> writes: > The clang toolchain treats inline assembly a bit differently than > straight assembly code. In particular, inline assembly doesn't have the > complete context available to resolve expressions. This is intentional > to avoid divergence in the resulting assembly code. > > We can work around this issue by borrowing a workaround done for ARM, > i.e. not directly testing the labels themselves, but by moving the > current output pointer by a value that should always be zero. If this > value is not null, then we will trigger a backward move, which is > explicitly forbidden. > > Signed-off-by: Bill Wendling <mo...@google.com> > --- > arch/powerpc/include/asm/feature-fixups.h | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/include/asm/feature-fixups.h > b/arch/powerpc/include/asm/feature-fixups.h > index b0af97add751..f81036518edb 100644 > --- a/arch/powerpc/include/asm/feature-fixups.h > +++ b/arch/powerpc/include/asm/feature-fixups.h > @@ -36,6 +36,18 @@ label##2: \ > .align 2; \ > label##3: > > +/* > + * If the .org directive fails, it means that the feature instructions > + * are smaller than the alternate instructions. This used to be written > + * as > + * > + * .ifgt (label##4b-label##3b) - (label##2b-label##1b) > + * .error "Feature section else case larger than body" > + * .endif > + * > + * but clang's assembler complains about the expression being non-absolute > + * when the code appears in an inline assembly statement. > + */ > #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ > label##4: \ > .popsection; \ > @@ -48,12 +60,9 @@ label##5: > \ > FTR_ENTRY_OFFSET label##2b-label##5b; \ > FTR_ENTRY_OFFSET label##3b-label##5b; \ > FTR_ENTRY_OFFSET label##4b-label##5b; \ > - .ifgt (label##4b- label##3b)-(label##2b- label##1b); \ > - .error "Feature section else case larger than body"; \ > - .endif; \ > + .org . - ((label##4b-label##3b) > (label##2b-label##1b)); \ > .popsection;
When I have an oversize alt section this doesn't seem to give me any error using binutils? If I hard code: .org . - (1); It fails as expected. But if I hard code: .org . - (1 > 0); It builds? cheers