Skip to contentSkip to conversation

Cross compiling : problem linking

DISCUSSION Toni Van Remortel 2 participants 4 messages Oct 2, 2003

lore
Share & tools
lore
#0 lore raw

Hi all,

I try to cross compile a small test program for the EP505 board. I use ELDK as compiler set.

When using this compile command:

ppc_4xx-gcc -O -v -nostdlib -nostartfiles -mno-eabi -fno-exceptions \
-fno-builtin -Wl,-Tscript.ld,-N -o rt_mod rt_mod.c

I get after a while:

/opt/eldk/usr/ppc-linux/bin/ld: cannot open linker script file \
script.ld: Onbekend bestand of map
collect2: ld returned 1 exit status

I don't know what is wrong, but 'script.ld' isn't anywhere on my system.

Side note: I used the compiler set already to cross compile a kernel, XFree and FLTK, so it works.

Any idea?

PS: the program currently should make a square wave on EBC P1 D1 --
Toni Van Remortel
Wetenschappelijk Medewerker - D-science lab
Real time Linux for embedded systems: http://linemb.d-sciencelab.com

              Tel: +32 3 205 61 72 - Fax: +32 3 205 61 95
                      E-mail: [email protected]

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#1 lore raw

Reduced the error to:

toni rt_mod # make
ppc_4xx-gcc -g -O -Werror -c -o rt_mod.o rt_mod.c
ppc_4xx-gcc -nostartfiles -fno-exceptions -fno-builtin -o rt_mod rt_mod.o
/opt/eldk/usr/ppc-linux/bin/ld: warning: cannot find entry symbol _start; defaulting to 10000184
rt_mod.o: In function `block_wave':
/ppc/rt_mod/rt_mod.c:14: undefined reference to outb' /ppc/rt_mod/rt_mod.c:14: relocation truncated to fit: R_PPC_REL24 outb rt_mod.o: In function main':
/ppc/rt_mod/rt_mod.c:21: undefined reference to `iopl' /ppc/rt_mod/rt_mod.c:21: relocation truncated to fit: R_PPC_REL24 iopl
collect2: ld returned 1 exit status
make: *** [rt_mod] Fout 1

Somebody?
--
Toni Van Remortel
Wetenschappelijk Medewerker - D-science lab
Real time Linux for embedded systems: http://linemb.d-sciencelab.com

              Tel: +32 3 205 61 72 - Fax: +32 3 205 61 95
                      E-mail: [email protected]

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#2 lore raw
Quoted 17 lines · In message <1065101196.10206.7.camel@toni> you wrote:

Reduced the error to:

toni rt_mod # make
ppc_4xx-gcc -g -O -Werror -c -o rt_mod.o rt_mod.c
ppc_4xx-gcc -nostartfiles -fno-exceptions -fno-builtin -o rt_mod rt_mod.o
/opt/eldk/usr/ppc-linux/bin/ld: warning: cannot find entry symbol _start; defaulting to 10000184
rt_mod.o: In function `block_wave':
/ppc/rt_mod/rt_mod.c:14: undefined reference to outb' /ppc/rt_mod/rt_mod.c:14: relocation truncated to fit: R_PPC_REL24 outb rt_mod.o: In function main':
/ppc/rt_mod/rt_mod.c:21: undefined reference to `iopl' /ppc/rt_mod/rt_mod.c:21: relocation truncated to fit: R_PPC_REL24 iopl
collect2: ld returned 1 exit status
make: *** [rt_mod] Fout 1

The header files and/or compiler and linker options you are using are not correct for the target environment you have.

Without more information (i. e. what sort of code this is and how you intend it to run - stdandalone, in kernel or in user context) nobody can help you.

Best regards,

Wolfgang Denk

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected] Sorry, but my karma just ran over your dogma.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#3 lore raw
In reply to Toni Van Remortel
Quoted 8 lines · In message <1065099415.10206.5.camel@toni> you wrote:

I try to cross compile a small test program for the EP505 board. I use ELDK as compiler set.

When using this compile command:

ppc_4xx-gcc -O -v -nostdlib -nostartfiles -mno-eabi -fno-exceptions \
-fno-builtin -Wl,-Tscript.ld,-N -o rt_mod rt_mod.c

Well, I guess you know what you are douing here, i. e. what the linker options mean?

I wonder where you got this command line from...

Quoted 7 lines

I get after a while:

/opt/eldk/usr/ppc-linux/bin/ld: cannot open linker script file \
script.ld: Onbekend bestand of map
collect2: ld returned 1 exit status

I don't know what is wrong, but 'script.ld' isn't anywhere on my system.

Well, if you don't have such a linker script, why do you then tell the linker to use it?

Quoted 1 line

PS: the program currently should make a square wave on EBC P1 D1

In which sort of environment? As standalone program? As Linux kernel module? As Linux user-land application? Or what?

Best regards,

Wolfgang Denk

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected] Uncertain fortune is thoroughly mastered by the equity of the calcu-
lation. - Blaise Pascal

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/