Re: [PATCH] newlib: stop clobbering LDFLAGS with non-standard $ldflags

Thomas Schwinge <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hi!

On 2022-01-20T23:51:52-0500, Mike Frysinger <[email protected]> wrote:
> It's unclear why this was added originally, but assuming it was needed
> 20 years ago, it shouldn't be explicitly required nowadays.  Current
> versions of autotools already take care of exporting LDFLAGS to the
> Makefile as needed (things are actually getting linked).  That's why
> the configure diffs show LDFLAGS still here, but shifted to a diff
> place in the output list.  A few dirs stop exporting LDFLAGS, but
> that's because they don't do any linking, only compiling, so it's
> correct.
>
> As for the use of $ldflags instead of the standard $LDFLAGS, I can't
> really explain that at all.  Just use the right name so users don't
> have to dig into why their setting isn't respected, and then use a
> non-standard name instead.

I can't comment on all that off-hand, but this change here:

> Adjust the testsuite to match.

> --- a/newlib/testsuite/lib/newlib.exp
> +++ b/newlib/testsuite/lib/newlib.exp
> @@ -66,13 +66,13 @@ proc newlib_target_compile { source dest type options } {
>           [target_info needs_status_wrapper] != "0" && \
>           [info exists gluefile] } {
>       lappend options "libs=$gluefile"
> -     lappend options "ldflags=$wrap_flags"
> +     lappend options "LDFLAGS=$wrap_flags"
>      }
>
>      if [string match $host_triplet $target_triplet] then {
>       if [string match "i686-pc-linux-gnu" $host_triplet] then {
>           lappend options "libs=$objdir/crt0.o -lc -lgcc"
> -         lappend options "ldflags=-nostdlib -L$objdir/.libs [newlib_include_flags]"
> +         lappend options "LDFLAGS=-nostdlib -L$objdir/.libs [newlib_include_flags]"
>       }
>      }

..., is that really correct?  As far as I know, DejaGnu only looks for
the lower-case 'ldflags' in 'options', as documented in
'[...]/share/dejagnu/target.exp'.  (I just noticed this while looking for
something else; I don't have any toolchains exercising the code paths
you've changed.)


Grüße
 Thomas


>  newlib/acinclude.m4                                      | 3 ---
>  newlib/configure                                         | 9 +++------
>  newlib/iconvdata/configure                               | 9 +++------
>  newlib/libc/configure                                    | 9 +++------
>  newlib/libc/machine/a29k/Makefile.in                     | 1 -
>  newlib/libc/machine/a29k/configure                       | 4 ----
>  newlib/libc/machine/aarch64/Makefile.in                  | 1 -
>  newlib/libc/machine/aarch64/configure                    | 4 ----
>  newlib/libc/machine/amdgcn/Makefile.in                   | 1 -
>  newlib/libc/machine/amdgcn/configure                     | 4 ----
>  newlib/libc/machine/arc/Makefile.in                      | 1 -
>  newlib/libc/machine/arc/configure                        | 4 ----
>  newlib/libc/machine/arm/Makefile.in                      | 1 -
>  newlib/libc/machine/arm/configure                        | 4 ----
>  newlib/libc/machine/bfin/Makefile.in                     | 1 -
>  newlib/libc/machine/bfin/configure                       | 4 ----
>  newlib/libc/machine/configure                            | 9 +++------
>  newlib/libc/machine/cr16/Makefile.in                     | 1 -
>  newlib/libc/machine/cr16/configure                       | 4 ----
>  newlib/libc/machine/cris/Makefile.in                     | 1 -
>  newlib/libc/machine/cris/configure                       | 4 ----
>  newlib/libc/machine/crx/Makefile.in                      | 1 -
>  newlib/libc/machine/crx/configure                        | 4 ----
>  newlib/libc/machine/csky/Makefile.in                     | 1 -
>  newlib/libc/machine/csky/configure                       | 4 ----
>  newlib/libc/machine/d10v/Makefile.in                     | 1 -
>  newlib/libc/machine/d10v/configure                       | 4 ----
>  newlib/libc/machine/d30v/Makefile.in                     | 1 -
>  newlib/libc/machine/d30v/configure                       | 4 ----
>  newlib/libc/machine/epiphany/Makefile.in                 | 1 -
>  newlib/libc/machine/epiphany/configure                   | 4 ----
>  newlib/libc/machine/fr30/Makefile.in                     | 1 -
>  newlib/libc/machine/fr30/configure                       | 4 ----
>  newlib/libc/machine/frv/Makefile.in                      | 1 -
>  newlib/libc/machine/frv/configure                        | 4 ----
>  newlib/libc/machine/ft32/Makefile.in                     | 1 -
>  newlib/libc/machine/ft32/configure                       | 4 ----
>  newlib/libc/machine/h8300/Makefile.in                    | 1 -
>  newlib/libc/machine/h8300/configure                      | 4 ----
>  newlib/libc/machine/h8500/Makefile.in                    | 1 -
>  newlib/libc/machine/h8500/configure                      | 4 ----
>  newlib/libc/machine/hppa/Makefile.in                     | 1 -
>  newlib/libc/machine/hppa/configure                       | 4 ----
>  newlib/libc/machine/i386/configure                       | 9 +++------
>  newlib/libc/machine/i960/Makefile.in                     | 1 -
>  newlib/libc/machine/i960/configure                       | 4 ----
>  newlib/libc/machine/iq2000/Makefile.in                   | 1 -
>  newlib/libc/machine/iq2000/configure                     | 4 ----
>  newlib/libc/machine/lm32/Makefile.in                     | 1 -
>  newlib/libc/machine/lm32/configure                       | 4 ----
>  newlib/libc/machine/m32c/Makefile.in                     | 1 -
>  newlib/libc/machine/m32c/configure                       | 4 ----
>  newlib/libc/machine/m32r/Makefile.in                     | 1 -
>  newlib/libc/machine/m32r/configure                       | 4 ----
>  newlib/libc/machine/m68hc11/Makefile.in                  | 1 -
>  newlib/libc/machine/m68hc11/configure                    | 4 ----
>  newlib/libc/machine/m68k/Makefile.in                     | 1 -
>  newlib/libc/machine/m68k/configure                       | 4 ----
>  newlib/libc/machine/m88k/Makefile.in                     | 1 -
>  newlib/libc/machine/m88k/configure                       | 4 ----
>  newlib/libc/machine/mep/Makefile.in                      | 1 -
>  newlib/libc/machine/mep/configure                        | 4 ----
>  newlib/libc/machine/microblaze/Makefile.in               | 1 -
>  newlib/libc/machine/microblaze/configure                 | 4 ----
>  newlib/libc/machine/mips/Makefile.in                     | 1 -
>  newlib/libc/machine/mips/configure                       | 4 ----
>  newlib/libc/machine/mn10200/Makefile.in                  | 1 -
>  newlib/libc/machine/mn10200/configure                    | 4 ----
>  newlib/libc/machine/mn10300/Makefile.in                  | 1 -
>  newlib/libc/machine/mn10300/configure                    | 4 ----
>  newlib/libc/machine/moxie/Makefile.in                    | 1 -
>  newlib/libc/machine/moxie/configure                      | 4 ----
>  newlib/libc/machine/msp430/Makefile.in                   | 1 -
>  newlib/libc/machine/msp430/configure                     | 4 ----
>  newlib/libc/machine/mt/Makefile.in                       | 1 -
>  newlib/libc/machine/mt/configure                         | 4 ----
>  newlib/libc/machine/nds32/configure                      | 5 +----
>  newlib/libc/machine/necv70/Makefile.in                   | 1 -
>  newlib/libc/machine/necv70/configure                     | 4 ----
>  newlib/libc/machine/nios2/Makefile.in                    | 1 -
>  newlib/libc/machine/nios2/configure                      | 4 ----
>  newlib/libc/machine/nvptx/Makefile.in                    | 1 -
>  newlib/libc/machine/nvptx/configure                      | 4 ----
>  newlib/libc/machine/or1k/Makefile.in                     | 1 -
>  newlib/libc/machine/or1k/configure                       | 4 ----
>  newlib/libc/machine/powerpc/Makefile.in                  | 1 -
>  newlib/libc/machine/powerpc/configure                    | 4 ----
>  newlib/libc/machine/pru/Makefile.in                      | 1 -
>  newlib/libc/machine/pru/configure                        | 4 ----
>  newlib/libc/machine/riscv/Makefile.in                    | 1 -
>  newlib/libc/machine/riscv/configure                      | 4 ----
>  newlib/libc/machine/rl78/Makefile.in                     | 1 -
>  newlib/libc/machine/rl78/configure                       | 4 ----
>  newlib/libc/machine/rx/Makefile.in                       | 1 -
>  newlib/libc/machine/rx/configure                         | 4 ----
>  newlib/libc/machine/sh/configure                         | 5 +----
>  newlib/libc/machine/sparc/Makefile.in                    | 1 -
>  newlib/libc/machine/sparc/configure                      | 4 ----
>  newlib/libc/machine/spu/Makefile.in                      | 1 -
>  newlib/libc/machine/spu/configure                        | 4 ----
>  newlib/libc/machine/tic4x/Makefile.in                    | 1 -
>  newlib/libc/machine/tic4x/configure                      | 4 ----
>  newlib/libc/machine/tic6x/Makefile.in                    | 1 -
>  newlib/libc/machine/tic6x/configure                      | 4 ----
>  newlib/libc/machine/tic80/Makefile.in                    | 1 -
>  newlib/libc/machine/tic80/configure                      | 4 ----
>  newlib/libc/machine/v850/Makefile.in                     | 1 -
>  newlib/libc/machine/v850/configure                       | 4 ----
>  newlib/libc/machine/visium/Makefile.in                   | 1 -
>  newlib/libc/machine/visium/configure                     | 4 ----
>  newlib/libc/machine/w65/Makefile.in                      | 1 -
>  newlib/libc/machine/w65/configure                        | 4 ----
>  newlib/libc/machine/x86_64/Makefile.in                   | 1 -
>  newlib/libc/machine/x86_64/configure                     | 4 ----
>  newlib/libc/machine/xc16x/Makefile.in                    | 1 -
>  newlib/libc/machine/xc16x/configure                      | 4 ----
>  newlib/libc/machine/xscale/Makefile.in                   | 1 -
>  newlib/libc/machine/xscale/configure                     | 4 ----
>  newlib/libc/machine/xstormy16/Makefile.in                | 1 -
>  newlib/libc/machine/xstormy16/configure                  | 4 ----
>  newlib/libc/machine/z8k/Makefile.in                      | 1 -
>  newlib/libc/machine/z8k/configure                        | 4 ----
>  newlib/libc/sys/a29khif/Makefile.in                      | 1 -
>  newlib/libc/sys/a29khif/configure                        | 4 ----
>  newlib/libc/sys/amdgcn/Makefile.in                       | 1 -
>  newlib/libc/sys/amdgcn/configure                         | 4 ----
>  newlib/libc/sys/arm/Makefile.in                          | 1 -
>  newlib/libc/sys/arm/configure                            | 4 ----
>  newlib/libc/sys/configure                                | 9 +++------
>  newlib/libc/sys/d10v/Makefile.in                         | 1 -
>  newlib/libc/sys/d10v/configure                           | 4 ----
>  newlib/libc/sys/decstation/Makefile.in                   | 1 -
>  newlib/libc/sys/decstation/configure                     | 4 ----
>  newlib/libc/sys/epiphany/Makefile.in                     | 1 -
>  newlib/libc/sys/epiphany/configure                       | 4 ----
>  newlib/libc/sys/h8300hms/Makefile.in                     | 1 -
>  newlib/libc/sys/h8300hms/configure                       | 4 ----
>  newlib/libc/sys/h8500hms/Makefile.in                     | 1 -
>  newlib/libc/sys/h8500hms/configure                       | 4 ----
>  newlib/libc/sys/linux/configure                          | 9 +++------
>  newlib/libc/sys/linux/linuxthreads/configure             | 9 +++------
>  newlib/libc/sys/linux/linuxthreads/machine/configure     | 9 +++------
>  .../libc/sys/linux/linuxthreads/machine/i386/configure   | 9 +++------
>  newlib/libc/sys/linux/machine/configure                  | 9 +++------
>  newlib/libc/sys/linux/machine/i386/configure             | 9 +++------
>  newlib/libc/sys/m88kbug/Makefile.in                      | 1 -
>  newlib/libc/sys/m88kbug/configure                        | 4 ----
>  newlib/libc/sys/mmixware/Makefile.in                     | 1 -
>  newlib/libc/sys/mmixware/configure                       | 4 ----
>  newlib/libc/sys/netware/Makefile.in                      | 1 -
>  newlib/libc/sys/netware/configure                        | 4 ----
>  newlib/libc/sys/or1k/Makefile.in                         | 1 -
>  newlib/libc/sys/or1k/configure                           | 4 ----
>  newlib/libc/sys/phoenix/Makefile.in                      | 1 -
>  newlib/libc/sys/phoenix/configure                        | 4 ----
>  newlib/libc/sys/phoenix/machine/Makefile.in              | 1 -
>  newlib/libc/sys/phoenix/machine/arm/Makefile.in          | 1 -
>  newlib/libc/sys/phoenix/machine/arm/configure            | 4 ----
>  newlib/libc/sys/phoenix/machine/configure                | 4 ----
>  newlib/libc/sys/rdos/Makefile.in                         | 1 -
>  newlib/libc/sys/rdos/configure                           | 4 ----
>  newlib/libc/sys/rtems/Makefile.in                        | 1 -
>  newlib/libc/sys/rtems/configure                          | 4 ----
>  newlib/libc/sys/sh/Makefile.in                           | 1 -
>  newlib/libc/sys/sh/configure                             | 4 ----
>  newlib/libc/sys/sparc64/Makefile.in                      | 1 -
>  newlib/libc/sys/sparc64/configure                        | 4 ----
>  newlib/libc/sys/sun4/Makefile.in                         | 1 -
>  newlib/libc/sys/sun4/configure                           | 4 ----
>  newlib/libc/sys/sysmec/Makefile.in                       | 1 -
>  newlib/libc/sys/sysmec/configure                         | 4 ----
>  newlib/libc/sys/sysnec810/Makefile.in                    | 1 -
>  newlib/libc/sys/sysnec810/configure                      | 4 ----
>  newlib/libc/sys/sysnecv850/Makefile.in                   | 1 -
>  newlib/libc/sys/sysnecv850/configure                     | 4 ----
>  newlib/libc/sys/sysvi386/Makefile.in                     | 1 -
>  newlib/libc/sys/sysvi386/configure                       | 4 ----
>  newlib/libc/sys/sysvnecv70/Makefile.in                   | 1 -
>  newlib/libc/sys/sysvnecv70/configure                     | 4 ----
>  newlib/libc/sys/tic80/Makefile.in                        | 1 -
>  newlib/libc/sys/tic80/configure                          | 4 ----
>  newlib/libc/sys/tirtos/Makefile.in                       | 1 -
>  newlib/libc/sys/tirtos/configure                         | 4 ----
>  newlib/libc/sys/w65/Makefile.in                          | 1 -
>  newlib/libc/sys/w65/configure                            | 4 ----
>  newlib/libc/sys/z8ksim/Makefile.in                       | 1 -
>  newlib/libc/sys/z8ksim/configure                         | 4 ----
>  newlib/libm/configure                                    | 9 +++------
>  newlib/libm/machine/aarch64/Makefile.in                  | 1 -
>  newlib/libm/machine/aarch64/configure                    | 4 ----
>  newlib/libm/machine/arm/Makefile.in                      | 1 -
>  newlib/libm/machine/arm/configure                        | 4 ----
>  newlib/libm/machine/configure                            | 9 +++------
>  newlib/libm/machine/i386/configure                       | 9 +++------
>  newlib/libm/machine/mips/Makefile.in                     | 1 -
>  newlib/libm/machine/mips/configure                       | 4 ----
>  newlib/libm/machine/nds32/configure                      | 5 +----
>  newlib/libm/machine/powerpc/Makefile.in                  | 1 -
>  newlib/libm/machine/powerpc/configure                    | 4 ----
>  newlib/libm/machine/pru/Makefile.in                      | 1 -
>  newlib/libm/machine/pru/configure                        | 4 ----
>  newlib/libm/machine/riscv/Makefile.in                    | 1 -
>  newlib/libm/machine/riscv/configure                      | 4 ----
>  newlib/libm/machine/sparc/Makefile.in                    | 1 -
>  newlib/libm/machine/sparc/configure                      | 4 ----
>  newlib/libm/machine/spu/Makefile.in                      | 1 -
>  newlib/libm/machine/spu/configure                        | 4 ----
>  newlib/libm/machine/x86_64/configure                     | 9 +++------
>  newlib/testsuite/lib/newlib.exp                          | 4 ++--
>  209 files changed, 53 insertions(+), 583 deletions(-)
>
> diff --git a/newlib/acinclude.m4 b/newlib/acinclude.m4
> index 1a5dc60dbbbd..755f6e1165f0 100644
> --- a/newlib/acinclude.m4
> +++ b/newlib/acinclude.m4
> @@ -214,9 +214,6 @@ AC_SUBST(NEWLIB_CFLAGS)
>  NO_INCLUDE_LIST=${noinclude}
>  AC_SUBST(NO_INCLUDE_LIST)
>
> -LDFLAGS=${ldflags}
> -AC_SUBST(LDFLAGS)
> -
>  AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
>  AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
>  AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
> diff --git a/newlib/libc/sys/phoenix/machine/Makefile.in b/newlib/libc/sys/phoenix/machine/Makefile.in
> index 76b7a6545db4..8c380bc36498 100644
> --- a/newlib/libc/sys/phoenix/machine/Makefile.in
> +++ b/newlib/libc/sys/phoenix/machine/Makefile.in
> @@ -187,7 +187,6 @@ INSTALL_DATA = @INSTALL_DATA@
>  INSTALL_PROGRAM = @INSTALL_PROGRAM@
>  INSTALL_SCRIPT = @INSTALL_SCRIPT@
>  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
> -LDFLAGS = @LDFLAGS@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
>  LTLIBOBJS = @LTLIBOBJS@
> diff --git a/newlib/libc/sys/phoenix/machine/arm/Makefile.in b/newlib/libc/sys/phoenix/machine/arm/Makefile.in
> index d86ce691d312..bc9ae6e26503 100644
> --- a/newlib/libc/sys/phoenix/machine/arm/Makefile.in
> +++ b/newlib/libc/sys/phoenix/machine/arm/Makefile.in
> @@ -202,7 +202,6 @@ INSTALL_DATA = @INSTALL_DATA@
>  INSTALL_PROGRAM = @INSTALL_PROGRAM@
>  INSTALL_SCRIPT = @INSTALL_SCRIPT@
>  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
> -LDFLAGS = @LDFLAGS@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
>  LTLIBOBJS = @LTLIBOBJS@
> diff --git a/newlib/testsuite/lib/newlib.exp b/newlib/testsuite/lib/newlib.exp
> index f1df40e52618..8b43d2e5d3a0 100644
> --- a/newlib/testsuite/lib/newlib.exp
> +++ b/newlib/testsuite/lib/newlib.exp
> @@ -66,13 +66,13 @@ proc newlib_target_compile { source dest type options } {
>           [target_info needs_status_wrapper] != "0" && \
>           [info exists gluefile] } {
>       lappend options "libs=$gluefile"
> -     lappend options "ldflags=$wrap_flags"
> +     lappend options "LDFLAGS=$wrap_flags"
>      }
>
>      if [string match $host_triplet $target_triplet] then {
>       if [string match "i686-pc-linux-gnu" $host_triplet] then {
>           lappend options "libs=$objdir/crt0.o -lc -lgcc"
> -         lappend options "ldflags=-nostdlib -L$objdir/.libs [newlib_include_flags]"
> +         lappend options "LDFLAGS=-nostdlib -L$objdir/.libs [newlib_include_flags]"
>       }
>      }
>
> --
> 2.34.1
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.