Removed sorting on LDFLAGS in common.mk (#373).

Details:
- Removed a line of code in common.mk that passed LDFLAGS through the
  sort function. The purpose was not to sort the contents, but rather
  to remove duplicates. However, there is valid syntax in a string of
  linker flags that, when sorted, yields different/broken behavior.
  So I've removed the line in common.mk that sorts LDFLAGS. Also, for
  future use, I've added a new function, rm-dupls, that removes
  duplicates without sorting. (This function was based on code from a
  stackoverflow thread that is linked to in the comments for that
  code.) Thanks to Isuru Fernando for reporting this issue (#373).

Change-Id: Ie355cc111fd2c6669f0c3088e8fa5dc7c407a3b9
This commit is contained in:
Field G. Van Zee
2020-01-15 13:27:02 -06:00
committed by Devrajegowda, Kiran
parent b3c0309009
commit 08709d4117
4 changed files with 7 additions and 5 deletions

View File

@@ -55,6 +55,7 @@ but many others have contributed code and feedback, including
Devin Matthews @devinamatthews (The University of Texas at Austin)
Stefanos Mavros @smavros
Nisanth Padinharepatt (AMD)
Ajay Panyala @ajaypanyala
Devangi Parikh @dnparikh (The University of Texas at Austin)
Elmar Peise @elmar-peise (RWTH-Aachen)
Clément Pernet @ClementPernet

View File

@@ -212,6 +212,11 @@ get-sandbox-cxxtext-for = "('$(1)' CXXFLAGS for sandboxes)"
files-that-contain = $(strip $(foreach f, $(1), $(if $(findstring $(2),$(f)),$(f),)))
files-that-dont-contain = $(strip $(foreach f, $(1), $(if $(findstring $(2),$(f)),,$(f))))
# Define a function that removes duplicate words from a list.
# NOTE: This function was obtained via [1]; thanks bobbogo for this
# concise definition.
# [1] https://stackoverflow.com/questions/16144115/makefile-remove-duplicate-words-without-sorting
rm-dupls = $(if $1,$(firstword $1) $(call rm-dupls,$(filter-out $(firstword $1),$1)))
#
@@ -833,9 +838,6 @@ endif
# --- LDFLAGS cleanup ----------------------------------------------------------
#
# Remove duplicate flags/options in LDFLAGS (such as -lpthread) by sorting.
LDFLAGS := $(sort $(LDFLAGS))
#

View File

@@ -153,7 +153,7 @@ static void bli_mem_clear( mem_t* mem )
//Pass actual type instead
bli_mem_set_buf_type ( pb, mem );
#else
bli_mem_set_buf_type( -1, mem );
bli_mem_set_buf_type( ( packbuf_t )-1, mem );
#endif
bli_mem_set_pool( NULL, mem );
bli_mem_set_size( 0, mem );

View File

@@ -1062,7 +1062,6 @@ void bli_thread_partition_2x2
{
*nt1 = ( work1 >= work2 ? n_thread : 1 );
*nt2 = ( work1 < work2 ? n_thread : 1 );
return;
}