mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
makefiles: add as-needed only for newer systems
Add some -Wl flags separatly and avoid their duplication. Also add --as-needed only when system is using 'newer' readline library - on these older system the usage of '--as-needed' seems to be causing some hard to solve problem - so avoid it.
This commit is contained in:
parent
ba13ac8704
commit
a8009f72bf
@ -232,15 +232,26 @@ WFLAGS += -Wsync-nand
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ("@STATIC_LINK@", "yes")
|
|
||||||
ifeq (,$(findstring relro,$(LDFLAGS)))
|
|
||||||
ifeq ("@HAVE_FULL_RELRO@", "yes")
|
ifeq ("@HAVE_FULL_RELRO@", "yes")
|
||||||
LDFLAGS += -Wl,-z,relro,-z,now,-z,pack-relative-relocs,--as-needed
|
ifneq ("@STATIC_LINK@", "yes")
|
||||||
|
ifeq (,$(findstring -z\,relro,$(LDFLAGS)))
|
||||||
|
LDFLAGS += -Wl,-z,relro
|
||||||
|
endif
|
||||||
|
ifeq (,$(findstring -z\,now,$(LDFLAGS)))
|
||||||
|
LDFLAGS += -Wl,-z,now
|
||||||
|
endif
|
||||||
|
ifeq (,$(findstring -z\,pack-relative-relocs,$(LDFLAGS)))
|
||||||
|
LDFLAGS += -Wl,-z,pack-relative-relocs
|
||||||
|
endif
|
||||||
|
# For systems with old readline library that requires extra libs to link with
|
||||||
|
# we stick to default --no-as-needed and we avoid adding --as-needed flag
|
||||||
|
ifneq (2,$(words $(findstring -l,$(READLINE_LIBS))))
|
||||||
|
ifeq (,$(findstring --as-needed,$(LDFLAGS)))
|
||||||
|
LDFLAGS += -Wl,--as-needed
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ("@HAVE_PIE@", "yes")
|
ifeq ("@HAVE_PIE@", "yes")
|
||||||
ifeq ("@HAVE_FULL_RELRO@", "yes")
|
|
||||||
EXTRA_EXEC_CFLAGS += -fPIE
|
EXTRA_EXEC_CFLAGS += -fPIE
|
||||||
EXTRA_EXEC_LDFLAGS += -pie -fPIE
|
EXTRA_EXEC_LDFLAGS += -pie -fPIE
|
||||||
endif
|
endif
|
||||||
|
19
make.tmpl.in
19
make.tmpl.in
@ -269,10 +269,22 @@ WFLAGS += -Wsync-nand
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ("@STATIC_LINK@", "yes")
|
|
||||||
ifeq (,$(findstring relro,$(LDFLAGS)))
|
|
||||||
ifeq ("@HAVE_FULL_RELRO@", "yes")
|
ifeq ("@HAVE_FULL_RELRO@", "yes")
|
||||||
LDFLAGS += -Wl,-z,relro,-z,now,-z,pack-relative-relocs,--as-needed
|
ifneq ("@STATIC_LINK@", "yes")
|
||||||
|
ifeq (,$(findstring -z\,relro,$(LDFLAGS)))
|
||||||
|
LDFLAGS += -Wl,-z,relro
|
||||||
|
endif
|
||||||
|
ifeq (,$(findstring -z\,now,$(LDFLAGS)))
|
||||||
|
LDFLAGS += -Wl,-z,now
|
||||||
|
endif
|
||||||
|
ifeq (,$(findstring -z\,pack-relative-relocs,$(LDFLAGS)))
|
||||||
|
LDFLAGS += -Wl,-z,pack-relative-relocs
|
||||||
|
endif
|
||||||
|
# For systems with old readline library that requires extra libs to link with
|
||||||
|
# we stick to default --no-as-needed and we avoid adding --as-needed flag
|
||||||
|
ifneq (2,$(words $(findstring -l,$(READLINE_LIBS))))
|
||||||
|
ifeq (,$(findstring --as-needed,$(LDFLAGS)))
|
||||||
|
LDFLAGS += -Wl,--as-needed
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -281,6 +293,7 @@ ifeq ("@HAVE_PIE@", "yes")
|
|||||||
EXTRA_EXEC_LDFLAGS += -pie -fPIE
|
EXTRA_EXEC_LDFLAGS += -pie -fPIE
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
#WFLAGS += -W -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers
|
#WFLAGS += -W -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers
|
||||||
#WFLAGS += -Wsign-compare -Wunused-parameter -Wmissing-field-initializers
|
#WFLAGS += -Wsign-compare -Wunused-parameter -Wmissing-field-initializers
|
||||||
|
Loading…
Reference in New Issue
Block a user