/* EXPORT */
char *ldfile_input_filename;
-CONST char * ldfile_output_machine_name;
+CONST char * ldfile_output_machine_name ="";
unsigned long ldfile_output_machine;
enum bfd_architecture ldfile_output_architecture;
boolean had_script;
lang_input_statement_type *entry;
{
entry->the_bfd = bfd_openr(attempt, entry->target);
- if (option_v == true && entry->the_bfd == (bfd *)NULL) {
- info("attempt to open %s failed\n", attempt);
+ if (option_v == true ) {
+ info("attempt to open %s %s\n", attempt,
+ (entry->the_bfd == (bfd *)NULL) ? "failed" : "succeeded" );
}
return entry->the_bfd;
}
+
+#ifdef GNU960
+static
+char *
+gnu960_map_archname( name )
+char *name;
+{
+ struct tabentry { char *cmd_switch; char *arch; };
+ static struct tabentry arch_tab[] = {
+ "", "",
+ "KA", "ka",
+ "KB", "kb",
+ "KC", "mc", /* Synonym for MC */
+ "MC", "mc",
+ "CA", "ca",
+ "SA", "ka", /* Functionally equivalent to KA */
+ "SB", "kb", /* Functionally equivalent to KB */
+ NULL, ""
+ };
+ struct tabentry *tp;
+
+
+ for ( tp = arch_tab; tp->cmd_switch != NULL; tp++ ){
+ if ( !strcmp(name,tp->cmd_switch) ){
+ break;
+ }
+ }
+
+ if ( tp->cmd_switch == NULL ){
+ info("%P%F: unknown architecture: %s\n",name);
+ }
+ return tp->arch;
+}
+
+
+
+void
+ldfile_add_arch(name)
+char *name;
+{
+ search_arch_type *new =
+ (search_arch_type *)ldmalloc(sizeof(search_arch_type));
+
+
+ if (*name != '\0') {
+ if (ldfile_output_machine_name[0] != '\0') {
+ info("%P%F: target architecture respecified\n");
+ return;
+ }
+ ldfile_output_machine_name = name;
+ }
+
+ new->next = (search_arch_type*)NULL;
+ new->name = gnu960_map_archname( name );
+ *search_arch_tail_ptr = new;
+ search_arch_tail_ptr = &new->next;
+
+}
+
+#else /* not GNU960 */
+
+
void
DEFUN(ldfile_add_arch,(in_name),
- CONST char *CONST in_name)
+ CONST char * in_name)
{
char *name = buystring(in_name);
search_arch_type *new =
search_arch_tail_ptr = &new->next;
}
+#endif
+
+/* Set the output architecture */
+void
+DEFUN(ldfile_set_output_arch,(string),
+CONST char *string)
+{
+ enum bfd_architecture arch;
+ unsigned long machine;
+ if (bfd_scan_arch_mach(string, &arch, &machine) == true) {
+ ldfile_output_architecture = arch;
+ ldfile_output_machine = machine;
+ ldfile_output_machine_name = string;
+ }
+ else {
+ info("%P%F: Can't represent machine `%s'\n", string);
+ }
+}