Currently we fail with "unable to move location counter backward" in scripts that
assign ASSERT to Dot.
Previously ASSERT we implemented earlier returned expression value.
Ex:
. = ASSERT(0x100);
would set Dot to 0x100
Documentation does not say anything about this behavior:
"ASSERT(exp, message) Ensure that exp is non-zero. If it is zero, then exit the linker with an error code, and print message."
As far I know form of assert when it is assigned to Dot was used for compatibility with very old GNU ld whick required it.
Some scripts in the wild, including linux kernel scripts use ASSERTs at the end for checks, like:
<many script code here> /* * Build-time check on the image size: */ . = ASSERT((_end - _text <= (512 * 1024 * 1024)), "kernel image bigger than KERNEL_IMAGE_SIZE");
Since we error out moving backward now, I thing it is reasonable just to change behavior to return Dot. That way ASSERT will be unable
to move it backward. Anyways since that form was implemented just for compatibility, we probably should not really care what does
it return.
That fixes issue I am observing now when trying to use reproduce for vmlinux,
Please make a test as simple as possible. You can replace 0x10 > 0x1 with 1.