Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1676911
| Path | csiph.com!news.freedyn.net!open-news-network.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Fathi Boudra <fathi.boudra@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/3] selftests: timers: use LDLIBS instead of LDFLAGS |
| Date | Wed, 28 Jun 2017 20:00:03 +0200 |
| Message-ID | <tXppV-t5-23@gated-at.bofh.it> (permalink) |
| References | <tXppV-t5-25@gated-at.bofh.it> |
| X-Original-To | linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y0FuqVJLjkLXrYZ2OgokxI/xGpFHC7qi0rzVJlYcqys=; b=fIC68zu1VQ59fbcmxIX+CLZ2aRUgx0C+iqP1EZ7hS6IrWHa2oo+lu32JJ/CTPD83UY 4gNHMM6c+K43vV1E7EMmtZxxMIt2cSdwvjuoZh/sEvaePkM4HKITkPDL24aItgQKE56F XGoCRSMjGZ5V5qEfGyAPTBhvzAeb1uFLUShjE= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y0FuqVJLjkLXrYZ2OgokxI/xGpFHC7qi0rzVJlYcqys=; b=fDgIYFesVw3tj4MhOyhfMexi08jLIIv+Mb9V6GA8Bvsl7aG96kVUKlBrTImaO1chDA ssK/u7yz03JscMdstg/zSE5qcQQPtTZRIXtjc/4LxoPXDj96xspDW+xJd/i3/XWcqLvS 7hEcqqMQPW2N+8Q+AsjOOFdwq5wkLMQjL5LTSy+av42BfxqWB9pG6t9OGWiC2dseO6fH pPxRKOYh5Bje3lmLqhcCcLwoHJHnEhGAOdeWlgnBC+TJXxodAtBii2TcYe0VxMIDPIBc 0GpnhcFUNTaTfe9kP7QuXVlSktw9A8vLVxhGJrBQk5ruCiCJjCmr2398MMqDM0k0PtLm nEaw== |
| X-Gm-Message-State | AKS2vOyasrhKhbyWf2JDFP+MKP/E9wD8TtVyyHqX8yJA9ztv38NeIMaD gJNTqKjCHFdWhfLc |
| X-Received | by 10.25.206.205 with SMTP id e196mr3949090lfg.126.1498669749106; Wed, 28 Jun 2017 10:09:09 -0700 (PDT) |
| X-Mailer | git-send-email 2.13.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 65 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, John Stultz <john.stultz@linaro.org>, Denys Dmytriyenko <denys@ti.com>, SeongJae Park <sj38.park@gmail.com>, Fathi Boudra <fathi.boudra@linaro.org> |
| X-Original-Date | Wed, 28 Jun 2017 20:08:59 +0300 |
| X-Original-Message-ID | <20170628170859.28583-4-fathi.boudra@linaro.org> |
| X-Original-References | <20170628170859.28583-1-fathi.boudra@linaro.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1676911 |
Show key headers only | View raw
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> --- tools/testing/selftests/timers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile index 5fa1d7e9a915..f48d7ca9d9b1 100644 --- a/tools/testing/selftests/timers/Makefile +++ b/tools/testing/selftests/timers/Makefile @@ -1,6 +1,6 @@ BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) -LDFLAGS += -lrt -lpthread +LDLIBS += -lrt -lpthread # these are all "safe" tests that don't modify # system time or require escalated privileges -- 2.13.0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 3/3] selftests: timers: use LDLIBS instead of LDFLAGS Fathi Boudra <fathi.boudra@linaro.org> - 2017-06-28 20:00 +0200
csiph-web