Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: [PATCH] thumb fixes
On Wed, Aug 20, 2008 at 11:29:12AM +0300, Mikko Rapeli wrote:
> /bin/cat work when compiled on an ARM board. Cross compiled
> thumb binaries have some problems as well.
The cross compilation problem was caused by crtbeginT.o and crtend.o
which at the moment don't work in thumb mode. If they and a number of
other objects are compiled with thumb-interwork only, a statically
linked userspace compiled to thumb works. On target my userspace was
compiled with thumb-interwork only, so the crt* files worked.
Here's an example wrapper for build.sh which contains the thumb-interwork
exceptions.
-Mikko
#!/bin/sh -x
# Used to build NetBSD userspace to thumb
SRCDIR='pwd'
# for the moment, only static binaries work in thumb mode
export LDSTATIC=-static
# and PAM doesn't work with static binaries
export MKPAM=no
# static build failures
export MKKERBEROS=no
export MKGDB=no
# don't halt on linker warnings (libcrypto's patent warnings)
export NOGCCERROR=yes
# contain asm
CSU_FAILING_OBJECTS="crt0 crti crtn gcrt0"
# These cause runtime failures if build in thumb mode
CSU_RUNTIME_FAILING_OBJECTS="crtbeginT crtend"
for i in $CSU_FAILING_OBJECTS $CSU_RUNTIME_FAILING_OBJECTS
do
eval `echo export CPUFLAGS_$i=\"-mthumb-interwork\"`
done
# gcrt0 target in lib/csu/common_elf has a manual build command and
# an empty .IMPSRC make variable. Working around this by using CPUFLAGS_
# variable which defaults safely:
export CPUFLAGS_=-mthumb-interwork
# To get this list: build libc with CPUFLAGS=-mthumb and MAKEFLAGS=-k to
# gather failing object to log
# then run:
# grep '^*** Failed tar.*.[so,o] log' | awk -e '{ print $4 }'| sed -e
's/\.so//' | sed -e 's/\.o//' | sort | uniq | xargs > thumb_failing_objects.txt
LIBC_FAILING_OBJECTS='accept access acct tmp_adjtime aio_suspend alloca
atomic_cas_up atomic_init_testset bcopy bind brk byte_swap_2 byte_swap_4 bzero
cerror chdir chflags chmod chown chroot clk_test_force_onoff clk_test_getstatus
clock_getres clock_gettime tmp_clock_settime tmp_clone close compat_msgctl
compat_Ovfork compat___semctl compat_setjmp compat_shmctl compat_sigaction
compat_sigpending compat_sigprocmask compat_sigreturn compat___sigreturn14
compat_sigsetjmp compat_sigsuspend compat___sigtramp1 connect divsi3 dup dup2
exect execve _exit extattrctl extattr_delete_fd extattr_delete_file
extattr_delete_link extattr_get_fd extattr_get_file extattr_get_link
extattr_list_fd extattr_list_file extattr_list_link extattr_set_fd
extattr_set_file extattr_set_link fchdir fchflags fchmod fchown fchroot fcntl
fdatasync ffs tmp_fhopen40 tmp_fhstat40 tmp_fhstatvfs140 fktrace flock fork
fpathconf tmp_fstat30 fstatvfs1 fsync fsync_range tmp_ftruncate futimes
getcontext tmp_getcwd tmp_getdents30 getegid geteuid tmp_getfh30 getgid
getgroups getitimer tmp_getlogin getpeername getpgid getpgrp getpid getppid
getpriority getrlimit getrusage getsid getsockname getsockopt gettimeofday
getuid getvfsstat ioctl issetugid kevent kill kqueue _ksem_close _ksem_destroy
_ksem_getvalue _ksem_init _ksem_open _ksem_post _ksem_trywait _ksem_unlink
_ksem_wait ktrace lchflags lchmod lchown lfs_bmapv lfs_markv lfs_segclean
lfs_segwait link listen tmp_lseek tmp_lstat30 lutimes _lwp_continue _lwp_create
_lwp_ctl _lwp_detach _lwp_exit _lwp_getname _lwp_getprivate _lwp_kill _lwp_park
_lwp_self _lwp_setname _lwp_setprivate _lwp_suspend _lwp_unpark _lwp_unpark_all
_lwp_wait _lwp_wakeup madvise mcount memcmp memcpy memmove memset mincore
minherit mkdir mkfifo mknod mlock mlockall tmp_mmap modctl tmp_mount50 mprotect
mq_receive mq_send mq_timedreceive mq_timedsend mremap tmp_msgctl13 msgget
msgrcv msgsnd tmp_msync13 munlock munlockall munmap nanosleep nfssvc
tmp_ntp_adjtime tmp_ntp_gettime30 open pathconf pipe pmc_control pmc_get_info
poll pollts tmp_posix_chown tmp_posix_fadvise50 tmp_posix_fchown
tmp_posix_lchown tmp_posix_rename tmp_pread tmp_preadv profil pselect ptrace
tmp_pwrite tmp_pwritev quotactl rasctl read readlink readv reboot recvfrom
recvmsg rename revoke rmdir sa_enable sa_preempt sa_register sa_setconcurrency
sa_stacks sa_yield sbrk _sched_getaffinity _sched_getparam _sched_setaffinity
_sched_setparam sched_yield select semconfig tmp___semctl13 semget semop
sendmsg sendto setcontext setegid seteuid setgid setgroups setitimer setjmp
_setjmp tmp_setlogin setpgid setpriority setregid setreuid setrlimit setsid
setsockopt tmp_settimeofday setuid shmat tmp_shmctl13 shmdt shmget shutdown
tmp_sigaction_sigtramp tmp_sigaltstack14 tmp_sigpending14 tmp_sigprocmask14
sigsetjmp tmp_sigsuspend14 tmp_sigtimedwait __sigtramp2 tmp_socket30 socketpair
tmp_stat30 statvfs1 strcmp strncmp swapcontext swapctl symlink sync sysarch
syscall __syscall tmp_sysctl timer_create timer_delete timer_getoverrun
timer_gettime timer_settime tmp_truncate umask undelete unlink unmount utimes
utrace uuidgen vadvise __vfork14 wait4 write writev'
# functions in these object produce runtime errors in thumb mode:
#RUNTIME_ERRORS='thread-stub'
# compiler bug with c++ code, note 's/-/_/g':
GCCBUG="application exceptions atffile config formats ui fs tests ext_inst
fstream_inst fstream_inst ios_inst istream_inst istream locale_inst localename
ostream_inst sstream_inst string_inst strstream valarray_inst wstring_inst
wlocale_inst eh_personality vec"
# Contains inline ARM asm and do not compile to thumb. Note: there are many
# lock.o's but there is no way to distinguish them with this build hack.
ASM="k_tanf _context_u pthread_lock _pset_bind aio_cancel aio_error aio_fsync
aio_read aio_return aio_write lio_listio mq_close mq_getattr aio_cancel
aio_error aio_fsync aio_return aio_write lio_listio mq_close mq_getattr
mq_notify mq_open mq_setattr mq_unlink pset_assign pset_create pset_destroy
srtbegin abortfixup stackptr lock "
NEW_ASM='__syscall __clone __clone __fhopen40 __fhstatvfs140 __fhstat40
__fstat30 __getcwd __getdents30 __getfh30 __getlogin __lstat30 __mount50
__msgctl13 __ntp_gettime30 __posix_chown __posix_fadvise50 __posix_fchown
__posix_lchown __posix_rename ____semctl13 __setlogin __shmctl13
__sigaltstack14 __sigtimedwait __sigpending14 __sigaction_sigtramp __socket30
__stat30 __sysctl tmp__lwp_getprivate tmp_mremap __msync13 __sigsuspend14
__sigprocmask14 __clone __fhopen40 __fhstat40 __fhstatvfs140 __fstat30 __getcwd
__getdents30 __getfh30 __getlogin __lstat30 __mount50 __msgctl13
__ntp_gettime30 __posix_chown __posix_fadvise50 __posix_fchown __posix_lchown
__posix_rename ____semctl13 __setlogin __shmctl13 __sigaltstack14
__sigpending14 __socket30 __sigaction_sigtramp __sigtimedwait __stat30 __sysctl
tmp__lwp_getprivate tmp_mremap __msync13 __sigsuspend14 __sigprocmask14'
for i in $LIBC_FAILING_OBJECTS $RUNTIME_ERRORS $GCCBUG $ASM $NEW_ASM
do
eval `echo export CPUFLAGS_$i=\"-mthumb-interwork\"`
done
export DEF_CPUFLAGS='-mthumb -mthumb-interwork'
export CPUFLAGS='${CPUFLAGS_${.IMPSRC:S/-/_/g:T:R}:U${DEF_CPUFLAGS}}'
echo Building userspace:
./build.sh $*
Home |
Main Index |
Thread Index |
Old Index