[Glibc-bsd-commits] r5878 - in trunk/freebsd-glue: debian src

stevenc-guest at alioth.debian.org stevenc-guest at alioth.debian.org
Wed Mar 2 18:42:17 UTC 2016


Author: stevenc-guest
Date: 2016-03-02 18:42:17 +0000 (Wed, 02 Mar 2016)
New Revision: 5878

Added:
   trunk/freebsd-glue/src/host_elf_arch.c
Modified:
   trunk/freebsd-glue/debian/changelog
   trunk/freebsd-glue/debian/rules
   trunk/freebsd-glue/src/get_elf_arch.c
Log:
Fixes for cross building:
 - build get_elf_arch with the build architecture compiler, but
   examine a host arch binary (also suggested by Helmut Grohne,
   thanks!)


Modified: trunk/freebsd-glue/debian/changelog
===================================================================
--- trunk/freebsd-glue/debian/changelog	2016-03-02 18:40:32 UTC (rev 5877)
+++ trunk/freebsd-glue/debian/changelog	2016-03-02 18:42:17 UTC (rev 5878)
@@ -6,6 +6,9 @@
   * Fixes for cross building:
     - don't override $CC (as explained by Helmut Grohne, it forced use
       of the build architecture compiler).
+    - build get_elf_arch with the build architecture compiler, but
+      examine a host arch binary (also suggested by Helmut Grohne,
+      thanks!)
 
  -- Steven Chamberlain <steven at pyro.eu.org>  Wed, 02 Mar 2016 14:06:22 +0000
 

Modified: trunk/freebsd-glue/debian/rules
===================================================================
--- trunk/freebsd-glue/debian/rules	2016-03-02 18:40:32 UTC (rev 5877)
+++ trunk/freebsd-glue/debian/rules	2016-03-02 18:42:17 UTC (rev 5878)
@@ -31,15 +31,23 @@
 DEB_HOST_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_HOST_ARCH_OS	?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
 
+DEB_BUILD_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+NATIVE_CC		?= $(DEB_BUILD_GNU_TYPE)-gcc
+
 clean:
 	dh_testdir
 	rm -rf obj-{deb,udeb} debian/tmp-udeb
-	rm -f include/machine/__get_elf_arch.h src/get_elf_arch
+	rm -f include/machine/__get_elf_arch.h src/get_elf_arch src/host_elf_arch
 	dh_clean
 
-src/get_elf_arch: src/get_elf_arch.c
-include/machine/__get_elf_arch.h: src/get_elf_arch
-	$^ > $@
+# Build this for the build architecture, as it is executed during build
+# to examine host_elf_arch
+src/get_elf_arch:
+	$(NATIVE_CC) src/get_elf_arch.c -o src/get_elf_arch
+# Build this for the host architecture.
+src/host_elf_arch: src/host_elf_arch.c
+include/machine/__get_elf_arch.h: src/get_elf_arch src/host_elf_arch
+	$^ src/host_elf_arch > $@
 
 build: build-arch
 build-arch: build-deb build-udeb

Modified: trunk/freebsd-glue/src/get_elf_arch.c
===================================================================
--- trunk/freebsd-glue/src/get_elf_arch.c	2016-03-02 18:40:32 UTC (rev 5877)
+++ trunk/freebsd-glue/src/get_elf_arch.c	2016-03-02 18:42:17 UTC (rev 5878)
@@ -9,7 +9,7 @@
   int fd;
   Elf32_Ehdr ehdr;
 
-  fd = open (argv[0], O_RDONLY);
+  fd = open (argv[1], O_RDONLY);
   if (fd == -1)
     perror ("open");
 

Added: trunk/freebsd-glue/src/host_elf_arch.c
===================================================================
--- trunk/freebsd-glue/src/host_elf_arch.c	                        (rev 0)
+++ trunk/freebsd-glue/src/host_elf_arch.c	2016-03-02 18:42:17 UTC (rev 5878)
@@ -0,0 +1 @@
+int main (int argc, char **argv) { return 0; }




More information about the Glibc-bsd-commits mailing list