This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] doc - document how gcc relies on the length of an asm

Richard Earnshaw <> writes:

> > By the way, would it be possible to assert gcc's guess for the size of
> > an asm by putting a label before and after it and emitting an
> > ".assert" directive or something? That might avoid such errors.
> I don't think gas has support for .assert (can't find anything in the 
> manual under that heading).  It would be a neat idea, though, if we could 
> put
> L<asm_instance>:
> 	body of asm
> 	.assert "GCC asm size estimate " . - L<asm_instance> <= <size>

There isn't any .assert directive, but perhaps you could do something
    .ifgt . - L<asm_instance>,<size>

But unfortunately this wouldn't work reliably, because if the
assembler changes frags in the body of the asm, which it would if,
e.g., there is a branch and this is a target with different branch
sizes, then the computation . - L<asm_instance> would not be
considered an absolute expression, because it could not be resolved
until the end of assembly.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]