linux_dsm_epyc7002/tools/testing/selftests/timers
Fathi Boudra 7d4e591bc0 selftests: timers: use LDLIBS instead of LDFLAGS
posix_timers fails to build due to undefined reference errors:

 aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
 -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
 -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
 posix_timers.c
 -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
 /tmp/cc1FTZzT.o: In function `check_timer_create':
 /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
 undefined reference to `timer_create'
 /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
 undefined reference to `timer_settime'
 collect2: error: ld returned 1 exit status

It's 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, use LDLIBS instead of LDFLAGS to properly link against
libpthread.

Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Signed-off-by: Shuah Khan <shuah@kernel.org>
2019-01-28 08:02:12 -07:00
..
.gitignore selftests: move RTC tests to rtc subfolder 2018-05-30 15:21:51 -06:00
adjtick.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
alarmtimer-suspend.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
change_skew.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
clocksource-switch.c selftests/timers: make loop consistent with array size 2017-08-25 10:00:51 -06:00
freq-step.c Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-04 13:06:34 -07:00
inconsistency-check.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
leap-a-day.c kselftests: timers: leap-a-day: Change default arguments to help test runs 2017-08-22 11:34:52 -06:00
leapcrash.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
Makefile selftests: timers: use LDLIBS instead of LDFLAGS 2019-01-28 08:02:12 -07:00
mqueue-lat.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
nanosleep.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
nsleep-lat.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
posix_timers.c selftests/timers: Add missing error code assignment before test 2016-09-20 09:00:28 -06:00
raw_skew.c selftest: timers: Tweak raw_skew to SKIP when ADJ_OFFSET/other clock adjustments are in progress 2018-07-10 12:43:21 -07:00
rtcpie.c selftests: timers: rtcpie: restore previous PIE rate 2018-05-30 15:21:51 -06:00
set-2038.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
set-tai.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
set-timer-lat.c selftests: timers: set-timer-lat: Fix hang when testing unsupported alarms 2017-09-25 10:09:07 -06:00
set-tz.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
skew_consistency.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
threadtest.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00
valid-adjtimex.c selftests: timers: drop support for !KTEST case 2017-08-22 11:15:59 -06:00