/*
* GRUB -- GRand Unified Bootloader
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <unistd.h>
#include <spawn.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <errno.h>
#include <wait.h>
#include <inttypes.h>
static void
/*
* Wrap a gcc invocation used to compile a .S file and transform it into
* a pipeline of gcc preprocessing + gas assembly
*/
int
{
int i, j, ret;
int output_mode = 0;
int added_dash_E = 0;
if (argc < 3) {
"assembler_path {Compiler command line}\n", argv[0]);
exit(1);
}
/* argv[1] is the path to the compiler. */
/* argv[2] is the path to the assembler */
argc -= 3;
return (1);
}
j = 0;
for (i = 0; i < argc; i++) {
added_dash_E = 1;
/* Look ahead to next arg */
exit(1);
}
i++;
} else {
output_mode = 32;
output_mode = 64;
debug_mode = "--gdwarf2";
debug_mode = "-gstabs";
debug_mode = "-gstabs+";
}
}
if (added_dash_E == 0)
compiler_argv[j] = 0;
j = 0;
if (output_mode > 0)
if (debug_mode != NULL)
if (output_file == NULL) {
exit(1);
}
assembler_argv[j] = NULL;
/* Create the stdout -> stdin pipe */
exit(1);
}
/* spawn the assembler with the new command line */
assembler_argv, envp) < 0) {
exit(1);
}
/* spawn the compiler: */
/* Close pipe fds */
/* We MUST wait for the processes to complete! */
if (ret == 0) {
}
return (ret);
}
static void
{
if (posix_spawn_file_actions_init(file_actionsp) < 0) {
exit(1);
}
fprintf(stderr, "Error setting dup2 file action for fd%d -> fd%d for %s\n", dup_src, dup_dest, prog);
exit(1);
}
exit(1);
}
exit(1);
}
}