libgloss ARM compile error

View: New views
5 Messages — Rating Filter:   Alert me  

libgloss ARM compile error

by Joel Sherrill <joel@OARcorp.com> :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I was trying to compile newlib cvs head for
arm-elf and got these:

make[5]: Entering directory
`/users/joel/test-gcc/b-arm-elf-gcc/arm-elf/thumb/libgloss/arm'
/users/joel/test-gcc/b-arm-elf-gcc/./gcc/xgcc
-B/users/joel/test-gcc/b-arm-elf-gcc/./gcc/ -nostdinc
-B/users/joel/test-gcc/b-arm-elf-gcc/arm-elf/newlib/ -isystem
/users/joel/test-gcc/b-arm-elf-gcc/arm-elf/newlib/targ-include -isystem
/users/joel/test-gcc/gcc-svn/newlib/libc/include
-B/users/joel/test-gcc/b-arm-elf-gcc/arm-elf/libgloss/arm
-L/users/joel/test-gcc/b-arm-elf-gcc/arm-elf/libgloss/libnosys
-L/users/joel/test-gcc/gcc-svn/libgloss/arm
-B/users/joel/test-gcc/install-arm/arm-elf/bin/
-B/users/joel/test-gcc/install-arm/arm-elf/lib/ -isystem
/users/joel/test-gcc/install-arm/arm-elf/include -isystem
/users/joel/test-gcc/install-arm/arm-elf/sys-include    -g -O2 -O2 -I.
-I../../../../../gcc-svn/libgloss/arm/.. -c -g -O2  -mthumb
../../../../../gcc-svn/libgloss/arm/linux-crt0.c
/users/joel/test-gcc/b-arm-elf-gcc/./gcc/xgcc
-B/users/joel/test-gcc/b-arm-elf-gcc/./gcc/ -nostdinc
-B/users/joel/test-gcc/b-arm-elf-gcc/arm-elf/newlib/ -isystem
/users/joel/test-gcc/b-arm-elf-gcc/arm-elf/newlib/targ-include -isystem
/users/joel/test-gcc/gcc-svn/newlib/libc/include
-B/users/joel/test-gcc/b-arm-elf-gcc/arm-elf/libgloss/arm
-L/users/joel/test-gcc/b-arm-elf-gcc/arm-elf/libgloss/libnosys
-L/users/joel/test-gcc/gcc-svn/libgloss/arm
-B/users/joel/test-gcc/install-arm/arm-elf/bin/
-B/users/joel/test-gcc/install-arm/arm-elf/lib/ -isystem
/users/joel/test-gcc/install-arm/arm-elf/include -isystem
/users/joel/test-gcc/install-arm/arm-elf/sys-include    -g -O2 -I.
-I../../../../../gcc-svn/libgloss/arm/.. -g -O2  -mthumb -c
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S: Assembler messages:
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:37: Error: missing
expression -- `swi'
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:102: Error:
missing expression -- `swi'
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:103: Error:
missing expression -- `swi'
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:104: Error:
missing expression -- `swi'
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:107: Error:
missing expression -- `swi'

Any ideas?

--
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@...        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985



Re: libgloss ARM compile error

by Nick Clifton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Joel,

> I was trying to compile newlib cvs head for
> arm-elf and got these:

> ../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:37: Error: missing
> expression -- `swi'

Weird.  The thumb code appears to be completely bogus.

Please try out the attached patch and let me know how it goes.

Cheers
   Nick


Index: libgloss/arm/linux-syscalls0.S
===================================================================
RCS file: /cvs/src/src/libgloss/arm/linux-syscalls0.S,v
retrieving revision 1.5
diff -c -3 -p -r1.5 linux-syscalls0.S
*** libgloss/arm/linux-syscalls0.S 3 Oct 2006 16:33:50 -0000 1.5
--- libgloss/arm/linux-syscalls0.S 2 Oct 2009 10:51:22 -0000
***************
*** 19,65 ****
  #define GLOBAL(name) .global name; FUNC(name)
  #define SIZE(name) .size name, .-name
 
- #if __thumb__
-
- # define SYSCALL0(name) \
- GLOBAL(_ ## name); \
- mov r12, r7; \
- mov r7, #SYS_ ## name; \
- swi; \
- mov r7, r12; \
- b _set_errno; \
- SIZE(_ ## name)
-
- /* static int _syscall3(int a, int b, int c, int number); */
- FUNC(_syscall3)
- push { r7 }
- mov r7, r3
- swi
- pop { r7 }
- b _set_errno
- SIZE(_syscall3)
-
- # define SYSCALL3(name) \
- GLOBAL(_ ## name); \
- mov r3, #SYS_ ## name; \
- b _syscall3; \
- SIZE(_ ## name)
-
- # define SYSCALL6(name) \
- GLOBAL(_ ## name); \
- push { r4 - r5, r7 }; \
- ldr r4, [sp, #12]; \
- ldr r5, [sp, #16]; \
- mov r7, #SYS_ ## name; \
- swi; \
- pop { r4 - r5, r7 }; \
- b _set_errno; \
- SIZE(_ ## name)
-
- # define SYSCALL4(name) SYSCALL6(name)
-
- #else /* __thumb__ */
-
  # define SYSCALL4(name) \
  GLOBAL(_ ## name); \
  swi #SYS_ ## name; \
--- 19,24 ----
*************** FUNC(_syscall3)
*** 78,86 ****
 
  #define SYSCALL0(name) SYSCALL3(name)
  #define SYSCALL3(name) SYSCALL4(name)
-
- #endif /* __thumb__ */
-
  #define SYSCALL1(name) SYSCALL3(name)
  #define SYSCALL2(name) SYSCALL3(name)
  #define SYSCALL5(name) SYSCALL6(name)
--- 37,42 ----

Re: libgloss ARM compile error

by Joel Sherrill <joel@OARcorp.com> :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nick Clifton wrote:
> Hi Joel,
>
>  
>> I was trying to compile newlib cvs head for
>> arm-elf and got these:
>>    
>
>  
/users/joel/test-gcc/b-arm-elf-gcc/./gcc/xgcc
-B/users/joel/test-gcc/b-arm-elf-gcc/./gcc/ -nostdinc
-B/users/joel/test-gcc/b-arm-elf-gcc/arm-eabi/newlib/ -isystem
/users/joel/test-gcc/b-arm-elf-gcc/arm-eabi/newlib/targ-include -isystem
/users/joel/test-gcc/gcc-svn/newlib/libc/include
-B/users/joel/test-gcc/b-arm-elf-gcc/arm-eabi/libgloss/arm
-L/users/joel/test-gcc/b-arm-elf-gcc/arm-eabi/libgloss/libnosys
-L/users/joel/test-gcc/gcc-svn/libgloss/arm
-B/users/joel/test-gcc/install-arm/arm-eabi/bin/
-B/users/joel/test-gcc/install-arm/arm-eabi/lib/ -isystem
/users/joel/test-gcc/install-arm/arm-eabi/include -isystem
/users/joel/test-gcc/install-arm/arm-eabi/sys-include    -g -O2 -I.
-I../../../../../gcc-svn/libgloss/arm/.. -g -O2  -mthumb -c
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S: Assembler messages:
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:37: Error: missing
expression -- `swi'
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:102: Error:
missing expression -- `swi'
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:103: Error:
missing expression -- `swi'
../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:104: Error:
missing expression -- `swi'
.....


>> ../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:37: Error: missing
>> expression -- `swi'
>>    
>
> Weird.  The thumb code appears to be completely bogus.
>
> Please try out the attached patch and let me know how it goes.
>
> Cheers
>    Nick
>
>  


Re: libgloss ARM compile error

by Eric Bresie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

FYI...

I applied this against 1.17.0 and resolved this error.

Eric Bresie

On 10/2/09, Joel Sherrill <joel.sherrill@...> wrote:

> Nick Clifton wrote:
>> Hi Joel,
>>
>>
>>> I was trying to compile newlib cvs head for
>>> arm-elf and got these:
>>>
>>
>>
> /users/joel/test-gcc/b-arm-elf-gcc/./gcc/xgcc
> -B/users/joel/test-gcc/b-arm-elf-gcc/./gcc/ -nostdinc
> -B/users/joel/test-gcc/b-arm-elf-gcc/arm-eabi/newlib/ -isystem
> /users/joel/test-gcc/b-arm-elf-gcc/arm-eabi/newlib/targ-include -isystem
> /users/joel/test-gcc/gcc-svn/newlib/libc/include
> -B/users/joel/test-gcc/b-arm-elf-gcc/arm-eabi/libgloss/arm
> -L/users/joel/test-gcc/b-arm-elf-gcc/arm-eabi/libgloss/libnosys
> -L/users/joel/test-gcc/gcc-svn/libgloss/arm
> -B/users/joel/test-gcc/install-arm/arm-eabi/bin/
> -B/users/joel/test-gcc/install-arm/arm-eabi/lib/ -isystem
> /users/joel/test-gcc/install-arm/arm-eabi/include -isystem
> /users/joel/test-gcc/install-arm/arm-eabi/sys-include    -g -O2 -I.
> -I../../../../../gcc-svn/libgloss/arm/.. -g -O2  -mthumb -c
> ../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S
> ../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S: Assembler messages:
> ../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:37: Error: missing
> expression -- `swi'
> ../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:102: Error:
> missing expression -- `swi'
> ../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:103: Error:
> missing expression -- `swi'
> ../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:104: Error:
> missing expression -- `swi'
> .....
>
>
>>> ../../../../../gcc-svn/libgloss/arm/linux-syscalls0.S:37: Error: missing
>>> expression -- `swi'
>>>
>>
>> Weird.  The thumb code appears to be completely bogus.
>>
>> Please try out the attached patch and let me know how it goes.
>>
>> Cheers
>>    Nick
>>
>>
>
>


--
Eric Bresie
ebresie@...

Re: libgloss ARM compile error

by Robrecht Dewaele :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> >>
> >> Weird.  The thumb code appears to be completely bogus.
> >>
> >> Please try out the attached patch and let me know how it goes.
> >>
> >> Cheers
> >>    Nick

I also encountered the same problem, but solved it by using binutils-2.19.1
instead of binutils-2.20 in the build process of the arm-elf toolchain.

Nevertheless it does seem that the problem is within newlib, as shown by the
patch Nick made. The swi instruction takes a mandatory argument as documented by
the ARM ARM.

Greetings,
Robrecht