progname=$0
# clear some things potentially inherited from environment.
+
ansi=
+clib=
defaulttargets=
destdir=
fatal=
-ansi | +ansi)
ansi=true
;;
+ -clib | +c*)
+ clib=clib
+ ;;
-destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
;;
# any existing configure script.
configdirs=
-srctrigger=ldversion.c
+srctrigger=ldver.c
srcname="linker"
## end of common part.
if [ -n "${commons}" ] ; then
if [ -d ${configdir} ] ; then
(cd ${configdir} ;
- ./configure ${commons} ${verbose} ${forcesubdirs} ${removing}) \
+ ./configure ${commons} ${verbose} ${forcesubdirs} ${removing} "+destdir=${destdir}") \
| sed 's/^/ /'
else
echo Warning: directory \"${configdir}\" is missing.
for host in ${specifics} ; do
echo Configuring target specific directory ${configdir}.${host}...
(cd ${configdir}.${host} ;
- ./configure ${host} ${verbose} ${forcesubdirs} ${removing}) \
+ ./configure ${host} ${verbose} ${forcesubdirs} ${removing} "+destdir=${destdir}") \
| sed 's/^/ /'
done # for host in specifics
fi # if there are any specifics
if [ -n "${commons}" ] ; then
if [ -d ${configdir} ] ; then
(cd ${configdir} ;
- ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} ${commons}) \
+ ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} ${commons} "+destdir=${destdir}") \
| sed 's/^/ /'
else
echo Warning: directory \"${configdir}\" is missing.
for target in ${specifics} ; do
echo Configuring target specific directory ${configdir}.${target}...
(cd ${configdir}.${target} ;
- ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} "+target=${target}") \
+ ./configure ${hosts} ${verbose} ${forcesubdirs} ${removing} "+target=${target}" "+destdir=${destdir}") \
| sed 's/^/ /'
done
fi # if any specifics
#
# $Log$
-# Revision 1.12 1991/05/27 20:54:42 rich
+# Revision 1.14 1991/07/15 23:43:20 steve
+# Fixed a few bugs, added 29k coff support.
+#
+# Revision 1.13 1991/06/12 21:24:30 rich
+# correctly propogate destdir
+#
+# Revision 1.17 1991/06/09 20:39:58 rich
+# Added +clib option.
+#
+# Revision 1.16 1991/05/27 21:04:21 rich
+# Removed clib for now.
+#
+# Revision 1.15 1991/05/27 20:54:24 rich
# fixed a bug in multiple targets
#
# Revision 1.14 1991/05/22 01:44:04 rich
#include "ld.h"
#include "ldmain.h"
#include "ldsym.h"
-#include "ldgramtb.h"
+#include "ldgram.h"
#include "ldlang.h"
#include "ldexp.h"
static void
DEFUN(print_flags, (outfile, ignore_flags),
FILE *outfile AND
- lang_section_flags_type *ignore_flags)
+ int *ignore_flags)
{
fprintf(outfile,"(");
#if 0
s->name);
}
s->bfd_section->output_section = s->bfd_section;
- s->bfd_section->flags = SEC_NO_FLAGS;
+/* s->bfd_section->flags = s->flags;*/
+
/* We initialize an output sections output offset to minus its own */
/* vma to allow us to output a section through itself */
s->bfd_section->output_offset = 0;
printf("%s flags", output_section_statement->region->name);
print_flags(stdout, &output_section_statement->flags);
#endif
+ if (section->flags & SEC_LOAD)
+ printf("load ");
+ if (section->flags & SEC_ALLOC)
+ printf("alloc ");
+ if (section->flags & SEC_RELOC)
+ printf("reloc ");
+ if (section->flags & SEC_HAS_CONTENTS)
+ printf("contents ");
}
else {
dot = insert_pad(this_ptr, fill, i->alignment_power,
output_section_statement->bfd_section, dot);
- /* remember the largest size so we can malloc the largest area */
- /* needed for the output stage */
- if (i->size > largest_section) {
+ /* remember the largest size so we can malloc the largest area
+ needed for the output stage. Only remember the size of sections
+ which we will actually allocate */
+ if (((i->flags &
+ (SEC_HAS_CONTENTS | SEC_LOAD)) == (SEC_HAS_CONTENTS | SEC_LOAD))
+ && (i->size > largest_section)) {
largest_section = i->size;
}
DEFUN_VOID(lang_check)
{
lang_statement_union_type *file;
- unsigned long max_machine = bfd_get_machine(output_bfd);
- unsigned long max_machine_seen = 0;
+
bfd * input_bfd;
unsigned long input_machine;
+ enum bfd_architecture input_architecture;
char *out_arch, *out_arch2;
+
for (file = file_chain.head;
file != (lang_statement_union_type *)NULL;
file=file->input_statement.next)
{
+ unsigned long ldfile_new_output_machine;
+ enum bfd_architecture ldfile_new_output_architecture;
+
input_bfd = file->input_statement.the_bfd;
+
input_machine = bfd_get_machine(input_bfd);
-
- if ( input_machine > max_machine_seen ){
- max_machine_seen = input_machine;
- }
+ input_architecture = bfd_get_architecture(input_bfd);
+
/* Inspect the architecture and ensure we're linking like with like */
- if ( (input_machine > max_machine)
- || !bfd_arch_compatible( input_bfd,
- output_bfd,
- &ldfile_output_architecture,
- NULL)) {
- enum bfd_architecture this_architecture =
- bfd_get_architecture(file->input_statement.the_bfd);
- unsigned long this_machine =
-
- bfd_get_machine(file->input_statement.the_bfd);
-
- /* Result of bfd_printable_arch_mach is not guaranteed to stick
- around after next call, so we have to copy it. */
- out_arch = bfd_printable_arch_mach(ldfile_output_architecture,
- ldfile_output_machine);
- out_arch2 = ldmalloc (strlen (out_arch)+1);
- strcpy (out_arch2, out_arch);
-
- info("%P: warning, %s architecture of input file `%B' incompatible with %s output\n",
- bfd_printable_arch_mach(this_architecture, this_machine),
- input_bfd,
- out_arch2);
- free (out_arch2);
- ldfile_output_architecture = this_architecture;
- ldfile_output_machine = this_machine;
- bfd_set_arch_mach(output_bfd,
- ldfile_output_architecture,
- ldfile_output_machine);
- }
+ if (!bfd_arch_compatible(input_bfd,
+ output_bfd,
+ &ldfile_new_output_architecture,
+ &ldfile_new_output_machine))
+ {
+
+ /* Result of bfd_printable_arch_mach is not guaranteed to stick
+ around after next call, so we have to copy it. */
+ out_arch = bfd_printable_arch_mach(ldfile_output_architecture,
+ ldfile_output_machine);
+ out_arch2 = ldmalloc (strlen (out_arch)+1);
+ strcpy (out_arch2, out_arch);
+
+ info("%P: warning, %s architecture of input file `%B' incompatible with %s output\n",
+ bfd_printable_arch_mach(input_architecture, input_machine),
+ input_bfd,
+ out_arch2);
+ free (out_arch2);
+
+
+ bfd_set_arch_mach(output_bfd,
+ ldfile_new_output_architecture,
+ ldfile_new_output_machine);
+ }
}
- bfd_set_arch_mach(output_bfd,ldfile_output_architecture,max_machine_seen);
+
}
void
DEFUN(lang_set_flags,(ptr, flags),
- lang_section_flags_type *ptr AND
+ int *ptr AND
CONST char *flags)
{
boolean state = true;
- ptr->flag_read = false;
- ptr->flag_write = false;
- ptr->flag_executable = false;
- ptr->flag_loadable= false;
+*ptr= 0;
while (*flags)
{
if (*flags == '!') {
else state = true;
switch (*flags) {
case 'R':
- ptr->flag_read = state;
+/* ptr->flag_read = state; */
break;
case 'W':
- ptr->flag_write = state;
+/* ptr->flag_write = state; */
break;
case 'X':
- ptr->flag_executable= state;
+/* ptr->flag_executable= state;*/
break;
case 'L':
case 'I':
- ptr->flag_loadable= state;
+/* ptr->flag_loadable= state;*/
break;
default:
info("%P%F illegal syntax in flags\n");
DEFUN(lang_enter_output_section_statement,
(output_section_statement_name,
address_exp,
+ flags,
block_value),
char *output_section_statement_name AND
etree_type *address_exp AND
+ int flags AND
bfd_vma block_value)
{
lang_output_section_statement_type *os;
os->addr_tree =
address_exp;
}
+ os->flags = flags;
os->block_value = block_value;
stat_ptr = & os->children;