LD Linker: -T is not recognized?
LD Linker: -T is not recognized?
Yup. Pretty straight forward. In Terminal, when I use ld -T link.d -o blahblahblahwheteverfilesihave it says "ld: uknown option: -T" And yes, I have the GCC Cross-Compiler.
Re: LD Linker: -T is not recognized?
Are you sure you are using the cross-compiled ld that you created ? It's not normally callled 'ld'.
If a trainstation is where trains stop, what is a workstation ?
Re: LD Linker: -T is not recognized?
Alright... I used AR this time. Still didn't work.
Terminal:
Terminal:
Code: Select all
Aarons-MacBook:trolololo Aaron$ ar -rcs archive.a loader.s kernel.o
Aarons-MacBook:trolololo Aaron$ cc kernel.c archive.a -o kernel.bin
ld: warning: in archive.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Aarons-MacBook:trolololo Aaron$
Re: LD Linker: -T is not recognized?
If you're on OS X, and you built an i686 cross compiler, you'll need to prepend "i686-elf-" to all the tool names.
So, ld becomes i686-elf-ld, ar becomes i686-elf-ar, etc. You're trying to use the host tools currently, not the cross compiler tools.
So, ld becomes i686-elf-ld, ar becomes i686-elf-ar, etc. You're trying to use the host tools currently, not the cross compiler tools.
Re: LD Linker: -T is not recognized?
You need a cross-compiled version of binutils as well. That will give you an ld called something like "i386-elf-ld".
The mac version of ld simply can never work. It is not actually the 'binutils ld' and does not support the -T option.
[edit]Quok is quik
The mac version of ld simply can never work. It is not actually the 'binutils ld' and does not support the -T option.
[edit]Quok is quik
If a trainstation is where trains stop, what is a workstation ?
Re: LD Linker: -T is not recognized?
Alright, I've tried a billion times to get GCC cross-compiler to work. But it doesn't. So, is it easier to develop on Windows?
Re: LD Linker: -T is not recognized?
You don't have to try a billion times, you just have to do it right. Once. That tutorial is the most well-tested of all our Wiki content. It is correct.
You did not acknowledge the suggestions given to you so far, which are prose for pointing you to this part to the tutorial which you most likely missed:
Previous posters were pointing out that you not only need to call $TARGET-gcc, but also $TARGET-ld and $TARGET-ar.
I will update the tutorial to make this explicit.
You did not acknowledge the suggestions given to you so far, which are prose for pointing you to this part to the tutorial which you most likely missed:
Usage
Once you are finished, your toolset resides in /usr/local/cross. For example, you have a gcc executable in /usr/local/cross/bin/$TARGET-gcc (and /usr/local/cross/$TARGET/gcc as well), which spits out binaries for your TARGET. Add /usr/local/cross/bin to your PATH environment variable, so that gcc invokes your system compiler, and $TARGET-gcc invokes your cross-compiler.
Previous posters were pointing out that you not only need to call $TARGET-gcc, but also $TARGET-ld and $TARGET-ar.
I will update the tutorial to make this explicit.
Every good solution is obvious once you've found it.
Re: LD Linker: -T is not recognized?
Many of us develop on Mac and use a cross-compiled binutils/gcc. It definitely works. I tried OS development on Windows, Linux and Mac and choose Mac.Alright, I've tried a billion times to get GCC cross-compiler to work. But it doesn't. So, is it easier to develop on Windows?
I just then followed the tutorial and found I had to add --disable-werror to the configure command line for binutils. Apart from that there seems to be no problem.
Please post your issues and they can be fixed.
If a trainstation is where trains stop, what is a workstation ?
Re: LD Linker: -T is not recognized?
I'm just gonna say that depending on the gcc version you're trying to build, you may need other dependencies (its all in the wiki). Also, unless you're using mac ports or Xcode for your host compiler (if you have a prepackaged gcc on your mac) you NEED to upgrade (also in the wiki).
You are a computer.
~ MCS ~
~ MCS ~