76 lines
1.8 KiB
Diff
76 lines
1.8 KiB
Diff
From 7cff794d82076df70dde7a851937fc7bf93fdf44 Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Tue, 12 Jan 2016 11:07:57 +0000
|
|
Subject: [PATCH 1/2] bin2s: Remove _size, since it can be computed from _start
|
|
and _end.
|
|
|
|
Also declare the _start and _end as uint8_t instead of char, since
|
|
they refer to an array of bytes.
|
|
|
|
See discussion here:
|
|
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809185
|
|
---
|
|
src/bin2s.pl | 8 --------
|
|
src/ext2init-c.c | 5 +++--
|
|
2 files changed, 3 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/src/bin2s.pl b/src/bin2s.pl
|
|
index db6db26..8558126 100755
|
|
--- a/src/bin2s.pl
|
|
+++ b/src/bin2s.pl
|
|
@@ -39,7 +39,6 @@ print $ofh <<"EOF";
|
|
|
|
\t.globl\t_binary_${infile}_start
|
|
\t.globl\t_binary_${infile}_end
|
|
-\t.globl\t_binary_${infile}_size
|
|
|
|
\t.section\t.rodata
|
|
_binary_${infile}_start:
|
|
@@ -55,14 +54,7 @@ die "read $infile (at offset $sz): $!\n" if not defined $i;
|
|
close $ifh;
|
|
|
|
print $ofh <<"EOF";
|
|
-
|
|
_binary_${infile}_end:
|
|
-
|
|
-#if defined(__hppa__)
|
|
-\t_binary_${infile}_size: .equ $sz
|
|
-#else
|
|
-\t.equ _binary_${infile}_size, $sz
|
|
-#endif
|
|
EOF
|
|
|
|
close $ofh;
|
|
diff --git a/src/ext2init-c.c b/src/ext2init-c.c
|
|
index c310ed2..66ad254 100644
|
|
--- a/src/ext2init-c.c
|
|
+++ b/src/ext2init-c.c
|
|
@@ -20,6 +20,7 @@
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
+#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
#include <caml/alloc.h>
|
|
@@ -28,14 +29,14 @@
|
|
/* The init binary.
|
|
* See: bin2s.pl, init.c.
|
|
*/
|
|
-extern char _binary_init_start, _binary_init_end, _binary_init_size;
|
|
+extern uint8_t _binary_init_start, _binary_init_end;
|
|
|
|
value
|
|
supermin_binary_init (value unitv)
|
|
{
|
|
CAMLparam1 (unitv);
|
|
CAMLlocal1 (sv);
|
|
- size_t n = (size_t) &_binary_init_size;
|
|
+ size_t n = &_binary_init_end - &_binary_init_start;
|
|
|
|
sv = caml_alloc_string (n);
|
|
memcpy (String_val (sv), &_binary_init_start, n);
|
|
--
|
|
2.5.0
|
|
|