Bug 40677 - flag -mmultiple is ignored
Summary: flag -mmultiple is ignored
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-07 20:20 UTC by Edmar Wienskoski
Modified: 2012-01-09 23:35 UTC (History)
4 users (show)

See Also:
Host: powerpc-unknown-linux-gnu-gcc
Target: powerpc-unknown-linux-gnu-gcc
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-07-15 12:38:19


Attachments
test case (278 bytes, text/plain)
2009-07-07 20:21 UTC, Edmar Wienskoski
Details
patch to fix bug (220 bytes, patch)
2009-07-07 20:22 UTC, Edmar Wienskoski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Edmar Wienskoski 2009-07-07 20:20:43 UTC
The compiler fails to generate lmw/stmw when compiling the attached test case.
(no_global_regs_above) never returns true.

Obvious fix with attached patch.
Note: I have no write privilege.

Compiled with:
gcc -Os -mcpu=601 -S test.c
Comment 1 Edmar Wienskoski 2009-07-07 20:21:18 UTC
Created attachment 18153 [details]
test case
Comment 2 Edmar Wienskoski 2009-07-07 20:22:07 UTC
Created attachment 18154 [details]
patch to fix bug
Comment 3 Richard Biener 2009-07-08 08:21:08 UTC
patches should be sent to gcc-patches@gcc.gnu.org with a changelog entry
and a note how it was tested.
Comment 4 Edmar Wienskoski 2009-07-08 15:06:53 UTC
I did not run any test suite, nor prepared any test case suitable for inclusion in dejagnu suite.
I opened a bug hopping the information I gave would help resolve the issue faster.
Comment 5 David Edelsohn 2009-07-15 12:38:19 UTC
The patch seems reasonable, but it exposes a latent bug in Nathan's mmultiple patch that was not tested because of this bug.

This patch should have been tested and posted to the GCC mailinglist referencing this PR.
Comment 6 David Edelsohn 2009-07-15 12:50:36 UTC
The fix for this actually is more involved.  Nathan had a patch last October which exposed similar bootstrap problems.  He posted a revised patch

http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01103.html
Comment 7 Kumar Gala 2009-08-26 13:54:56 UTC
I'm not what the means are bump the priority on this as a significant regression in gcc4.4 as code that was building with gcc4.3 no longer builds because the size of the generated binaries is significantly larger without load/store multiple or out of line save/restore functions.

u-boot (an open source bootloader used on a large # of embedded PPC platforms no longer builds with gcc4.4)

UNDEF_SYM=`objdump -x board/freescale/mpc8536ds/libmpc8536ds.a lib_generic/libgeneric.a lib_generic/lzma/liblzma.a lib_generic/lzo/liblzo.a board/freescale/common/libfreescale.a cpu/mpc85xx/libmpc85xx.a lib_ppc/libppc.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/net/sk98lin/libsk98lin.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/qe/qe.a cpu/mpc8xxx/ddr/libddr.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a | sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`; cd /root/u-boot && ld -Bstatic -T u-boot.lds  -n -Ttext 0xeff80000 $UNDEF_SYM cpu/mpc85xx/start.o cpu/mpc85xx/resetvec.o --start-group lib_generic/libgeneric.a lib_generic/lzma/liblzma.a lib_generic/lzo/liblzo.a board/freescale/common/libfreescale.a cpu/mpc85xx/libmpc85xx.a lib_ppc/libppc.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/net/sk98lin/libsk98lin.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/qe/qe.a cpu/mpc8xxx/ddr/libddr.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a board/freescale/mpc8536ds/libmpc8536ds.a --end-group -L /usr/lib/gcc/ppc64-redhat-linux/4.4.1 -lgcc -Map u-boot.map -o u-boot
ld: Warning: /usr/lib/gcc/ppc64-redhat-linux/4.4.1/libgcc.a(_lshrdi3.o) uses hard float, u-boot uses soft float
ld: Warning: /usr/lib/gcc/ppc64-redhat-linux/4.4.1/libgcc.a(_ashldi3.o) uses hard float, u-boot uses soft float
ld: Warning: /usr/lib/gcc/ppc64-redhat-linux/4.4.1/libgcc.a(_ashrdi3.o) uses hard float, u-boot uses soft float
ld: Warning: /usr/lib/gcc/ppc64-redhat-linux/4.4.1/libgcc.a(_udivdi3.o) uses hard float, u-boot uses soft float
ld: Warning: /usr/lib/gcc/ppc64-redhat-linux/4.4.1/libgcc.a(_umoddi3.o) uses hard float, u-boot uses soft float
ld: section .bootpg loaded at [00000000effff000,00000000effff1cb] overlaps section .data loaded at [00000000efffb040,00000000effff4f7]
ld: section .resetvec loaded at [00000000effffffc,00000000efffffff] overlaps section .data.rel.local loaded at [00000000effffef8,00000000f000122b]
ld: u-boot: section .bootpg vma 0xeffff000 overlaps previous sections
ld: u-boot: section .data.rel.ro.local vma 0xeffff4f8 overlaps previous sections
ld: u-boot: section .data.rel vma 0xeffff55c overlaps previous sections
ld: u-boot: section .data.rel.local vma 0xeffffef8 overlaps previous sections
ld: u-boot: section .resetvec vma 0xeffffffc overlaps previous sections
ld: u-boot: section .data.rel.ro vma 0xf000122c overlaps previous sections
ld: u-boot: section .u_boot_cmd vma 0xf000124c overlaps previous sections
make: *** [u-boot] Error 1
Comment 8 David Edelsohn 2009-09-09 16:59:45 UTC
Kumar,

If you want this fixed then you or Edmar or someone at Freescale should fix the patch referenced in comment #6.
Comment 9 Jakub Jelinek 2009-09-09 17:49:44 UTC
See http://gcc.gnu.org/ml/gcc-patches/2009-09/msg00592.html
Comment 10 Jakub Jelinek 2009-09-15 20:12:37 UTC
Subject: Bug 40677

Author: jakub
Date: Tue Sep 15 20:12:18 2009
New Revision: 151729

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151729
Log:
	PR target/41175
	PR target/40677
	* config/rs6000/rs6000.c (no_global_regs_above): Fix precedence
	problem.
	(SAVRES_NOINLINE_GPRS_SAVES_LR, SAVRES_NOINLINE_FPRS_SAVES_LR,
	SAVRES_NOINLINE_FPRS_DOESNT_RESTORE_LR): New strategy bits.
	(rs6000_savres_strategy): Always save FP registers inline if the
	target doesn't support hardware double-precision.  Set the above
	bits in return value when needed.
	(rs6000_savres_routine_sym): Fix computation for cache selector.
	Mark the generated symbol as a function.  Rename exitp argument to
	lr.  Move code for determining the name of the symbol...
	(rs6000_savres_routine_name): ...here.  New function.  Add cases for
	getting the names right on AIX and 64-bit Linux.
	(savres_routine_name): New variable.
	(rs6000_make_savres_rtx): Rename exitp argument to lr.  Don't assert
	lr isn't set when savep.  Use r12 resp. r1 instead of r11 depending
	on what the target routine uses as a base register.  If savep && lr
	describe saving of r0 into memory slot.
	(rs6000_emit_prologue): Correct use of call_used_regs.  Fix out of
	line calls for AIX ABI.
	(rs6000_output_function_prologue): Use rs6000_savres_routine_name to
	determine FP save/restore functions.
	(rs6000_emit_stack_reset): Handle savres if sp_offset != 0 and
	frame_reg_rtx != sp_reg_rtx.  Use gen_add3_insn instead of
	gen_addsi3.
	(rs6000_emit_epilogue): Adjust computation of restore_lr.
	Duplicate restoration of LR and execute the appropriate one
	depending on whether GPRs are being restored inline.  Set r11 from
	offsetted frame_reg_rtx instead of sp_reg_rtx; if frame_reg_rtx is
	r11, adjust sp_offset.  Use gen_add3_insn instead of gen_addsi3.
	Fix out of line calls for AIX ABI.
	* config/rs6000/rs6000.md (*return_and_restore_fpregs_aix_<mode>):
	New insn.
	* config/rs6000/spe.md (*save_gpregs_spe): Use explicit match for
	register 11.
	(*restore_gpregs_spe): Likewise.
	(*return_and_restore_gpregs_spe): Likewise.
	* config/rs6000/linux64.h (SAVE_FP_SUFFIX, RESTORE_FP_SUFFIX):
	Define to empty string unconditionally.
	* config/rs6000/sysv4.h (SAVE_FP_SUFFIX, RESTORE_FP_SUFFIX):
	Define to empty string unconditionally.
	(GP_SAVE_INLINE, FP_SAVE_INLINE): Handle TARGET_64BIT the same as
	!TARGET_64BIT.

	* gcc.target/powerpc/pr41175.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/powerpc/pr41175.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/linux64.h
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/config/rs6000/rs6000.md
    trunk/gcc/config/rs6000/spe.md
    trunk/gcc/config/rs6000/sysv4.h
    trunk/gcc/testsuite/ChangeLog

Comment 11 Andrew Pinski 2012-01-09 23:35:29 UTC
Fixed for 4.5.0.