This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch] relax16.c: Eliminate an assertion failure.


Hi Jeff, Hi Kazu,

:   > /usr/local/bin/h8300-hms-gcc -mh -Wl,--relax -Wall -o h8os.out main1.o main
:   > 2.o
:   > main2.o(.text+0x0):main2.c: multiple definition of `test'
:   > main1.o(.text+0x0):main1.c: first defined here
:   > main2.o(.text+0x6):main2.c: multiple definition of `main'
:   > main1.o(.text+0x6):main1.c: first defined here
:   > /usr/local/lib/gcc-lib/h8300-hms/2.96/../../../../h8300-hms/bin/ld: bfd ass
:   > ertion fail ../../src/bfd/reloc16.c:131
:   > collect2: ld returned 1 exit status
:   > make: *** [h8os.out] Error 1
:   > 
:   > The problem is that a hash key entry for 'main' gets slipped _twice_
:   > as a result of relaxation even though both a symbol for 'main' in
:   > main.c and another one in main2.c get slipped only once each.
:    
: I would prefer to avoid relaxing completely when we've had a fatal error
: earlier during symbol processing.

I agree with Jeff.

Here is an experimental patch which turns off relaxation if multiple
symbol definitions are detected.  Kazu - does this fix your problem ?

Cheers
	Nick

2000-09-12  Nick Clifton  <nickc@redhat.com>

	* ldmain.c (multiple_definition): Disable relaxation if
	multiple symbol definitions are encountered - otherwise the
	linker could abort with an assertion failure.

Index: ld/ldmain.c
===================================================================
RCS file: /cvs/src//src/ld/ldmain.c,v
retrieving revision 1.13
diff -p -r1.13 ldmain.c
*** ldmain.c	2000/09/05 03:05:19	1.13
--- ldmain.c	2000/09/12 18:31:04
*************** multiple_definition (info, name, obfd, o
*** 863,868 ****
--- 863,875 ----
  	 nbfd, nsec, nval, name);
    if (obfd != (bfd *) NULL)
      einfo (_("%D: first defined here\n"), obfd, osec, oval);
+ 
+   if (command_line.relax)
+     {
+       einfo (_("%P: Disabling relaxation: it will not work with multiple definitions\n"));
+       command_line.relax = 0;
+     }
+   
    return true;
  }
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]