Hi,

To solve this issue it is possible to use xxd + gcc to create object file with 
appropriate flags.


Similar solution is proposed for kvmtool:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=827525


The patch that fixes this issue is attached.

Using this patch I was able to build mbr  for mips64el.
It is tested on i386 as well.

Regards,
Dejan
diff -uNr mbr-1.1.11.orig/Makefile.am mbr-1.1.11/Makefile.am
--- mbr-1.1.11.orig/Makefile.am	2016-09-19 15:27:43.000000000 +0000
+++ mbr-1.1.11/Makefile.am	2016-09-19 15:25:49.000000000 +0000
@@ -68,7 +68,7 @@
 	$(AS86) -0 -b $@.tmp -s $*.sym -l $*.lst $< && mv $@.tmp $@
 
 %.o: %.b
-	$(LD) -r -b binary -o $@ $<
+	xxd -i $< | $(CC) -c -x c - -o $@
 
 %.o86: %.s86
 	$(AS86) -0 -w -u -o $@.tmp -l $*.lst $< && mv $@.tmp $@
diff -uNr mbr-1.1.11.orig/Makefile.in mbr-1.1.11/Makefile.in
--- mbr-1.1.11.orig/Makefile.in	2016-09-19 15:27:43.000000000 +0000
+++ mbr-1.1.11/Makefile.in	2016-09-19 15:25:45.000000000 +0000
@@ -815,7 +815,7 @@
 	$(AS86) -0 -b $@.tmp -s $*.sym -l $*.lst $< && mv $@.tmp $@
 
 %.o: %.b
-	$(LD) -r -b binary -o $@ $<
+	xxd -i $< | $(CC) -c -x c - -o $@
 
 %.o86: %.s86
 	$(AS86) -0 -w -u -o $@.tmp -l $*.lst $< && mv $@.tmp $@
diff -uNr mbr-1.1.11.orig/mbr.h mbr-1.1.11/mbr.h
--- mbr-1.1.11.orig/mbr.h	2006-09-02 10:37:22.000000000 +0000
+++ mbr-1.1.11/mbr.h	2016-09-19 15:29:08.000000000 +0000
@@ -4,19 +4,20 @@
 /* This file defines the interface to the encapsulated binary file
    produced by ld. */
 
-extern u_int8_t _binary_mbr_b_start[];
-extern u_int8_t _binary_mbr_b_end[];
+extern u_int8_t mbr_b[];
+extern u_int8_t mbr_b_len[];
+
+#define MBR_START mbr_b 
+#define MBR_END (mbr_b + mbr_b_len)
+#define MBR_SIZE mbr_b_len
+
+extern u_int8_t y2k_b_len[];
+extern u_int8_t y2k_b[];
+
+#define Y2K_START y2k_b
+#define Y2K_END  (y2k_b + y2k_b_len)
+#define Y2K_SIZE y2k_b_len
 
-#define MBR_START _binary_mbr_b_start
-#define MBR_END _binary_mbr_b_end
-#define MBR_SIZE (_binary_mbr_b_end - _binary_mbr_b_start)
-
-extern u_int8_t _binary_y2k_b_start[];
-extern u_int8_t _binary_y2k_b_end[];
-
-#define Y2K_START _binary_y2k_b_start
-#define Y2K_END _binary_y2k_b_end
-#define Y2K_SIZE (_binary_y2k_b_end - _binary_y2k_b_start)
 
 /* This defines the format of the parameters in the MBR for versions 0
    and 1.  This structure is now frozen. */

Reply via email to