mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] selftests: fixes for undefined reference (LDFLAGS -> LDLIBS)
@ 2017-06-28 17:08 Fathi Boudra
  2017-06-28 17:08 ` [PATCH 1/3] selftests: net: use LDLIBS instead of LDFLAGS Fathi Boudra
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fathi Boudra @ 2017-06-28 17:08 UTC (permalink / raw)
  To: linux-kselftest, Shuah Khan
  Cc: linux-kernel, John Stultz, Denys Dmytriyenko, SeongJae Park,
	Fathi Boudra

This serie fixes undefined reference errors caused by the usage of LDFLAGS
instead of LDLIBS.

The issue is GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters.

Fathi Boudra (3):
  selftests: net: use LDLIBS instead of LDFLAGS
  selftests: seccomp: use LDLIBS instead of LDFLAGS
  selftests: timers: use LDLIBS instead of LDFLAGS

 tools/testing/selftests/net/Makefile     | 2 +-
 tools/testing/selftests/seccomp/Makefile | 4 ++--
 tools/testing/selftests/timers/Makefile  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.13.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-06-29  7:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 17:08 [PATCH 0/3] selftests: fixes for undefined reference (LDFLAGS -> LDLIBS) Fathi Boudra
2017-06-28 17:08 ` [PATCH 1/3] selftests: net: use LDLIBS instead of LDFLAGS Fathi Boudra
2017-06-28 17:08 ` [PATCH 2/3] selftests: seccomp: " Fathi Boudra
2017-06-28 21:40   ` sjpark
2017-06-29  7:02     ` Fathi Boudra
2017-06-28 17:08 ` [PATCH 3/3] selftests: timers: " Fathi Boudra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®