Unverified Commit b08ebff3 authored by Ozan Tezcan's avatar Ozan Tezcan Committed by GitHub
Browse files

Pass -flto flag to the linker (#11350)

Currently, we add -flto to the compile flags only. We are supposed
to add it to the linker flags as well. Clang build fails because of this.

Added a change to add -flto to REDIS_CFLAGS and REDIS_LDFLAGS
if the build optimization flag is -O3. (noopt build will not use -flto)
parent 663fbd34
...@@ -15,7 +15,11 @@ ...@@ -15,7 +15,11 @@
release_hdr := $(shell sh -c './mkreleasehdr.sh') release_hdr := $(shell sh -c './mkreleasehdr.sh')
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
OPTIMIZATION?=-O3 -flto OPTIMIZATION?=-O3
ifeq ($(OPTIMIZATION),-O3)
REDIS_CFLAGS+=-flto
REDIS_LDFLAGS+=-flto
endif
DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram
NODEPS:=clean distclean NODEPS:=clean distclean
......
...@@ -1573,9 +1573,9 @@ REDIS_STATIC void *_quicklistSaver(unsigned char *data, size_t sz) { ...@@ -1573,9 +1573,9 @@ REDIS_STATIC void *_quicklistSaver(unsigned char *data, size_t sz) {
* Returns malloc'd value from quicklist */ * Returns malloc'd value from quicklist */
int quicklistPop(quicklist *quicklist, int where, unsigned char **data, int quicklistPop(quicklist *quicklist, int where, unsigned char **data,
size_t *sz, long long *slong) { size_t *sz, long long *slong) {
unsigned char *vstr; unsigned char *vstr = NULL;
size_t vlen; size_t vlen = 0;
long long vlong; long long vlong = 0;
if (quicklist->count == 0) if (quicklist->count == 0)
return 0; return 0;
int ret = quicklistPopCustom(quicklist, where, &vstr, &vlen, &vlong, int ret = quicklistPopCustom(quicklist, where, &vstr, &vlen, &vlong,
......
...@@ -1028,7 +1028,7 @@ unsigned char *zzlDelete(unsigned char *zl, unsigned char *eptr) { ...@@ -1028,7 +1028,7 @@ unsigned char *zzlDelete(unsigned char *zl, unsigned char *eptr) {
unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, sds ele, double score) { unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, sds ele, double score) {
unsigned char *sptr; unsigned char *sptr;
char scorebuf[MAX_D2STRING_CHARS]; char scorebuf[MAX_D2STRING_CHARS];
int scorelen; int scorelen = 0;
long long lscore; long long lscore;
int score_is_long = double2ll(score, &lscore); int score_is_long = double2ll(score, &lscore);
if (!score_is_long) if (!score_is_long)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment