Go to file
Yann E. MORIN 3481674ee3 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>
2023-02-15 22:46:35 +01:00
arch arch/arch.mk.xtensa: relax check on overlay file to apply only to internal toolchains 2022-11-13 22:32:31 +01:00
board board/visionfive2: add link to documentation 2023-02-12 21:49:09 +01:00
boot boot/afboot-stm32: disable stack-protector 2023-02-08 16:54:35 +01:00
configs configs/stm32f429_xip_defconfig: bump Linux version to 6.1.10 2023-02-11 13:12:51 +01:00
docs docs/manual: add 'menuconfig' to out-of-tree examples 2023-02-15 22:28:58 +01:00
fs fs/cpio: allow users to provide their own dracut modules 2023-02-06 22:46:35 +01:00
linux package/linux-headers: drop 6.0.x option 2023-02-14 18:12:17 +01:00
package package/dmalloc: don't use SSP 2023-02-15 22:46:35 +01:00
support support/config-fragments: add a bootlin s390x toolchain 2023-02-15 10:23:35 +01:00
system system: Warn if systemd is used with kernel < 4.15 2023-02-07 22:51:26 +01:00
toolchain toolchain/toolchain-external/toolchain-external-codescape-mti-mips: remove wrong MIPS32r5 and MIPS64r5 support 2023-02-15 22:00:05 +01:00
utils utils/check-package: check files in utils/ 2023-02-08 15:28:33 +01:00
.checkpackageignore utils/check-package: check all shell scripts 2023-02-08 13:31:06 +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 .gitlab-ci.yml: update Docker image to use 2023-02-07 18:15:00 +01:00
.shellcheckrc utils/check-package: improve shellcheck reproducibility 2022-07-25 23:52:47 +02:00
CHANGES *: fix typo for separate(d|) in text 2023-02-06 11:22:17 +01:00
Config.in toolchain: make paranoid check of library/header paths unconditional 2023-02-05 15:11:25 +01:00
Config.in.legacy package/linux-headers: drop 6.0.x option 2023-02-14 18:12:17 +01:00
COPYING
DEVELOPERS DEVELOPERS: drop Matt Weber 2023-02-15 21:56:13 +01:00
Makefile Makefile: check-package should use the ignore list 2023-02-06 22:10:57 +01:00
Makefile.legacy
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