Conditionalize make behavior e.g. disable --gc-sections

Gedare Bloom gedare at rtems.org
Fri May 10 11:58:32 UTC 2019


On Tue, May 7, 2019 at 5:03 AM Peter Dufault <dufault at hda.com> wrote:
>
> What is best practice to change build behavior?  e.g. I need to use --whole-archive/--no-whole-archive in one place but --gc-sections breaks it and that's turned on for the BSP (xilinx_zynq_a9_qemu).
>
> I’ve done this in the .cfg files for the BSP:
>
> ifneq ($(RTEMS_GC_SECTIONS_DISABLE),1)
> LDFLAGS_GC_SECTIONS_DISABLE = -Wl,--gc-sections
> endif
>
> (...)
>
> LDFLAGS = $(LDFLAGS_GC_SECTIONS_DISABLE)
>
> and then I set RTEMS_GC_SECTIONS_DISABLE=1 in the one Makefile where I need it.  I don’t see similar patterns, is this the way to do it?
>

Historically a new BSP variant has been introduced when there needs to
be a change at this .cfg level. But, I could see a rationale to
include this kind of switching behavior at a higher level. Someone
might consider how to integrate it into our configure.ac/Makefile.am
black magic, but that is beyond me :).

An alternative approach that may work from what you propose is to use
following in the xilinx zynq .cfg file:
LDFLAGS ?= -Wl, --gc-sections
then, you can provide own LDFLAGS = -Wl on your make command line or
in your Makefile, I think that would work bit more elegant

> Peter
> -----------------
> Peter Dufault
> HD Associates, Inc.      Software and System Engineering
>
> This email is delivered through the public internet using protocols subject to interception and tampering.
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list