2

I am trying to run a simple program on an powerpc embedded system without any operating system. I am using GNU compiler-linker tools and PSIM as simulator. I've written my own very simple Linker Directive file.

I've used a global variable in my static library and want to use that variable in my sample program. But while linking the sample program GNU ld gives an error and stops. It says that it cannot find rela.dyn in linker directive file. Actually I do not want to use dynamically relocatable library, because I dont have a dynamic loader. What am I doing wrong?

Matthew Murdoch
  • 30,874
  • 30
  • 96
  • 127
  • 1
    I used -nostartfiles -nodefaultlibs -nostdlib -static flags while linking. -ffreestanding requires -shared flag, which is not proper for my application – Caner Altinbasak Sep 03 '09 at 12:53

2 Answers2

1

Hard to say without more info. If you don't have an underlying OS, did you use -ffreestanding to avoid linking in the platform runtime?

Edit: -ffreestanding requires -shared? -ffreestanding means to compile to a non-hosted environment. How can such an environment support shared libraries?

DevSolar
  • 67,862
  • 21
  • 134
  • 209
  • Funny. I drop out at this point (-ffreestanding should not do that, but I've not worked on your particular platform so I can't really judge); perhaps following James Molloy's advice (ld -v) gets you further. – DevSolar Sep 11 '09 at 14:43
  • There should be a rule against voting down without leaving a comment as to what in the answer is considered not useful. :-/ – DevSolar Oct 06 '09 at 10:09
0

-ffreestanding, as Solar says. If that fails, run ld with the --verbose option to see exactly what it is trying to link in: that will enable you to debug further.