All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains
@ 2010-07-28 12:55 Olaf Hering
  2010-07-28 14:02 ` Ian Jackson
  0 siblings, 1 reply; 10+ messages in thread
From: Olaf Hering @ 2010-07-28 12:55 UTC (permalink / raw)
  To: xen-devel


Fix link error in openSuSE 11.2. 
The order of objects and linked libraries is important with recent toolchain
when --as-needed is used.

xc.o: In function `xc_wait_for_event_or_timeout':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:80: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:86: undefined reference to `xc_evtchn_pending'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:89: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:93: undefined reference to `xc_evtchn_unmask'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:96: undefined reference to `xc_report_error'
xc.o: In function `xc_mem_paging_flush_ioemu_cache':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:57: undefined reference to `xs_daemon_open'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:61: undefined reference to `xs_write'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:63: undefined reference to `xs_daemon_close'
xc.o: In function `get_platform_info':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xg_save_restore.h:52: undefined reference to `xc_version'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xg_save_restore.h:55: undefined reference to `xc_version'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xg_save_restore.h:58: undefined reference to `xc_memory_op'
xc.o: In function `do_domctl':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:148: undefined reference to `hcall_buf_prep'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:150: undefined reference to `safe_strerror'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:150: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:159: undefined reference to `do_xen_hypercall'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:162: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:166: undefined reference to `hcall_buf_release'
xenpaging.o: In function `xenpaging_resume_page':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:393: undefined reference to `xc_mem_paging_resume'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:395: undefined reference to `xc_evtchn_notify'
xenpaging.o: In function `xenpaging_evict_page':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:342: undefined reference to `xc_map_foreign_pages'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:346: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:355: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:365: undefined reference to `xc_mem_paging_evict'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:369: undefined reference to `xc_report_error'
xenpaging.o: In function `evict_victim':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:457: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:461: undefined reference to `xc_mem_paging_nominate'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:469: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:475: undefined reference to `xc_report_error'
xenpaging.o: In function `xenpaging_teardown':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:244: undefined reference to `xc_mem_event_disable'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:247: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:252: undefined reference to `xc_evtchn_unbind'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:255: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:261: undefined reference to `xc_evtchn_close'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:264: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:270: undefined reference to `xc_interface_close'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:273: undefined reference to `xc_report_error'
xenpaging.o: In function `xenpaging_init':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:76: undefined reference to `xc_interface_open'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:80: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:97: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:105: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:119: undefined reference to `xc_mem_event_enable'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:125: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:127: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:132: undefined reference to `xc_evtchn_open'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:135: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:140: undefined reference to `xc_evtchn_bind_interdomain'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:145: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:155: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:163: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:171: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:175: undefined reference to `xc_domain_getinfolist'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:179: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:190: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:193: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:199: undefined reference to `xc_report_error'
xenpaging.o: In function `main':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:529: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:539: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:542: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:551: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:556: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:581: undefined reference to `xc_report'
xenpaging.o: In function `xenpaging_populate_page':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:411: undefined reference to `xc_mem_paging_prep'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:415: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:422: undefined reference to `xc_map_foreign_pages'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:427: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:435: undefined reference to `xc_report_error'
xenpaging.o: In function `main':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:589: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:602: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:611: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:629: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:643: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:648: undefined reference to `xc_interface_close'
policy_default.o: In function `policy_choose_victim':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/policy_default.c:64: undefined reference to `xc_report'
collect2: ld returned 1 exit status
make[3]: *** [xenpaging] Error 1

Signed-off-by: Olaf Hering <olaf@aepfle.de>

---
 tools/xenpaging/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- xen-unstable.hg-4.1.21864.orig/tools/xenpaging/Makefile
+++ xen-unstable.hg-4.1.21864/tools/xenpaging/Makefile
@@ -27,7 +27,7 @@ IBINS    = xenpaging
 all: $(IBINS)
 
 xenpaging: $(OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
 
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)

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

* Re: [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains
  2010-07-28 12:55 [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains Olaf Hering
@ 2010-07-28 14:02 ` Ian Jackson
  2010-07-28 15:47   ` Olaf Hering
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Jackson @ 2010-07-28 14:02 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel

Olaf Hering writes ("[Xen-devel] [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains"):
> Fix link error in openSuSE 11.2. 
> The order of objects and linked libraries is important with recent toolchain
> when --as-needed is used.

>  xenpaging: $(OBJS)
> -	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
> +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

Thanks, but once again, LDFLAGS belongs at the beginning and what's
needed is to introduce a *_LIBS variable.

Ian.

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

* [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains
  2010-07-28 14:02 ` Ian Jackson
@ 2010-07-28 15:47   ` Olaf Hering
  2010-07-28 16:05     ` Ian Jackson
  0 siblings, 1 reply; 10+ messages in thread
From: Olaf Hering @ 2010-07-28 15:47 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel



Fix link error in openSuSE 11.2. 
The order of objects and linked libraries is important with recent toolchain
when --as-needed is used.


xc.o: In function `xc_wait_for_event_or_timeout':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:80: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:86: undefined reference to `xc_evtchn_pending'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:89: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:93: undefined reference to `xc_evtchn_unmask'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:96: undefined reference to `xc_report_error'
xc.o: In function `xc_mem_paging_flush_ioemu_cache':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:57: undefined reference to `xs_daemon_open'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:61: undefined reference to `xs_write'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xc.c:63: undefined reference to `xs_daemon_close'
xc.o: In function `get_platform_info':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xg_save_restore.h:52: undefined reference to `xc_version'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xg_save_restore.h:55: undefined reference to `xc_version'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xg_save_restore.h:58: undefined reference to `xc_memory_op'
xc.o: In function `do_domctl':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:148: undefined reference to `hcall_buf_prep'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:150: undefined reference to `safe_strerror'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:150: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:159: undefined reference to `do_xen_hypercall'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:162: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/../../tools/libxc/xc_private.h:166: undefined reference to `hcall_buf_release'
xenpaging.o: In function `xenpaging_resume_page':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:393: undefined reference to `xc_mem_paging_resume'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:395: undefined reference to `xc_evtchn_notify'
xenpaging.o: In function `xenpaging_evict_page':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:342: undefined reference to `xc_map_foreign_pages'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:346: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:355: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:365: undefined reference to `xc_mem_paging_evict'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:369: undefined reference to `xc_report_error'
xenpaging.o: In function `evict_victim':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:457: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:461: undefined reference to `xc_mem_paging_nominate'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:469: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:475: undefined reference to `xc_report_error'
xenpaging.o: In function `xenpaging_teardown':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:244: undefined reference to `xc_mem_event_disable'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:247: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:252: undefined reference to `xc_evtchn_unbind'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:255: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:261: undefined reference to `xc_evtchn_close'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:264: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:270: undefined reference to `xc_interface_close'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:273: undefined reference to `xc_report_error'
xenpaging.o: In function `xenpaging_init':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:76: undefined reference to `xc_interface_open'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:80: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:97: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:105: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:119: undefined reference to `xc_mem_event_enable'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:125: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:127: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:132: undefined reference to `xc_evtchn_open'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:135: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:140: undefined reference to `xc_evtchn_bind_interdomain'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:145: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:155: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:163: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:171: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:175: undefined reference to `xc_domain_getinfolist'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:179: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:190: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:193: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:199: undefined reference to `xc_report_error'
xenpaging.o: In function `main':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:529: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:539: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:542: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:551: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:556: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:581: undefined reference to `xc_report'
xenpaging.o: In function `xenpaging_populate_page':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:411: undefined reference to `xc_mem_paging_prep'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:415: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:422: undefined reference to `xc_map_foreign_pages'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:427: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:435: undefined reference to `xc_report_error'
xenpaging.o: In function `main':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:589: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:602: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:611: undefined reference to `xc_report'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:629: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:643: undefined reference to `xc_report_error'
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/xenpaging.c:648: undefined reference to `xc_interface_close'
policy_default.o: In function `policy_choose_victim':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/xenpaging/policy_default.c:64: undefined reference to `xc_report'
collect2: ld returned 1 exit status
make[3]: *** [xenpaging] Error 1

Signed-off-by: Olaf Hering <olaf@aepfle.de>

---
v2: use XENPAGING_LIBS instead of moving LDFLAGS to the end of cmdline

 tools/xenpaging/Makefile |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- xen-unstable.hg-4.1.21864.orig/tools/xenpaging/Makefile
+++ xen-unstable.hg-4.1.21864/tools/xenpaging/Makefile
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS   += -I $(XEN_XC)
 CFLAGS   += -I ./
 CFLAGS   += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore)
-LDFLAGS  += $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore)
+XENPAGING_LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore)
 
 POLICY    = default
 
@@ -27,7 +27,7 @@ IBINS    = xenpaging
 all: $(IBINS)
 
 xenpaging: $(OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(XENPAGING_LIBS)
 
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)

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

* Re: [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains
  2010-07-28 15:47   ` Olaf Hering
@ 2010-07-28 16:05     ` Ian Jackson
  2010-07-28 16:15       ` Olaf Hering
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Jackson @ 2010-07-28 16:05 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel

Olaf Hering writes ("[PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains"):
> -LDFLAGS  += $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore)
> +XENPAGING_LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore)

*_LIBS = $(LDFLAGS_*)  ?

surely some mistake.

Ian.

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

* Re: [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains
  2010-07-28 16:05     ` Ian Jackson
@ 2010-07-28 16:15       ` Olaf Hering
  2010-07-29 15:16         ` Ian Jackson
  0 siblings, 1 reply; 10+ messages in thread
From: Olaf Hering @ 2010-07-28 16:15 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Wed, Jul 28, Ian Jackson wrote:

> Olaf Hering writes ("[PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains"):
> > -LDFLAGS  += $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore)
> > +XENPAGING_LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore)
> 
> *_LIBS = $(LDFLAGS_*)  ?
> 
> surely some mistake.

Ian,

LDFLAGS_libxenctrl is defined in tools/Rules.mk and used in several
Makefiles. Are you suggesting to rename these variables and update all
users?


Also, its not clear to me why the place of LDFLAGS matters. In another
thread it was stated that -static may behave different. Whats the reason
for that?

Olaf

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

* Re: [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains
  2010-07-28 16:15       ` Olaf Hering
@ 2010-07-29 15:16         ` Ian Jackson
  2010-07-29 15:20           ` Olaf Hering
  2010-08-01  9:51           ` [PATCH] split LDLIBS from LDFLAGS to fix link errors in " Olaf Hering
  0 siblings, 2 replies; 10+ messages in thread
From: Ian Jackson @ 2010-07-29 15:16 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel

Olaf Hering writes ("Re: [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains"):
> LDFLAGS_libxenctrl is defined in tools/Rules.mk and used in several
> Makefiles. Are you suggesting to rename these variables and update all
> users?

Linker command lines are order-sensitive.  This means that LDFLAGS and
LDLIBS are not the same and should not be conflated.  You are finding
build bugs on some toolchains because libraries have been stuffed into
LDFLAGS which come after the general linker flags but before the
objects, when you want them to be at the end (or nearly at the end).

The right answer is not to make LDFLAGS be included at the end of the
link line; nor is it to copy values from some LDFLAGS variable to an
LDLIBS variable.

I think the right answer is to rename the variables LDFLAGS_foo which
actually contain arguments like -Lfoo -lfoo to LDLIBS_foo.  If there
are mixed variables (which contain actual linker options rather than
just instructions to link against libraries) they should be split in
two.

> Also, its not clear to me why the place of LDFLAGS matters. In another
> thread it was stated that -static may behave different. Whats the reason
> for that?

-static was just an example.  It affects only libraries appearing
after it in the link line.  In general, arguments and options to the
linker are quite positional.  This means that linker options (which
are typically found in LDLIBS variables) normally need to come first,
before any object files or libraries are mentioned.

Ian.

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

* Re: [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains
  2010-07-29 15:16         ` Ian Jackson
@ 2010-07-29 15:20           ` Olaf Hering
  2010-07-29 15:39             ` Ian Jackson
  2010-08-01  9:51           ` [PATCH] split LDLIBS from LDFLAGS to fix link errors in " Olaf Hering
  1 sibling, 1 reply; 10+ messages in thread
From: Olaf Hering @ 2010-07-29 15:20 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Thu, Jul 29, Ian Jackson wrote:

> I think the right answer is to rename the variables LDFLAGS_foo which
> actually contain arguments like -Lfoo -lfoo to LDLIBS_foo.  If there
> are mixed variables (which contain actual linker options rather than
> just instructions to link against libraries) they should be split in
> two.

Ian,

I will walk through the code and prepare individual patches to move to
the suggested variable naming.

Olaf

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

* Re: [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains
  2010-07-29 15:20           ` Olaf Hering
@ 2010-07-29 15:39             ` Ian Jackson
  0 siblings, 0 replies; 10+ messages in thread
From: Ian Jackson @ 2010-07-29 15:39 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel

Olaf Hering writes ("Re: [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains"):
> On Thu, Jul 29, Ian Jackson wrote:
> > I think the right answer is to rename the variables LDFLAGS_foo which
> > actually contain arguments like -Lfoo -lfoo to LDLIBS_foo.  If there
> > are mixed variables (which contain actual linker options rather than
> > just instructions to link against libraries) they should be split in
> > two.
> 
> I will walk through the code and prepare individual patches to move to
> the suggested variable naming.

Thank you!  One patch to change all the variable names at once would
be fine.

Ian.

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

* [PATCH] split LDLIBS from LDFLAGS to fix link errors in recent toolchains
  2010-07-29 15:16         ` Ian Jackson
  2010-07-29 15:20           ` Olaf Hering
@ 2010-08-01  9:51           ` Olaf Hering
  2010-08-11 13:44             ` Ian Jackson
  1 sibling, 1 reply; 10+ messages in thread
From: Olaf Hering @ 2010-08-01  9:51 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel


Linker command lines are order-sensitive.
Move linker options -Lfoo -lfoo from LDFLAGS to LDLIBS and place this new
variable after the objects to link. This resolves build errors in xenpagin
and blktap with recent toolchains.

rename SHLIB_CFLAGS to SHLIB_LDFLAGS
rename LDFLAGS_* to LDLIBS_*
move LDFLAGS usage after CFLAGS in CC calls
remove stale comments in xenpaging Makefile

Signed-off-by: Olaf Hering <olaf@aepfle.de>

---
 config/StdGNU.mk                  |    2 +-
 config/SunOS.mk                   |    2 +-
 tools/Rules.mk                    |    8 ++++----
 tools/blktap/drivers/Makefile     |   10 +++++-----
 tools/blktap/lib/Makefile         |    6 +++---
 tools/blktap2/Makefile            |    2 +-
 tools/blktap2/drivers/Makefile    |   12 ++++++------
 tools/blktap2/vhd/Makefile        |    4 ++--
 tools/blktap2/vhd/lib/Makefile    |    2 +-
 tools/console/Makefile            |   13 +++++++------
 tools/debugger/xenitp/Makefile    |    4 ++--
 tools/flask/libflask/Makefile     |    2 +-
 tools/flask/utils/Makefile        |    4 ++--
 tools/fs-back/Makefile            |    4 ++--
 tools/libfsimage/Rules.mk         |    2 +-
 tools/libfsimage/common/Makefile  |    2 +-
 tools/libxc/Makefile              |    4 ++--
 tools/libxen/Makefile             |    2 +-
 tools/libxen/Makefile.dist        |    4 ++--
 tools/libxl/Makefile              |    6 +++---
 tools/misc/Makefile               |    2 +-
 tools/security/Makefile           |    2 +-
 tools/vnet/libxutil/Makefile      |    2 +-
 tools/xcutils/Makefile            |    2 +-
 tools/xenbackendd/Makefile        |    4 ++--
 tools/xenmon/Makefile             |    6 +++---
 tools/xenpaging/Makefile          |    7 ++-----
 tools/xenpmd/Makefile             |    4 ++--
 tools/xenstat/libxenstat/Makefile |    6 +++---
 tools/xenstore/Makefile           |    4 ++--
 tools/xentrace/Makefile           |    6 +++---
 31 files changed, 69 insertions(+), 71 deletions(-)

--- xen-unstable.hg-4.1.21890.orig/config/StdGNU.mk
+++ xen-unstable.hg-4.1.21890/config/StdGNU.mk
@@ -59,7 +59,7 @@ CURSES_LIBS = -lncurses
 PTHREAD_LIBS = -lpthread
 UTIL_LIBS = -lutil
 SONAME_LDFLAG = -soname
-SHLIB_CFLAGS = -shared
+SHLIB_LDFLAGS = -shared
 
 ifneq ($(debug),y)
 CFLAGS += -O2 -fomit-frame-pointer
--- xen-unstable.hg-4.1.21890.orig/config/SunOS.mk
+++ xen-unstable.hg-4.1.21890/config/SunOS.mk
@@ -51,7 +51,7 @@ CURSES_LIBS = -lcurses
 PTHREAD_LIBS = -lpthread
 UTIL_LIBS =
 SONAME_LDFLAG = -h
-SHLIB_CFLAGS = -R $(SunOS_LIBDIR) -shared
+SHLIB_LDFLAGS = -R $(SunOS_LIBDIR) -shared
 
 ifneq ($(debug),y)
 CFLAGS += -O2 -fno-omit-frame-pointer
--- xen-unstable.hg-4.1.21890.orig/tools/Rules.mk
+++ xen-unstable.hg-4.1.21890/tools/Rules.mk
@@ -18,16 +18,16 @@ XEN_BLKTAP2        = $(XEN_ROOT)/tools/b
 CFLAGS_include = -I$(XEN_INCLUDE)
 
 CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_include)
-LDFLAGS_libxenctrl = -L$(XEN_LIBXC) -lxenctrl
+LDLIBS_libxenctrl = -L$(XEN_LIBXC) -lxenctrl
 
 CFLAGS_libxenguest = -I$(XEN_LIBXC) $(CFLAGS_include)
-LDFLAGS_libxenguest = -L$(XEN_LIBXC) -lxenguest
+LDLIBS_libxenguest = -L$(XEN_LIBXC) -lxenguest
 
 CFLAGS_libxenstore = -I$(XEN_XENSTORE) $(CFLAGS_include)
-LDFLAGS_libxenstore = -L$(XEN_XENSTORE) -lxenstore
+LDLIBS_libxenstore = -L$(XEN_XENSTORE) -lxenstore
 
 CFLAGS_libblktapctl = -I$(XEN_BLKTAP2)/control -I$(XEN_BLKTAP2)/include $(CFLAGS_include)
-LDFLAGS_libblktapctl = -L$(XEN_BLKTAP2)/control -lblktapctl
+LDLIBS_libblktapctl = -L$(XEN_BLKTAP2)/control -lblktapctl
 
 X11_LDPATH = -L/usr/X11R6/$(LIBLEAFDIR)
 
--- xen-unstable.hg-4.1.21890.orig/tools/blktap/drivers/Makefile
+++ xen-unstable.hg-4.1.21890/tools/blktap/drivers/Makefile
@@ -29,8 +29,8 @@ CFLAGS += -DMEMSHR
 MEMSHRLIBS += $(MEMSHR_DIR)/libmemshr.a
 endif
 
-LDFLAGS_blktapctrl := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) $(MEMSHRLIBS) -L../lib -lblktap -lrt -lm -lpthread
-LDFLAGS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz
+LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm -lpthread
+LDLIBS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz
 
 BLK-OBJS-y  := block-aio.o
 BLK-OBJS-y  += block-sync.o
@@ -48,16 +48,16 @@ BLKTAB-OBJS-$(CONFIG_Linux) += blktapctr
 all: $(IBIN) qcow-util
 
 blktapctrl: $(BLKTAB-OBJS-y)
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDFLAGS_blktapctrl)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_blktapctrl)
 
 tapdisk: tapdisk.o $(BLK-OBJS-y)
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDFLAGS_img)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_img)
 
 .PHONY: qcow-util
 qcow-util: img2qcow qcow2raw qcow-create
 
 img2qcow qcow2raw qcow-create: %: %.o $(BLK-OBJS-y)
-	$(CC) $(CFLAGS) -o $* $^ $(LDFLAGS) $(LDFLAGS_img)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $* $^ $(LDLIBS_img)
 
 install: all
 	$(INSTALL_PROG) $(IBIN) $(QCOW_UTIL) $(VHD_UTIL) $(DESTDIR)$(SBINDIR)
--- xen-unstable.hg-4.1.21890.orig/tools/blktap/lib/Makefile
+++ xen-unstable.hg-4.1.21890/tools/blktap/lib/Makefile
@@ -8,7 +8,7 @@ SONAME   = libblktap.so.$(MAJOR)
 CFLAGS   += -I.
 CFLAGS   += $(CFLAGS_libxenctrl)
 CFLAGS   += $(CFLAGS_libxenstore)
-LDFLAGS  += $(LDFLAGS_libxenstore)
+LDLIBS   += $(LDLIBS_libxenstore)
 
 SRCS     :=
 SRCS     += xenbus.c blkif.c xs_api.c
@@ -46,8 +46,8 @@ clean:
 	rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen TAGS
 
 libblktap.so.$(MAJOR).$(MINOR): $(OBJS_PIC) 
-	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,$(SONAME) $(SHLIB_CFLAGS) \
-	      $(LDFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,$(SONAME) $(SHLIB_LDFLAGS) \
+	      -o $@ $^ $(LDLIBS)
 	ln -sf libblktap.so.$(MAJOR).$(MINOR) libblktap.so.$(MAJOR)
 	ln -sf libblktap.so.$(MAJOR) libblktap.so
 
--- xen-unstable.hg-4.1.21890.orig/tools/blktap2/Makefile
+++ xen-unstable.hg-4.1.21890/tools/blktap2/Makefile
@@ -2,7 +2,7 @@ XEN_ROOT = ../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += $(CFLAGS_libxenctrl)
-LDFLAGS += $(LDFLAGS_libxenctrl)
+LDLIBS += $(LDLIBS_libxenctrl)
 
 SUBDIRS-y :=
 SUBDIRS-y += include
--- xen-unstable.hg-4.1.21890.orig/tools/blktap2/drivers/Makefile
+++ xen-unstable.hg-4.1.21890/tools/blktap2/drivers/Makefile
@@ -25,7 +25,7 @@ endif
 
 LIBS      += -lrt -lz
 
-LDFLAGS_img := $(LDFLAGS_libxenctrl) $(CRYPT_LIB) -lpthread -lz -lm
+LBLIBS_img := $(LDLIBS_libxenctrl) $(CRYPT_LIB) -lpthread -lz -lm
 
 LIBS += -L$(LIBVHDDIR) -lvhd
 
@@ -93,16 +93,16 @@ all: $(IBIN) lock-util qcow-util
 
 
 tapdisk2: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk2.c
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LDFLAGS_img)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LBLIBS_img)
 
 tapdisk-client: tapdisk-client.o
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)  $(LDFLAGS_img)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)  $(LBLIBS_img)
 
 tapdisk-stream tapdisk-diff: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LDFLAGS_img)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LBLIBS_img)
 
 td-util: td.o tapdisk-utils.o tapdisk-log.o $(PORTABLE-OBJS-y)
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)  $(LDFLAGS_img)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)  $(LBLIBS_img)
 
 lock-util: lock.c
 	$(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LDFLAGS) $(LIBS)
@@ -111,7 +111,7 @@ lock-util: lock.c
 qcow-util: img2qcow qcow2raw qcow-create
 
 img2qcow qcow2raw qcow-create: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LDFLAGS_img)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LBLIBS_img)
 
 install: all
 	$(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR)
--- xen-unstable.hg-4.1.21890.orig/tools/blktap2/vhd/Makefile
+++ xen-unstable.hg-4.1.21890/tools/blktap2/vhd/Makefile
@@ -38,10 +38,10 @@ LIBS_DEPENDS	  := lib/libvhd.so lib/vhd.
 $(LIBS_DEPENDS):subdirs-all
 
 vhd-util: vhd-util.o $(LIBS_DEPENDS)
-	$(CC) $(CFLAGS) -o vhd-util vhd-util.o $(LDFLAGS) $(LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o vhd-util vhd-util.o $(LIBS)
 
 vhd-update: vhd-update.o $(LIBS_DEPENDS)
-	$(CC) $(CFLAGS) -o vhd-update vhd-update.o $(LDFLAGS) $(LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o vhd-update vhd-update.o $(LIBS)
 
 install: all
 	$(MAKE) subdirs-install
--- xen-unstable.hg-4.1.21890.orig/tools/blktap2/vhd/lib/Makefile
+++ xen-unstable.hg-4.1.21890/tools/blktap2/vhd/lib/Makefile
@@ -55,7 +55,7 @@ all: build
 build: $(LIBVHD-BUILD)
 
 libvhd.a: $(LIB-OBJS)
-	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_CFLAGS) \
+	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_LDFLAGS) \
 		$(LDFLAGS) -o libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(LIBS) $^
 	ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) libvhd.so.$(LIBVHD-MAJOR)
 	ln -sf libvhd.so.$(LIBVHD-MAJOR) libvhd.so
--- xen-unstable.hg-4.1.21890.orig/tools/console/Makefile
+++ xen-unstable.hg-4.1.21890/tools/console/Makefile
@@ -6,8 +6,11 @@ CFLAGS  += -Werror
 
 CFLAGS  += $(CFLAGS_libxenctrl)
 CFLAGS  += $(CFLAGS_libxenstore)
-LDFLAGS += $(LDFLAGS_libxenctrl)
-LDFLAGS += $(LDFLAGS_libxenstore)
+LDLIBS += $(LDLIBS_libxenctrl)
+LDLIBS += $(LDLIBS_libxenstore)
+LDLIBS += $(UTIL_LIBS)
+LDLIBS += $(SOCKET_LIBS)
+LDLIBS += -lrt
 
 BIN      = xenconsoled xenconsole
 
@@ -20,12 +23,10 @@ clean:
 	$(RM) client/*.o daemon/*.o
 
 xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
-	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) \
-              $(UTIL_LIBS) $(SOCKET_LIBS) -lrt
+	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
 
 xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
-	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) \
-	      $(UTIL_LIBS) $(SOCKET_LIBS)
+	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
 
 .PHONY: install
 install: $(BIN)
--- xen-unstable.hg-4.1.21890.orig/tools/debugger/xenitp/Makefile
+++ xen-unstable.hg-4.1.21890/tools/debugger/xenitp/Makefile
@@ -46,8 +46,8 @@ clean:
 	$(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN)
 
 %: %.c $(HDRS) Makefile
-	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS_libxenctrl)
+	$(CC) $(CFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
 
 XENITP_OBJS=xenitp.o ia64-dis.o ia64-opc.o cpu-ia64-opc.o
 xenitp: $(XENITP_OBJS)
-	$(CC) $(CFLAGS) -o $@ $(XENITP_OBJS) $(LDFLAGS_libxenctrl)
+	$(CC) $(CFLAGS) -o $@ $(XENITP_OBJS) $(LDLIBS_libxenctrl)
--- xen-unstable.hg-4.1.21890.orig/tools/flask/libflask/Makefile
+++ xen-unstable.hg-4.1.21890/tools/flask/libflask/Makefile
@@ -59,6 +59,6 @@ libflask.so.$(MAJOR): libflask.so.$(MAJO
 	ln -sf $< $@
 
 libflask.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libflask.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libflask.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
 
 -include $(DEPS)
--- xen-unstable.hg-4.1.21890.orig/tools/flask/utils/Makefile
+++ xen-unstable.hg-4.1.21890/tools/flask/utils/Makefile
@@ -14,7 +14,7 @@ BASECFLAGS+= -I$(LIBFLASK_ROOT)/include
 BASECFLAGS+= -I.
 
 CFLAGS  += $(BASECFLAGS)
-LDFLAGS += $(PROFILE) -L$(XEN_LIBXC) -L$(LIBFLASK_ROOT)
+LDLIBS += $(PROFILE) -L$(XEN_LIBXC) -L$(LIBFLASK_ROOT)
 TESTDIR  = testsuite/tmp
 TESTFLAGS= -DTESTING
 TESTENV  = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
@@ -27,7 +27,7 @@ CLIENTS_OBJS := $(patsubst flask-%,%.o,$
 all: $(CLIENTS)
 
 $(CLIENTS): flask-%: %.o
-	$(CC) $(CFLAGS) $(LDFLAGS) $< $(LOADLIBES) $(LDLIBS) -L. -lflask $(LDFLAGS_libxenctrl) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS) $< $(LOADLIBES) $(LDLIBS) -L. -lflask $(LDLIBS_libxenctrl) -o $@
 
 .PHONY: clean
 clean: 
--- xen-unstable.hg-4.1.21890.orig/tools/fs-back/Makefile
+++ xen-unstable.hg-4.1.21890/tools/fs-back/Makefile
@@ -14,8 +14,8 @@ CFLAGS   += $(INCLUDES) -I.
 CFLAGS   += -D_GNU_SOURCE
 
 LIBS      := -L. -L.. -L../lib
-LIBS      += $(LDFLAGS_libxenctrl)
-LIBS      += $(LDFLAGS_libxenstore)
+LIBS      += $(LDLIBS_libxenctrl)
+LIBS      += $(LDLIBS_libxenstore)
 LIBS      += -lrt -lpthread
 
 OBJS	  := fs-xenbus.o fs-ops.o
--- xen-unstable.hg-4.1.21890.orig/tools/libfsimage/Rules.mk
+++ xen-unstable.hg-4.1.21890/tools/libfsimage/Rules.mk
@@ -24,7 +24,7 @@ fs-install: fs-all
 	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)
 
 $(FSLIB): $(PIC_OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) $(SHLIB_CFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS)
+	$(CC) $(CFLAGS) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS)
 
 clean distclean:
 	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS)
--- xen-unstable.hg-4.1.21890.orig/tools/libfsimage/common/Makefile
+++ xen-unstable.hg-4.1.21890/tools/libfsimage/common/Makefile
@@ -37,7 +37,7 @@ libfsimage.so.$(MAJOR): libfsimage.so.$(
 	ln -sf $< $@
 
 libfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ -lpthread
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ -lpthread
 
 -include $(DEPS)
 
--- xen-unstable.hg-4.1.21890.orig/tools/libxc/Makefile
+++ xen-unstable.hg-4.1.21890/tools/libxc/Makefile
@@ -145,7 +145,7 @@ libxenctrl.so.$(MAJOR): libxenctrl.so.$(
 	ln -sf $< $@
 
 libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ $(PTHREAD_LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS)
 
 # libxenguest
 
@@ -181,7 +181,7 @@ xc_dom_bzimageloader.opic: CFLAGS += $(c
 
 libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(call zlib-options,l)
 libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz -lxenctrl $(PTHREAD_LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz -lxenctrl $(PTHREAD_LIBS)
 
 -include $(DEPS)
 
--- xen-unstable.hg-4.1.21890.orig/tools/libxen/Makefile
+++ xen-unstable.hg-4.1.21890/tools/libxen/Makefile
@@ -44,7 +44,7 @@ libxenapi.so.$(MAJOR): libxenapi.so.$(MA
 	ln -sf $< $@
 
 libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
 
 libxenapi.a: $(LIBXENAPI_OBJS)
 	$(AR) rcs libxenapi.a $^
--- xen-unstable.hg-4.1.21890.orig/tools/libxen/Makefile.dist
+++ xen-unstable.hg-4.1.21890/tools/libxen/Makefile.dist
@@ -30,7 +30,7 @@ LDFLAGS = $(shell xml2-config --libs) \
 # -h for Solaris
 SONAME_LDFLAG ?= -soname
 # -R /usr/sfw/$(LIBDIR) -shared for Solaris
-SHLIB_CFLAGS ?= -shared
+SHLIB_LDFLAGS ?= -shared
 
 # ginstall for Solaris
 INSTALL      = install
@@ -54,7 +54,7 @@ libxenapi.so.$(MAJOR): libxenapi.so.$(MA
 	ln -sf $< $@
 
 libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
 
 libxenapi.a: $(LIBXENAPI_OBJS)
 	$(AR) rcs libxenapi.a $^
--- xen-unstable.hg-4.1.21890.orig/tools/libxl/Makefile
+++ xen-unstable.hg-4.1.21890/tools/libxl/Makefile
@@ -15,7 +15,7 @@ CFLAGS += -Werror -Wno-format-zero-lengt
 CFLAGS += -I. -fPIC
 CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
 
-LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore) $(LDFLAGS_libblktapctl) $(UTIL_LIBS)
+LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS)
 
 LIBXL_OBJS-y = osdeps.o libxl_paths.o libxl_bootloader.o
 LIBXL_OBJS = flexarray.o libxl.o libxl_pci.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o xenguest.o libxl_utils.o $(LIBXL_OBJS-y)
@@ -59,7 +59,7 @@ libxenlight.so.$(MAJOR): libxenlight.so.
 	ln -sf $< $@
 
 libxenlight.so.$(MAJOR).$(MINOR): $(LIBXL_OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
 
 libxenlight.a: $(LIBXL_OBJS)
 	$(AR) rcs libxenlight.a $^
@@ -71,7 +71,7 @@ libxlutil.so.$(XLUMAJOR): libxlutil.so.$
 	ln -sf $< $@
 
 libxlutil.so.$(XLUMAJOR).$(XLUMINOR): $(LIBXLU_OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_CFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_LDFLAGS) -o $@ $^
 
 libxlutil.a: $(LIBXLU_OBJS)
 	$(AR) rcs libxlutil.a $^
--- xen-unstable.hg-4.1.21890.orig/tools/misc/Makefile
+++ xen-unstable.hg-4.1.21890/tools/misc/Makefile
@@ -52,7 +52,7 @@ clean:
 	$(CC) -c $(CFLAGS) -o $@ $<
 
 xen-hvmctx xenperf xenpm gtracestat xenlockprof xen-hptool xenwatchdogd: %: %.o Makefile
-	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)
+	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
 
 gtraceview: %: %.o Makefile
 	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(CURSES_LIBS)
--- xen-unstable.hg-4.1.21890.orig/tools/security/Makefile
+++ xen-unstable.hg-4.1.21890/tools/security/Makefile
@@ -76,7 +76,7 @@ build: $(ACM_INST_TOOLS) $(ACM_NOINST_TO
 	chmod 700 $(ACM_SCRIPTS)
 
 xensec_tool: $(OBJS_TOOL)
-	$(CC) -g $(CFLAGS) $(LDFLAGS) -O0 -o $@ $^ $(LDFLAGS_libxenctrl)
+	$(CC) -g $(CFLAGS) $(LDFLAGS) -O0 -o $@ $^ $(LDLIBS_libxenctrl)
 
 xensec_gen: xensec_gen.py
 	cp -f $^ $@
--- xen-unstable.hg-4.1.21890.orig/tools/vnet/libxutil/Makefile
+++ xen-unstable.hg-4.1.21890/tools/vnet/libxutil/Makefile
@@ -52,7 +52,7 @@ libxutil.so.$(MAJOR): libxutil.so.$(MAJO
 	ln -sf $^ $@
 
 libxutil.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
-	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxutil.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxutil.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
 
 libxutil.a: $(LIB_OBJS)
 	$(AR) rc $@ $^
--- xen-unstable.hg-4.1.21890.orig/tools/xcutils/Makefile
+++ xen-unstable.hg-4.1.21890/tools/xcutils/Makefile
@@ -16,7 +16,7 @@ CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_
 
 PROGRAMS = xc_restore xc_save readnotes lsevtchn
 
-LDLIBS   = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)
+LDLIBS   = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
 
 .PHONY: all
 all: build
--- xen-unstable.hg-4.1.21890.orig/tools/xenbackendd/Makefile
+++ xen-unstable.hg-4.1.21890/tools/xenbackendd/Makefile
@@ -15,7 +15,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS  += -Werror
 CFLAGS  += $(CFLAGS_libxenstore)
 CPPFLAGS += -DXEN_SCRIPT_DIR="\"$(XEN_SCRIPT_DIR)\""
-LDFLAGS += $(LDFLAGS_libxenstore)
+LDLIBS  += $(LDLIBS_libxenstore)
 
 SBIN = xenbackendd
 
@@ -36,6 +36,6 @@ clean:
 
 
 %: %.c Makefile
-	$(CC) $(CFLAGS) $(CPPFLAGS) $< $(LDFLAGS) -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
 
 -include $(DEPS)
--- xen-unstable.hg-4.1.21890.orig/tools/xenmon/Makefile
+++ xen-unstable.hg-4.1.21890/tools/xenmon/Makefile
@@ -16,7 +16,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS  += -Werror
 CFLAGS  += -I $(XEN_XC)
 CFLAGS  += $(CFLAGS_libxenctrl)
-LDFLAGS += $(LDFLAGS_libxenctrl)
+LDLIBS  += $(LDLIBS_libxenctrl)
 
 BIN = xentrace_setmask xenbaked
 SCRIPTS = xenmon.py
@@ -42,8 +42,8 @@ clean:
 
 
 %: %.c Makefile
-	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
 xentrace_%: %.c Makefile
-	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
 
 -include $(DEPS)
--- xen-unstable.hg-4.1.21890.orig/tools/xenpaging/Makefile
+++ xen-unstable.hg-4.1.21890/tools/xenpaging/Makefile
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS   += -I $(XEN_XC)
 CFLAGS   += -I ./
 CFLAGS   += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore)
-LDFLAGS  += $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore)
+LDLIBS  += $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore)
 
 POLICY    = default
 
@@ -15,19 +15,16 @@ CFLAGS   += -Werror
 CFLAGS   += -Wno-unused
 CFLAGS   += -g
 
-#CFLAGS   += -Wl,-rpath,..
 CFLAGS   += -Wp,-MD,.$(@F).d
 DEPS     = .*.d
 
-#LDFLAGS  += $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest)
-
 OBJS     = $(SRCS:.c=.o)
 IBINS    = xenpaging
 
 all: $(IBINS)
 
 xenpaging: $(OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
 
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
--- xen-unstable.hg-4.1.21890.orig/tools/xenpmd/Makefile
+++ xen-unstable.hg-4.1.21890/tools/xenpmd/Makefile
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror
 CFLAGS  += $(CFLAGS_libxenstore)
-LDFLAGS += $(LDFLAGS_libxenstore)
+LDLIBS += $(LDLIBS_libxenstore)
 
 BIN      = xenpmd
 
@@ -20,6 +20,6 @@ clean:
 	$(RM) -f $(BIN) $(DEPS)
 
 %: %.c Makefile
-	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
 
 -include $(DEPS)
--- xen-unstable.hg-4.1.21890.orig/tools/xenstat/libxenstat/Makefile
+++ xen-unstable.hg-4.1.21890/tools/xenstat/libxenstat/Makefile
@@ -53,7 +53,7 @@ $(LIB): $(OBJECTS-y)
 	$(RANLIB) $@
 
 $(SHLIB): $(OBJECTS-y)
-	$(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_CFLAGS) -o $@ \
+	$(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_LDFLAGS) -o $@ \
 	    $(OBJECTS-y) $(LDLIBS-y)
 
 src/xenstat.o: src/xenstat.c src/xenstat.h src/xenstat_priv.h
@@ -112,7 +112,7 @@ $(PYSRC): bindings/swig/xenstat.i
 	swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<
 
 $(PYLIB): $(PYSRC)
-	$(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_CFLAGS) -lxenstat -o $@ $<
+	$(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $<
 
 python-bindings: $(PYLIB) $(PYMOD)
 
@@ -134,7 +134,7 @@ $(PERLSRC): bindings/swig/xenstat.i
 	swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
 
 $(PERLLIB): $(PERLSRC)
-	$(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_CFLAGS) -lxenstat -o $@ $<
+	$(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $<
 
 .PHONY: perl-bindings
 perl-bindings: $(PERLLIB) $(PERLMOD)
--- xen-unstable.hg-4.1.21890.orig/tools/xenstore/Makefile
+++ xen-unstable.hg-4.1.21890/tools/xenstore/Makefile
@@ -47,7 +47,7 @@ CFLAGS += -DHAVE_DTRACE=1
 endif
  
 xenstored: $(XENSTORED_OBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDFLAGS_libxenctrl) $(SOCKET_LIBS) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@
 
 $(CLIENTS): xenstore
 	ln -f xenstore $@
@@ -69,7 +69,7 @@ libxenstore.so.$(MAJOR): libxenstore.so.
 xs.opic: CFLAGS += -DUSE_PTHREAD
 
 libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread
 
 libxenstore.a: xs.o xs_lib.o
 	$(AR) rcs $@ $^
--- xen-unstable.hg-4.1.21890.orig/tools/xentrace/Makefile
+++ xen-unstable.hg-4.1.21890/tools/xentrace/Makefile
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS  += -Werror
 
 CFLAGS  += $(CFLAGS_libxenctrl)
-LDFLAGS += $(LDFLAGS_libxenctrl)
+LDLIBS += $(LDLIBS_libxenctrl)
 
 HDRS     = $(wildcard *.h)
 OBJS     = $(patsubst %.c,%.o,$(wildcard *.c))
@@ -50,9 +50,9 @@ clean:
 	$(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN) $(DEPS)
 
 %: %.c $(HDRS) Makefile
-	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
 xentrace_%: %.c $(HDRS) Makefile
-	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
 
 -include $(DEPS)

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

* Re: [PATCH] split LDLIBS from LDFLAGS to fix link errors in recent toolchains
  2010-08-01  9:51           ` [PATCH] split LDLIBS from LDFLAGS to fix link errors in " Olaf Hering
@ 2010-08-11 13:44             ` Ian Jackson
  0 siblings, 0 replies; 10+ messages in thread
From: Ian Jackson @ 2010-08-11 13:44 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel

Olaf Hering writes ("[Xen-devel] [PATCH] split LDLIBS from LDFLAGS to fix link errors in recent toolchains"):
> Linker command lines are order-sensitive.
> Move linker options -Lfoo -lfoo from LDFLAGS to LDLIBS and place this new
> variable after the objects to link. This resolves build errors in xenpagin
> and blktap with recent toolchains.
> 
> rename SHLIB_CFLAGS to SHLIB_LDFLAGS
> rename LDFLAGS_* to LDLIBS_*
> move LDFLAGS usage after CFLAGS in CC calls
> remove stale comments in xenpaging Makefile

Excellent work, thank you.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Ian.

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

end of thread, other threads:[~2010-08-11 13:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-28 12:55 [PATCH] xenpaging: correct order of linker options to avoid link errors with recent toolchains Olaf Hering
2010-07-28 14:02 ` Ian Jackson
2010-07-28 15:47   ` Olaf Hering
2010-07-28 16:05     ` Ian Jackson
2010-07-28 16:15       ` Olaf Hering
2010-07-29 15:16         ` Ian Jackson
2010-07-29 15:20           ` Olaf Hering
2010-07-29 15:39             ` Ian Jackson
2010-08-01  9:51           ` [PATCH] split LDLIBS from LDFLAGS to fix link errors in " Olaf Hering
2010-08-11 13:44             ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.