This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, I've found a problem when using gas as a cross assembler, to build PowerPC XCOFF objects from an x86/Cygwin system. The problem is that, under some circumstances, code gets misaligned - it /appears/ that a .align directive is being ignored. The problem was spotted with binutils 2.13; since then I've downloaded and built bunitils 2.13-1 and we still have the problem. Binutils are built as follows: ./configure --host=i686-pc-cygwin --target=powerpc-vtx-aix make CFLAGS="-O" make CFLAGS="-O" install (The powerpc-vtx-aix designation is to match a slightly modified gcc) We've tried to find the minumum code to reproduce the problem, and it's attached as test_task.c. The compiler generates the assembler file test_task.s and object test_task.o. Here's the listing output from the assembler :- GAS LISTING test_task.s page 1 1 .file "test_task.c" 2 .toc 3 .csect .text[PR] 4 .csect _testtask.rw_c[RW],3 5 bad_var.0: 6 0004 23 .byte 35 7 .csect .text[PR] 8 .align 2 9 .globl bad_func 10 .globl .bad_func 11 .csect bad_func[DS] 12 bad_func: 13 0005 00000000 .long .bad_func, TOC[tc0], 0 13 00000000 13 0000B000 13 000000 14 .csect .text[PR] 15 .bad_func: 16 0000 93E1FFFC stw 31,-4(1) 17 0004 9421FFD8 stwu 1,-40(1) 18 0008 7C3F0B78 mr 31,1 19 000c 80210000 lwz 1,0(1) 20 0010 83E1FFFC lwz 31,-4(1) 21 0014 4E800020 blr 22 LT..bad_func: 23 0018 00000000 .long 0 24 001c 00002060 .byte 0,0,32,96,128,1,0,1 24 80010001 25 0024 00000018 .long LT..bad_func-.bad_func 26 0028 0008 .short 8 27 002a 6261645F .byte "bad_func" 27 66756E63 28 0032 1F .byte 31 29 0033 00 .align 2 30 .toc 31 LC..0: 32 0000 000000B5 .tc bad_func[TC],bad_func 33 .csect .text[PR] 34 .align 2 35 .globl vertex_main 36 .globl .vertex_main 37 .csect vertex_main[DS] 38 vertex_main: 39 0014 00000034 .long .vertex_main, TOC[tc0], 0 39 000000B0 39 00000000 40 .csect .text[PR] 41 .vertex_main: 42 0034 7C0802A6 mflr 0 43 0038 93E1FFFC stw 31,-4(1) 44 003c 90010008 stw 0,8(1) 45 0040 9421FFB0 stwu 1,-80(1) 46 0044 7C3F0B78 mr 31,1 47 0048 907F0068 stw 3,104(31) 48 004c 80020000 lwz 0,LC..0(2) 49 0050 901F0038 stw 0,56(31) 50 0054 813F0038 lwz 9,56(31) GAS LISTING test_task.s page 2 51 0058 80090000 lwz 0,0(9) 52 005c 7C0903A6 mtctr 0 53 0060 90410014 stw 2,20(1) 54 0064 80490004 lwz 2,4(9) 55 0068 81690008 lwz 11,8(9) 56 006c 4E800421 bctrl 57 0070 80410014 lwz 2,20(1) 58 0074 7C030378 mr 3,0 59 0078 80210000 lwz 1,0(1) 60 007c 80010008 lwz 0,8(1) 61 0080 7C0803A6 mtlr 0 62 0084 83E1FFFC lwz 31,-4(1) 63 0088 4E800020 blr 64 LT..vertex_main: 65 008c 00000000 .long 0 66 0090 00002061 .byte 0,0,32,97,128,1,1,1 66 80010101 67 0098 00000000 .long 0 68 009c 00000058 .long LT..vertex_main-.vertex_main 69 00a0 000B .short 11 70 00a2 76657274 .byte "vertex_main" 70 65785F6D 70 61696E 71 00ad 1F .byte 31 72 00ae 0000 .align 2 73 _section_.text: 74 .csect .data[RW],3 75 0020 000000B0 .long _section_.text 75 00000000 GAS LISTING test_task.s page 3 DEFINED SYMBOLS *ABS*:00000000 test_task.c .text:00000000 .text test_task.s:15 .text:00000000 .bad_func test_task.s:41 .text:00000034 .vertex_main .data:00000000 TOC test_task.s:32 .data:00000000 bad_func .data:00000004 _testtask.rw_c .data:00000005 bad_func test_task.s:12 .data:00000005 bad_func .data:00000014 vertex_main test_task.s:38 .data:00000014 vertex_main .data:00000020 .data NO UNDEFINED SYMBOLS Running powerpc-vtx-aix-nm on test_task.o gives the following: 00000000 T .bad_func 000000d0 d .data 00000000 t .text 00000034 T .vertex_main 000000b0 d TOC 000000b4 d _testtask.rw_ 000000b5 d bad_func 000000b5 D bad_func 000000b0 d bad_func 000000c4 d vertex_main 000000c4 D vertex_main I don't have a lot of experience with this assembler, but the problem seems to be that the '.align 2' directive at line 8 gets ignored and the 'bad_func' entry point ends up on a single byte boundary while the code is generated to access it on a 4-byte boundary. Hope my explanation of the problem is clear enough. Thanks in advance, -- Trevor Marshall
Attachment:
test_task.c
Description: application/unknown-content-type-cfile
Attachment:
test_task.o
Description: Binary data
.file "test_task.c" .toc .csect .text[PR] .csect _testtask.rw_c[RW],3 bad_var.0: .byte 35 .csect .text[PR] .align 2 .globl bad_func .globl .bad_func .csect bad_func[DS] bad_func: .long .bad_func, TOC[tc0], 0 .csect .text[PR] .bad_func: stw 31,-4(1) stwu 1,-40(1) mr 31,1 lwz 1,0(1) lwz 31,-4(1) blr LT..bad_func: .long 0 .byte 0,0,32,96,128,1,0,1 .long LT..bad_func-.bad_func .short 8 .byte "bad_func" .byte 31 .align 2 .toc LC..0: .tc bad_func[TC],bad_func .csect .text[PR] .align 2 .globl vertex_main .globl .vertex_main .csect vertex_main[DS] vertex_main: .long .vertex_main, TOC[tc0], 0 .csect .text[PR] .vertex_main: mflr 0 stw 31,-4(1) stw 0,8(1) stwu 1,-80(1) mr 31,1 stw 3,104(31) lwz 0,LC..0(2) stw 0,56(31) lwz 9,56(31) lwz 0,0(9) mtctr 0 stw 2,20(1) lwz 2,4(9) lwz 11,8(9) bctrl lwz 2,20(1) mr 3,0 lwz 1,0(1) lwz 0,8(1) mtlr 0 lwz 31,-4(1) blr LT..vertex_main: .long 0 .byte 0,0,32,97,128,1,1,1 .long 0 .long LT..vertex_main-.vertex_main .short 11 .byte "vertex_main" .byte 31 .align 2 _section_.text: .csect .data[RW],3 .long _section_.text
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |