Notes |
(0000184)
vriviere (developer)
2009-10-22 05:59
|
Now I understand what "ld -r" really is.
It is "relocatable linking", the technique for combining several .o files into a single .o file.
I confirm this is a bug that should be fixed.
I'm going to fix it soon. |
|
(0000187)
Alan Hourihane (developer)
2009-11-24 10:33
|
Vincent, it seems in the new binutils patch that you abort with "-r" now and terminate ld.
Any ideas when you can fix, otherwise I might start poking ? |
|
(0000188)
vriviere (developer)
2009-11-24 12:25
|
I confirm it works as expected with my latest binutils patch.
$ m68k-atari-mint-ld --version
GNU ld (GNU Binutils for MiNT 20091024) 2.20
...
$ m68k-atari-mint-gcc -c main.c
$ m68k-atari-mint-ld -r -o main2.o main.o
Now the last instruction in your testcase does not crash, and does what is expected:
$ m68k-atari-mint-ld -o main3.o main2.o
main2.o:main2.o:(.text+0x6): undefined reference to `__main'
This is because calling ld without -r produces an exectuable, not an object file. It is a "final link". In this case, you must give the CRT before the program objects, and link with libgcc and libc.
m68k-atari-mint-ld -o main3.tos /usr/local/cross-mint/m68k-atari-mint/lib/crt0.o main2.o -L/usr/local/cross-mint/lib/gcc/m68k-atari-mint/4.4.2 -lgcc -lc -lgcc
If finally it is OK for you, please close the bug. |
|
(0000189)
Alan Hourihane (developer)
2009-11-24 12:37
|
Oh, I must not be up-to-date with your latest binutils patch. I'm off to try it right now !
Thanks Vincent! |
|
(0000190)
Alan Hourihane (developer)
2009-11-24 12:41
|
Mmm, nope. I am up-to-date. I get this when running natively....
bash# ld -r -o main2.o main.o
ld: main2.o: relocatable output is not supported by format a.out-mintprg
ld: final link failed: Invalid operation |
|
(0000191)
Alan Hourihane (developer)
2009-11-24 12:44
|
In m68kmint_prg_bfd_final_link() we have this in 2.20 binutils which didn't exist before which causes my error.....
+ if (info->relocatable)
+ {
+ _bfd_error_handler ("%B: relocatable output is not supported by format %s
",
+ abfd, bfd_get_target (abfd));
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ } |
|
(0000192)
Alan Hourihane (developer)
2009-11-24 12:49
|
Oh, hang on. Let me redo - back soon. |
|
(0000193)
vriviere (developer)
2009-11-24 14:15
|
In the latest patch, I have updated both prg-mint.c and the linker script template in the files m68kmint.sc and m68kmint.sh. I guess you have messed up something, maybe you didn't rebuild the binutils from a clean directory. Or there is something wrong with the native ld, I didn't test it. |
|
(0000194)
Alan Hourihane (developer)
2009-11-24 18:23
|
Verified. It works, but I can't see how to close bugs. :-( |
|
(0000195)
vriviere (developer)
2009-11-25 15:42
|
We confirm it had been fixed in the patch binutils-mint-20091024. |
|