]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
loader: fix userboot's ability to detect a guest's interpreter
authorKyle Evans <kevans@FreeBSD.org>
Tue, 26 May 2020 19:34:05 +0000 (19:34 +0000)
committerKyle Evans <kevans@FreeBSD.org>
Tue, 26 May 2020 19:34:05 +0000 (19:34 +0000)
commit4ee0c9820a7709804a0ddeb10a6a6eaa4b6f7bb6
treec6ba4105c41ae59849a231ec21d075de910a4045
parentc166d3a61707471bade45acaeea5f6543bca4b5c
loader: fix userboot's ability to detect a guest's interpreter

Some time after r338418, I believe with -Os/-Oz -ffunction-sections
-fdata-sections, the bootprog_interp variable that held our "$Interpreter:"
marker started getting strip from all loaders, with exception to userboot
since it used bootprog_interp to determine what flavor of userboot it was.

At some point, it had been brought to my attention that this was no longer
working and I had worked up some potential solutions to use the variable
that involved printing it out. My vague recollection is that this was
rejected, and I forgot to explore the alternatives; I cannot find records of
this discussion anymore.

Fast forward to present day, Andrew reported that it was non-functional and
offered (effectively) this patch (sans comment) to stop the compiler from
optimizing it out by assigning it to a volatile variable. This removes
concerns about user-facing change while retaining the interpreter marker.
Furthermore, it could certainly be uglier.
stand/common/interp.c