We disable C++ static destructors as best as possible in the various
toolchains, trying to eliminate unwanted destructor code. We don't want
to waste RAM or ROM on the C++-standard-specified behaviour of running
all statically-constructed objects' destructors in reverse order on
exit; we're never going to perform an orderly exit.
Techniques used include:
* `SingletonPtr` - makes an object be "lazily constructed" on first use,
and also eliminates its destructor. Lazy construction adds ROM+RAM
overhead.
* `__eabi_atexit` is stubbed out, preventing RAM usage by run-time
registration of static destructors.
* GCC has `exit` wrapped to kill shutdown code
* IAR has static destructors disabled in the compiler flags
Killing static destructors in the compiler is the optimum; if we only
stub out `__eabi_atexit`, the compiler is still inserting calls to it,
and referencing the destructors in those call.
Clang 8 added the compiler option `-fno-c++-static-destructors` (and the
object attributes `[[clang::no_destroy]]` and
`[[clang::always_destroy]]` for fine control).
We can hence enable that option in ARMC6 tool profiles, matching IAR.
This option appears to exist in ARM Compiler 6.11, but generates an
apparently spurious linker error about `EthernetInterface`. It works in
ARM Compiler 6.13, so this PR needs to wait until the compiler is
updated.
* Add optimised constexpr default constructor. Default construction
was previously by a heavyweight defaulted `nsapi_addr_t` parameter.
* Remove deprecated resolving constructor.
* Take `nsapi_addr_t` inputs by constant reference rather than value.
* Inline the trivial getters and setters.
* Use `unique_ptr` to manage the text buffer.
* Make `operator bool` explicit.
* Optimise some methods.
* Update to C++11 style (default initialisers, nullptr etc)
$(file > $@.in, $(filter %.o, $^)) is not supported in GNU Make 3.81.
Create the linker response file with pipe redirect from echo command.
This is tested with Cygwin make and make 3.8.1 shipped with macOS.
(cherry picked from commit 6918e6a76b)
Revert "Fixed problem with overlong command line."
This reverts commit dd02ac09a1.
See also https://github.com/ARMmbed/mbed-os/pull/12646#issuecomment-602058273
The list of object files was so long, that it got truncated by the bash (git-bash).
Error was
/usr/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/usr/bin/sh: -c: line 1: syntax error: unexpected end of file
mingw32-make[1]: *** [Makefile:679: mbed-os-example-blinky-baremetal.elf] Error 1
mingw32-make: *** [Makefile:26: all] Error 2
Such a problem has aleady been reported in: https://github.com/ARMmbed/mbed-os/issues/10943#issuecomment-510064805
I fixed this problem using this answer: https://stackoverflow.com/a/37506805/5534993
Master branch contains lot of missing SPDX identifiers, we will clean them up but this will take some time. In the meantime, we should not increase the license missing files. Each PR will report if there is no license issue or positive number reported as Github status. Travis won't fail if there are issues. This will highlight the issues that anyone can fix.
As soon as master is clean, we can fix set_status and revert part of this commit.
Musca-B1 is a Cortex-M33 based target with security extension enabled.
- ARM_MUSCA_B1 is the non-secure target running mbed-os.
- ARM_MUSCA_B1_S is the secure target running TF-M.
- TF-M sources were imported and patched in previous commits.
- TF-M secure bootloader (McuBoot) for MUSCA_B1 is submitted by a
pre-built binary.
- A post-build hook concatenates The secure and non-secure binaries,
signs it and then concatenates the bootloader with the signed binary.
Change-Id: I4b36290941b5f0bb7aa7c12dda2f38b5c1e39ae2
Signed-off-by: Tamas Kaman <tamas.kaman@arm.com>
Signed-off-by: Gabor Abonyi <gabor.abonyi@arm.com>
The goal: check license offenders in pull request
This is similar to what astyle does in Travis. We get list of files being changed. Because scancode does not support list of files being scanned but rather a file or directory, we copy files to SCANCODE folder. Execute scancode license check in this folder and check for offenders.
The rules there are: code files must have a license and SDPX identifier. If they don't, we print these and ask for review.
It functions nicely there is just one workaround needed. SPDX is not always 100 percent correctly found, therefore we recheck file if no SPDX manually in the script. This proves to remove false positives.
For bootloader enabled target, it needs to have cmsis pack or provide memory override. This change fixes build failure in case of no cmsis pack but providing memory override with start being zero.
This is a workaround for the GCC not using the strong symbols from
C files to override the weak symbols from ASM files. This GCC bug is only
present when building with the link-time optimizer (LTO) enabled. For
more details please see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83967
This can be fixed by changing the order of object files in the linker
command; objects providing the weak symbols and compiled from assembly
must be listed before the objects providing the strong symbols.
To keep things simple, ALL object files from ASM are listed before
other object files.
Disable the lto for the default develop and release prifiles and move
the flags to tools/profiles/extensions/lto.json profile.
Usage:
mbed compile --profile release --profile tools/profiles/extensions/lto.json
This fixes the undefined reference to 'main' that arose after adding
the "-flto" flag to compilation.
This was the case for combined "-Wl,--wrap,main" and "-flto" flags.
According to GCC man:
To use the link-time optimizer, -flto and optimization options should be
specified at compile time and during the final link. It is recommended
that you compile all the files participating in the same link with the
same options and also specify those options at link time.
Additionally, move the '-g3' flag out of 'common' flags in the debug
profile. Although the '-g' is correctly ignored by the linker, the
'-glevel' is not and causes a build error "ld: unrecognized option
'-g3'".