Small fixes to enable LTO compilation (#3418)

Small fixes to enable LTO compilation

To do this in racket/src:
  ./configure CFLAGS="-O3 -march=native -flto"
              LDFLAGS="-O3 -march=native -flto"
              --prefix=...

One fix deals with variable `errnum` that might be used uninitialized.
The other is to ensure that `boot_file_data` is marked as used
otherwise, it is removed by LTO and ends up crashing build
in `embed-boot.rkt`.
This commit is contained in:
Paulo Matos 2020-09-30 15:44:13 +02:00 committed by GitHub
parent 0c9fc7c374
commit 5db75a92ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -78,7 +78,7 @@ static int is_valid_lz4_length(iptr count);
do { body; \
if (ok) { flag = 0; } \
else { \
INT errnum; \
INT errnum = 0; \
S_glzerror((fd),&errnum); \
S_glzclearerr((fd)); \
if (errnum == Z_ERRNO) { \
@ -99,7 +99,7 @@ static int is_valid_lz4_length(iptr count);
do { body; \
if (ok) { flag = 0; break; } \
else { \
INT errnum; \
INT errnum = 0; \
S_glzerror((fd),&errnum); \
S_glzclearerr((fd)); \
if (errnum == Z_ERRNO) { \
@ -117,7 +117,7 @@ static int is_valid_lz4_length(iptr count);
do { body; \
if (ok) { flag = 0; } \
else { \
INT errnum; \
INT errnum = 0; \
S_glzerror((fd),&errnum); \
S_glzclearerr((fd)); \
if (errnum == Z_ERRNO) { flag = 1; } \

View File

@ -53,6 +53,7 @@ static void scheme_set_dll_procs(scheme_dll_open_proc open,
# define embedded_dll_close NULL
#endif
PRESERVE_IN_EXECUTABLE
char *boot_file_data = "BooT FilE OffsetS:\0\0\0\0\0\0\0\0\0\0\0\0";
static int boot_file_offset = 18;