[PATCH v1 1/1] bfd: add a mean to programatically detect a release version
Jan Beulich
jbeulich@suse.com
Thu Aug 21 16:00:57 GMT 2025
On 14.08.2025 17:16, Matthieu Longo wrote:
> In a recent discussion around Object Attributes v2, it appeared that we
> needed a way to detect whether a tool was built as a release version,
> or development version.
>
> A previous patch (7b40f4c6587c) introduced this detection in gas.
> This patch reuses the same principle but moved the code into a utility
> function in bsd, so that gas, ld, and others can rely on it. It also
> adds a Tcl function 'is_release' that can be used with a '#target: '
> directive to disable some tests relying on development-only features.
The C side is pretty much okay with me, but ...
> --- a/binutils/testsuite/lib/binutils-common.exp
> +++ b/binutils/testsuite/lib/binutils-common.exp
> @@ -17,6 +17,19 @@
> # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
> # MA 02110-1301, USA.
>
> +# True if the current tool is a release version.
> +#
> +proc is_release {} {
> + global AS
> + catch "exec $AS --version | head -1" exec_output
... already here implementation and comment ("current tool") don't match.
For some targets gas isn't even being built. If you only need this for
gas, maybe limit it to just that?
> + if [regexp {\d+\.\d+\.\d+(\.\d+)} $exec_output matched sub1] then {
I have no idea whether this may get in conflict with some distro's versioning.
Jan
More information about the Binutils
mailing list