[Bug target/81907] undefined reference to `memset'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81907 dongkyun.s at samsung dot com changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|DUPLICATE |--- --- Comment #7 from dongkyun.s at samsung dot com --- > Different tuning. Though maybe at -Os should be almost the same except for > the allowance for using the instructions that are in cortex-a12 rather than > a9 (for the -mcpu case). I attached .o files made by '-mtune=cortex-a9' and 'mtune=cortex-a12' (same as -mcpu case). Could you describe more in detail about this why memset is added on cortex-a9 or below ? memset_test_cortex-a9.o: file format elf32-littlearm Disassembly of section .text: ... 0022 : 22: b51fpush{r0, r1, r2, r3, r4, lr} 24: 2210movsr2, #16 26: 2100movsr1, #0 28: 4668mov r0, sp 2a: f7ff fffe bl 0 > But really memset is part of the C standard here and you don't use > -fno-hoisting option; Which option do you mean? (I'm sorry, but, fno-hoisting is not found) > Not a bug, see PR 63393 comment #5 for explanation of why. This is not related to freestanding implementations. Again, option is different by '-mcpu or -mtune' only. (1) CFLAGS: -Os -mtune=cortex-a9 (CC) memset_test.o (CC) main.o gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-ld -Bstatic -o memset_test \ memset_test.o main.o \ --start-group -L/home/dongkyun.s/tmp/memset_test/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/6.3.1 -lgcc --end-group -Map memset_test.map #--gc-sections memset_test.c:(.text+0x2a): undefined reference to `memset' (2) CFLAGS: -Os -mtune=cortex-a12 (CC) memset_test.o (CC) main.o gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-ld -Bstatic -o memset_test \ memset_test.o main.o \ --start-group -L/home/dongkyun.s/tmp/memset_test/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/6.3.1 -lgcc --end-group -Map memset_test.map #--gc-sections BUILD_TARGETS=memset_test.bin memset_test.txt memset_test.dis memset_test.ver Build Done!
[Bug target/81907] undefined reference to `memset'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81907 --- Comment #6 from dongkyun.s at samsung dot com --- Created attachment 42017 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42017=edit obj made by '-Os -mtune=cortex-a12' ./gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-objdump -d memset_test_cortex-a12.o memset_test_cortex-a12.o: file format elf32-littlearm Disassembly of section .text: : 0: b530push{r4, r5, lr} 2: f1a0 0208 sub.w r2, r0, #8 6: 460cmov r4, r1 8: 2300movsr3, #0 a: 2000movsr0, #0 c: 2100movsr1, #0 e: 42a3cmp r3, r4 10: db00blt.n 1412: bd30pop {r4, r5, pc} 14: f852 5f08 ldr.w r5, [r2, #8]! 18: 3301addsr3, #1 1a: 1940addsr0, r0, r5 1c: eb41 71e5 adc.w r1, r1, r5, asr #31 20: e7f5b.n e 0022 : 22: b51fpush{r0, r1, r2, r3, r4, lr} 24: 2200movsr2, #0 26: 490cldr r1, [pc, #48] ; (58 ) 28: 2300movsr3, #0 2a: e9cd 2300 strdr2, r3, [sp] 2e: e9cd 2302 strdr2, r3, [sp, #8] 32: 780cldrbr4, [r1, #0] 34: 7908ldrbr0, [r1, #4] 36: 4623mov r3, r4 38: 4302orrsr2, r0 3a: e9cd 2300 strdr2, r3, [sp] 3e: 788aldrbr2, [r1, #2] 40: 2300movsr3, #0 42: 4668mov r0, sp 44: f043 0307 orr.w r3, r3, #7 48: 2102movsr1, #2 4a: e9cd 2302 strdr2, r3, [sp, #8] 4e: f7ff fffe bl 0 52: b004add sp, #16 54: bd10pop {r4, pc} 56: bf00nop 58: .word 0x
[Bug target/81907] undefined reference to `memset'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81907 dongkyun.s at samsung dot com changed: What|Removed |Added Attachment #42014|0 |1 is obsolete|| --- Comment #5 from dongkyun.s at samsung dot com --- Created attachment 42016 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42016=edit obj made by '-Os -mtune=cortex-a9' ./gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-objdump -d memset_test_cortex-a9.o memset_test_cortex-a9.o: file format elf32-littlearm Disassembly of section .text: : 0: b530push{r4, r5, lr} 2: f1a0 0208 sub.w r2, r0, #8 6: 460cmov r4, r1 8: 2300movsr3, #0 a: 2000movsr0, #0 c: 2100movsr1, #0 e: 42a3cmp r3, r4 10: db00blt.n 1412: bd30pop {r4, r5, pc} 14: f852 5f08 ldr.w r5, [r2, #8]! 18: 3301addsr3, #1 1a: 1940addsr0, r0, r5 1c: eb41 71e5 adc.w r1, r1, r5, asr #31 20: e7f5b.n e 0022 : 22: b51fpush{r0, r1, r2, r3, r4, lr} 24: 2210movsr2, #16 26: 2100movsr1, #0 28: 4668mov r0, sp 2a: f7ff fffe bl 0 2e: 490aldr r1, [pc, #40] ; (58 ) 30: 2200movsr2, #0 32: 780cldrbr4, [r1, #0] 34: 7908ldrbr0, [r1, #4] 36: 4623mov r3, r4 38: 4302orrsr2, r0 3a: 4668mov r0, sp 3c: e9cd 2300 strdr2, r3, [sp] 40: 2300movsr3, #0 42: 788aldrbr2, [r1, #2] 44: f043 0307 orr.w r3, r3, #7 48: 2102movsr1, #2 4a: e9cd 2302 strdr2, r3, [sp, #8] 4e: f7ff fffe bl 0 52: b004add sp, #16 54: bd10pop {r4, pc} 56: bf00nop 58: .word 0x
[Bug target/81907] undefined reference to `memset'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81907 --- Comment #4 from dongkyun.s at samsung dot com --- Created attachment 42014 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42014=edit memset_test_cortex-a9.o (made by '-Os -mtune=cortex-a12') ./gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-objdump -d memset_test_cortex-a12.o memset_test_cortex-a12.o: file format elf32-littlearm Disassembly of section .text: : 0: b530push{r4, r5, lr} 2: f1a0 0208 sub.w r2, r0, #8 6: 460cmov r4, r1 8: 2300movsr3, #0 a: 2000movsr0, #0 c: 2100movsr1, #0 e: 42a3cmp r3, r4 10: db00blt.n 1412: bd30pop {r4, r5, pc} 14: f852 5f08 ldr.w r5, [r2, #8]! 18: 3301addsr3, #1 1a: 1940addsr0, r0, r5 1c: eb41 71e5 adc.w r1, r1, r5, asr #31 20: e7f5b.n e 0022 : 22: b51fpush{r0, r1, r2, r3, r4, lr} 24: 2200movsr2, #0 26: 490cldr r1, [pc, #48] ; (58 ) 28: 2300movsr3, #0 2a: e9cd 2300 strdr2, r3, [sp] 2e: e9cd 2302 strdr2, r3, [sp, #8] 32: 780cldrbr4, [r1, #0] 34: 7908ldrbr0, [r1, #4] 36: 4623mov r3, r4 38: 4302orrsr2, r0 3a: e9cd 2300 strdr2, r3, [sp] 3e: 788aldrbr2, [r1, #2] 40: 2300movsr3, #0 42: 4668mov r0, sp 44: f043 0307 orr.w r3, r3, #7 48: 2102movsr1, #2 4a: e9cd 2302 strdr2, r3, [sp, #8] 4e: f7ff fffe bl 0 52: b004add sp, #16 54: bd10pop {r4, pc} 56: bf00nop 58: .word 0x
[Bug target/81907] undefined reference to `memset'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81907 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #3 from Andrew Pinski --- Not a bug, see PR 63393 comment #5 for explanation of why. *** This bug has been marked as a duplicate of bug 63393 ***
[Bug target/81907] undefined reference to `memset'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81907 --- Comment #2 from Andrew Pinski --- (In reply to dongkyun.s from comment #0) > Found related issue in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888. Unrelated bug report.
[Bug target/81907] undefined reference to `memset'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81907 Andrew Pinski changed: What|Removed |Added Keywords|link-failure| Target|arm |arm-*-* Component|middle-end |target Host|x86 | Version|6.3.1 |unknown Build|x86 | --- Comment #1 from Andrew Pinski --- >What is different optimization behavior(implementation) in GCC between >cortex-a9 and cortex-a12 -given by mcpu or mtune option ? Different tuning. Though maybe at -Os should be almost the same except for the allowance for using the instructions that are in cortex-a12 rather than a9 (for the -mcpu case). But really memset is part of the C standard here and you don't use -fno-hoisting option; though IIRC that still requires memset being included in your libc.