Clang/GCC compiler settings update [SECURITY] (#7358)

- Add the following compilation flags for clang
  -fpie
  -fstack-protector-all
  -fstack-check (non-release)

- Add the following compilation flags for gcc
  -fpie
  -fstack-protector-all

- Fix -Wunused-result errors from above compilation flag updates

- Add _FORTIFY_SOURCE=2 to GCC DEFINES

Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
This commit is contained in:
Steve Pham
2022-02-07 09:01:07 -08:00
committed by GitHub
parent a6ddf4164f
commit 4d4f10beb8
10 changed files with 88 additions and 43 deletions
@@ -71,7 +71,7 @@ namespace AzNetworking
const char* GetNetworkErrorDesc(int32_t errorCode)
{
static AZ_THREAD_LOCAL char buffer[1024];
strerror_r(errorCode, buffer, sizeof(buffer));
[[maybe_unused]] auto strErrorResult = strerror_r(errorCode, buffer, sizeof(buffer));
return buffer;
}
}