]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
ld: Make separate clauses where a label was before a declaration
authorHans-Peter Nilsson <hp@axis.com>
Sat, 24 Jan 2026 03:53:41 +0000 (04:53 +0100)
committerHans-Peter Nilsson <hp@bitrange.com>
Sat, 24 Jan 2026 05:12:56 +0000 (06:12 +0100)
commita815cdb41312bc3b8536dcb5a2cf2c263c3418f8
treeafa3d08cc1ca5bc85209bba7b5b1d899c61c2c9d
parente4a41dc43a32ed4d43ca4ffbe099c14feb73c01d
ld: Make separate clauses where a label was before a declaration

The default behavior of gcc changed from gcc-11.  With gcc-10 and
earlier versions, you got:

In file included from ../bfd/bfd.h:45,
                 from /src/ld/ldmisc.c:23:
/src/ld/ldmisc.c: In function 'vfinfo':
/src/ld/ldmisc.c:186:8: error: a label can only be part of a statement and a declaration is not a statement
  186 |        bool ll_type = false;
      |        ^~~~
/src/ld/ldmisc.c:581:8: error: a label can only be part of a statement and a declaration is not a statement
  581 |        bool ll_type = false;
      |        ^~~~
make[4]: *** [Makefile:1606: ldmisc.o] Error 1

Since gcc-10 matches the binutils/README requirement ("a C99 compliant
compiler and library") and as binutils policy is to adjust code to
handle earlier gcc versions, an obvious fix is to make a compound
statement for the code after the case-label.

ld:

* ldmisc.c (vfinfo) <case 'l' - two cases>: Make separate
compound statements where case-labels were part of a declaration.
ld/ldmisc.c