* [U-Boot-Users] Compiler optimizations and debugging
@ 2003-03-20 10:05 llandre
2003-03-20 10:55 ` Wolfgang Denk
2003-03-20 17:34 ` Vladimir Gurevich
0 siblings, 2 replies; 5+ messages in thread
From: llandre @ 2003-03-20 10:05 UTC (permalink / raw)
To: u-boot
To make the step-by-step debugging easier with GDB/DDD, I removed the
optimization flag "-Os" from the config.mk file. In fact, with the
optimization turned on, the code seems not to be executed sequentially
inside code window. However, without the -Os flag, the linker is unable to
complete the build:
ppc-linux-ld -Bstatic -T
/proj/ppc405ep/sw/u-boot/board/bubinga405ep/u-boot.lds -Ttext 0xFFF80000 -n
cpu/ppc4xx/start.o cpu/ppc4xx/resetvec.o \
--start-group board/bubinga405ep/libbubinga405ep.a
cpu/ppc4xx/libppc4xx.a lib_ppc/libppc.a fs/jffs2/libjffs2.a
fs/fdos/libfdos.a net/libnet.a disk/libdisk.a rtc/librtc.a dtt/libdtt.a
drivers/libdrivers.a post/libpost.a post/cpu/libcpu.a common/libcommon.a
lib_generic/libgeneric.a --end-group \
-Map u-boot.map -o u-boot
cpu/ppc4xx/libppc4xx.a(405gp_pci.o): In function `pci_405gp_init':
/proj/ppc405ep/sw/u-boot/cpu/ppc4xx/405gp_pci.c:125: undefined reference to
`pci_set_region'
/proj/ppc405ep/sw/u-boot/cpu/ppc4xx/405gp_pci.c:132: undefined reference to
`pci_set_region'
/proj/ppc405ep/sw/u-boot/cpu/ppc4xx/405gp_pci.c:146: undefined reference to
`pci_set_region'
/proj/ppc405ep/sw/u-boot/cpu/ppc4xx/405gp_pci.c:157: undefined reference to
`pci_set_region'
drivers/libdrivers.a(pci_indirect.o): In function `indirect_read_config_byte':
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:48: undefined reference to
`out_le32'
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:48: undefined reference to
`in_8'
drivers/libdrivers.a(pci_indirect.o): In function `indirect_read_config_word':
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:49: undefined reference to
`out_le32'
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:49: undefined reference to
`in_le16'
drivers/libdrivers.a(pci_indirect.o): In function `indirect_read_config_dword':
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:50: undefined reference to
`out_le32'
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:50: undefined reference to
`in_le32'
drivers/libdrivers.a(pci_indirect.o): In function `indirect_write_config_byte':
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:56: undefined reference to
`out_le32'
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:56: undefined reference to
`out_8'
drivers/libdrivers.a(pci_indirect.o): In function `indirect_write_config_word':
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:57: undefined reference to
`out_le32'
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:57: undefined reference to
`out_le16'
drivers/libdrivers.a(pci_indirect.o): In function
`indirect_write_config_dword':
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:58: undefined reference to
`out_le32'
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:58: undefined reference to
`out_le32'
drivers/libdrivers.a(pci_indirect.o): In function `pci_setup_indirect':
/proj/ppc405ep/sw/u-boot/drivers/pci_indirect.c:63: undefined reference to
`pci_set_ops'
make: *** [u-boot] Error 1
Why is the -Os flag absolutely necessary?
llandre
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot-Users] Compiler optimizations and debugging
2003-03-20 10:05 [U-Boot-Users] Compiler optimizations and debugging llandre
@ 2003-03-20 10:55 ` Wolfgang Denk
2003-03-20 17:19 ` llandre
2003-03-20 17:34 ` Vladimir Gurevich
1 sibling, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2003-03-20 10:55 UTC (permalink / raw)
To: u-boot
In message <5.1.1.6.0.20030320104504.00a81840@dns.struinfo.it> you wrote:
> To make the step-by-step debugging easier with GDB/DDD, I removed the
> optimization flag "-Os" from the config.mk file. In fact, with the
> optimization turned on, the code seems not to be executed sequentially
> inside code window. However, without the -Os flag, the linker is unable to
Well, the _optimized_ code _is_ exectued sequentially. But you cannot
expect that a sequence of lines of C code results in a strictly
sequential sequence of machine instructions. The potimizer will -
ummm - optimize the code.
> Why is the -Os flag absolutely necessary?
Because otherwise inline functions are not expanded. See the
documentation for GCC.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
Given a choice between two theories, take the one which is funnier.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Compiler optimizations and debugging
2003-03-20 10:55 ` Wolfgang Denk
@ 2003-03-20 17:19 ` llandre
0 siblings, 0 replies; 5+ messages in thread
From: llandre @ 2003-03-20 17:19 UTC (permalink / raw)
To: u-boot
> > To make the step-by-step debugging easier with GDB/DDD, I removed the
> > optimization flag "-Os" from the config.mk file. In fact, with the
> > optimization turned on, the code seems not to be executed sequentially
> > inside code window. However, without the -Os flag, the linker is unable to
>
>Well, the _optimized_ code _is_ exectued sequentially. But you cannot
>expect that a sequence of lines of C code results in a strictly
>sequential sequence of machine instructions. The potimizer will -
>ummm - optimize the code.
I meant that the code is apparently non-sequential.
Recently I worked with the GCC cross compiler for ARM (arm-elf-gcc) and I
encountered the same problem. In that case the default compilation is
usually performed with the -O2 flag but, during the debugging, we are used
to build with the -O0 flag. This way, when you debug step-by-step, the C
lines are executed sequentially, too. Thus, even if the code is obviously
much larger and much slower, it is easier follow the flow of the code.
So I was wondering if it is possible to do the same thing with the
ppc-linux-gcc compiler. Is it?
llandre
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Compiler optimizations and debugging
2003-03-20 10:05 [U-Boot-Users] Compiler optimizations and debugging llandre
2003-03-20 10:55 ` Wolfgang Denk
@ 2003-03-20 17:34 ` Vladimir Gurevich
2003-03-20 18:01 ` Wolfgang Denk
1 sibling, 1 reply; 5+ messages in thread
From: Vladimir Gurevich @ 2003-03-20 17:34 UTC (permalink / raw)
To: u-boot
Hello llandre,
llandre wrote:
> To make the step-by-step debugging easier with GDB/DDD, I removed the
> optimization flag "-Os" from the config.mk file. In fact, with the
> optimization turned on, the code seems not to be executed sequentially
> inside code window. However, without the -Os flag, the linker is unable
> to complete the build:
>
> Why is the -Os flag absolutely necessary?
Because the functions you are missing now (like out_8, in_32, etc.)
are, in fact, inline functions. You need -O{something} to enable them.
As far as "non-sequential" code execution in the debugger, you
can try to ADD the following flags to gcc command line:
-fno-schedule-insns -fno-schedule-insns2
This should disable instruction reordering (as well as slow down
the execution quite noticeably since your pipeline will be stalled
too often).
Oh, and in any case (with or without -fno-schedule-insns) your
code is executed correctly.
Best regards,
Vladimir
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot-Users] Compiler optimizations and debugging
2003-03-20 17:34 ` Vladimir Gurevich
@ 2003-03-20 18:01 ` Wolfgang Denk
0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2003-03-20 18:01 UTC (permalink / raw)
To: u-boot
In message <3E79FBA1.2090707@paulidav.org> Vladimir Gurevich wrote:
>
> As far as "non-sequential" code execution in the debugger, you
> can try to ADD the following flags to gcc command line:
>
> -fno-schedule-insns -fno-schedule-insns2
>
> This should disable instruction reordering (as well as slow down
> the execution quite noticeably since your pipeline will be stalled
> too often).
100% correct. See also section "8.2.5. Tips and Tricks" in
http://www.denx.de/re/DPLG.html
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
Do you suppose the reason the ends of the `Intel Inside' logo don't
match up is that it was drawn on a Pentium?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-03-20 18:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-20 10:05 [U-Boot-Users] Compiler optimizations and debugging llandre
2003-03-20 10:55 ` Wolfgang Denk
2003-03-20 17:19 ` llandre
2003-03-20 17:34 ` Vladimir Gurevich
2003-03-20 18:01 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.