Linker option for not using default files while linking

Asked by Parth

Hello,

I am trying to compile a project for bare-metal ARM Cortex A5 core. While linking, I do not want to link the standard\default library files. Is there an equivalent command like -nostartfiles and -nodefaultfiles which are available in GCC?
I tried using these options; though it does not give any error, it still uses the standard built-in libraries.
Any inputs are appreciated.

Thanks in advance,
Parth.

Question information

Language:
English Edit question
Status:
Answered
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Tony Liu (mrtoniliu) said :
#1

Hi,

Would you post the command that you used? Thank you very much.

Regards,
Tony

Revision history for this message
Parth (parthbhogate) said :
#2

Hello Tony,

I passed the following command to the linker:
'Invoking: GCC C Linker 4.9.3 [arm-none-eabi]'
arm-none-eabi-gcc.exe -T "H:\Parth\.." -nodefaultlibs -nostartfiles --specs=nano.specs --specs=rdimon.specs -o "Dhry_GCC.axf" //.o files// -lc -lrdimon

These are standard GCC Linker options. The program was compiled successfully using these options but it gave errors like "XYZ symbol not found".

Thanks,
Parth.

Revision history for this message
Tony Liu (mrtoniliu) said :
#3

Hi Parth,

Please refer to https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Link-Options.html#Link-Options,

-Wl,option
    Pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas. You can use this syntax to pass an argument to the option. For example, -Wl,-Map,output.map passes -Map output.map to the linker. When using the GNU linker, you can also get the same effect with -Wl,-Map=output.map.

Hope this will be helpful.

Regards,
Tony

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#4

Hi Parth,

I'm a bit confused as to what exactly is your situation. In the original post you say that the command does not give any error but the files are still there while in a later command you say that it gives undefined symbol errors. If it is the latter I would argue that the option were indeed successful and that these symbols were probably coming from the libraries.

Please let us know which one of the two scenarios mentionned above stand. If you are indeed facing undefined symbol and you think you should not despite the -nostdlib, then please give an example of such symbols.

Best regards.

Can you help with this problem?

Provide an answer of your own, or ask Parth for more information if necessary.

To post a message you must log in.