Allow the ELF processor flags to be set. Generate MIPS ELF executables, not
authorDavid Given <dg@cowlark.com>
Sun, 9 Sep 2018 12:29:34 +0000 (14:29 +0200)
committerDavid Given <dg@cowlark.com>
Sun, 9 Sep 2018 12:29:34 +0000 (14:29 +0200)
PowerPC ones.

plat/linuxmips/descr
util/amisc/aelflod.1
util/amisc/aelflod.c

index ad7f518..1afa470 100644 (file)
@@ -82,6 +82,6 @@ name cv
        from .out
        to .exe
        program {EM}/bin/aelflod
-       args -m20 -b < >
+       args -m8 -l -f0x70000000 < >
        outfile linuxmips.exe
 end
index e6af7ef..9c6134b 100644 (file)
@@ -35,6 +35,10 @@ The default value is \fI3\fP for Intel 386 (i386).
 Other values are \fI4\fP for Motorola 68000 (m68k)
 and \fI20\fP for PowerPC.
 .TP
+.BI \-f number
+Set the processor flags in the ELF header to \fInumber\fP.
+The default value is 0.
+.TP
 .B \-v
 Be verbose.
 .PP
index dbaafc9..de4bced 100644 (file)
@@ -33,6 +33,7 @@
 int bigendian = 0;
 int elfabi = 3;                         /* abi = Linux */
 int elfmachine = 3;                     /* machine = EM_386 */
+uint32_t elfflags = 0;                  /* elf processor flags */
 
 /* Header and section table of an ack object file. */
 
@@ -643,7 +644,7 @@ int main(int argc, char* argv[])
                switch (argv[1][1])
                {
                        case 'a':
-                               elfabi = atoi(&argv[1][2]);
+                               elfabi = strtoul(&argv[1][2], NULL, 0);
                                break;
 
                        case 'b':
@@ -660,7 +661,11 @@ int main(int argc, char* argv[])
                                break;
 
                        case 'm':
-                               elfmachine = atoi(&argv[1][2]);
+                               elfmachine = strtoul(&argv[1][2], NULL, 0);
+                               break;
+
+                       case 'f':
+                               elfflags = strtoul(&argv[1][2], NULL, 0);
                                break;
 
                        case 'v':
@@ -808,7 +813,7 @@ int main(int argc, char* argv[])
        emit32(outsect[TEXT].os_base);     /* entry point */
        emit32(ELF_HEADER_SIZE);           /* program header offset */
        emit32(sh_offset);                 /* section header offset */
-       emit32(0);                         /* flags */
+       emit32(elfflags);                  /* flags */
        emit16(ELF_HEADER_SIZE);           /* elf header size */
        emit16(PROGRAM_HEADER_SIZE);       /* program header entry size */
        emit16(1);                         /* number of program header entries */