diff options
| author | Tom Rini <[email protected]> | 2021-05-24 16:12:31 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2021-05-24 16:12:31 -0400 |
| commit | 27c6d9663c3f42059514e47c17652304a1cfcfc9 (patch) | |
| tree | 15e7a1deb449053a3ffca9b708813cce2da366ec /cmd/stackprot_test.c | |
| parent | eb53b943be2949ca111140a8e05532cd74cda058 (diff) | |
| parent | 2fc62f2991744dfeec65f8619092c359d8ecbcb0 (diff) | |
Merge branch '2021-05-24-add-lto-support'
- Add LTO (link time optimization) support to the build system and
enable it on a few boards. This is an alternative to using
-ffunction-sections/-fdata-sections and --gc-sections at link time to
remove unused code. This can result in notable savings, but needs
testing on each platform before use as it can expose problems by
optimizing away various functionally necessary calls.
Diffstat (limited to 'cmd/stackprot_test.c')
| -rw-r--r-- | cmd/stackprot_test.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/stackprot_test.c b/cmd/stackprot_test.c index 36f5bac8d23..1e26193e88b 100644 --- a/cmd/stackprot_test.c +++ b/cmd/stackprot_test.c @@ -9,9 +9,16 @@ static int do_test_stackprot_fail(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + /* + * In order to avoid having the compiler optimize away the stack smashing + * we need to do a little something here. + */ char a[128]; memset(a, 0xa5, 512); + + printf("We have smashed our stack as this should not exceed 128: sizeof(a) = %ld\n", strlen(a)); + return 0; } |
