Go to file
Yann E. MORIN c74234c392 package/dmalloc: don't use SSP
dmalloc directly calls into $(LD) to generate a shared library our of
the static one.

To detect what command it should run, ./configure tries various
incantations of ld with various command line options until one does not
fail. One of those is (basically):
    $(LD) --whole-archive -o contest.o.t contest.a

This makes ./configure conclude what the command to link a shared
library in the Makefile should be, and thus stores that in a variable:
    shlinkargs='$(LD) --whole-archive -o $@'

... which is then AC_SUBST()ed into Makefile.in with a rule like:

    $(SHLIB): $(LIBRARY)
        @shlinkargs@ $(LIRARY)

which once substiuted, gives:

    $(SHLIB): $(LIBRARY)
        $(LD) --whole-archive -o $@ $(LIRARY)

However, when SSP is enabled, the __stack_chk_fail_local and co symbols
are provided by additional libraries or object files, and that is the
responsibility of gcc to pass those when linking. But as dmalloc
directly calls ld, it misses those.

Changing dmalloc to use $(CC) is not trivial, however.

First, we can't pass LD=$(TARGET_CC), otherwise the whole package
explodes [0]: indeed --whole-archive is unknown to gcc, so it must be
passed as -Wl,--whole archive instead. So we'd need to add a new test
that uses $(CC), like so:
    $(CC) -Wl,--whole-archive -o contest.o.t contest.a

However, in that case, gcc does pass additional libs/objs (like, for
eample, the SSP ones) to the linker. But then those are also included
in the whole-archive section. This causes the linker to add all the
symbols form those libs/objs, even those not needed for SSP; on some
archs, like PPC, that may require floating point symbols (__muldiv3 et
al.) which are in another library, and thus the linker can't find them.

The proper solution wouild be to add -Wl,--no-whole-archive, but that
would have to be added _after_ the library we want to link, i.e.e we
should be able to evntually run:

    $(CC) -Wl,--whole-archive -o $@ $(LIRARY) -Wl,--no-whole-archive

That would require that we introduce a new variable that is added
_after_ the $(LIBRARY), e.g. @shlinkargs_post@ or so...

This is a bigger endeavour than we want to pursue...

Since dmalloc is a debugging utility, it is not supposed to go into
production builds, and during debugging, it would not be surprising that
it needs to poke around arrays to debug them.

So, we go the easier route: disable SSP altogether.

[0] with lots of nice colors, but that's not the point, is it?

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit 3481674ee3)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2023-03-04 14:40:48 +01:00
arch arch/arch.mk.xtensa: relax check on overlay file to apply only to internal toolchains 2022-11-15 14:21:42 +01:00
board board/asus/tinker: rename label linux-next to linux in extlinux.conf 2023-02-28 21:22:01 +01:00
boot boot/afboot-stm32: disable stack-protector 2023-02-28 17:14:32 +01:00
configs configs/asus_tinker_rk3288: fix boot by prepending tpl to spl+u-boot 2023-02-28 21:21:36 +01:00
docs docs/manual: add 'menuconfig' to out-of-tree examples 2023-03-04 13:57:35 +01:00
fs fs/erofs: enable support for reproducible build 2023-01-17 10:26:11 +01:00
linux {linux, linux-headers}: bump 4.{14, 19}.x / 5.{4, 10, 15}.x / 6.1.x series 2023-03-04 10:01:16 +01:00
package package/dmalloc: don't use SSP 2023-03-04 14:40:48 +01:00
support Update for 2022.02.10 2023-03-01 21:49:07 +01:00
system system: remove use of legacy md5 option 2023-02-22 17:45:46 +01:00
toolchain toolchain/toolchain-external/toolchain-external-codescape-mti-mips: remove wrong MIPS32r5 and MIPS64r5 support 2023-03-04 12:26:31 +01:00
utils utils/brmake: fix shellcheck errors 2023-02-28 17:12:08 +01:00
.clang-format .clang-format: initial import from Linux 5.15.6 2022-01-01 15:01:13 +01:00
.defconfig
.flake8 Revert ".flake8: fix check for 80/132 columns" 2021-01-02 17:38:20 +01:00
.gitignore
.gitlab-ci.yml utils/checkpackagelib/lib_sysv: run shellcheck 2022-02-06 18:27:03 +01:00
.shellcheckrc utils/check-package: improve shellcheck reproducibility 2022-08-18 07:59:26 +02:00
CHANGES Update for 2022.02.10 2023-03-01 21:49:07 +01:00
Config.in Config.in: update default CPAN mirror to https, update mirrors URL 2022-12-21 20:41:57 +01:00
Config.in.legacy package/sunxi-mali-utgard: properly handle legacy for renamed options 2023-02-22 17:50:12 +01:00
COPYING
DEVELOPERS DEVELOPERS: drop Matt Weber 2023-03-04 12:00:45 +01:00
Makefile Update for 2022.02.10 2023-03-01 21:49:07 +01:00
Makefile.legacy Remove BR2_DEPRECATED 2016-10-15 23:14:45 +02:00
README docs: move the IRC channel away from Freenode 2021-05-29 22:16:23 +02:00

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on OFTC IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches