#arm #cross-compiling #glibc
#arm #перекрестная компиляция #glibc
Вопрос:
Я пытаюсь перекрестно скомпилировать glibc 2.10.1 с помощью arm-none-linux-gnueabi-gcc 4.4.1.
Процесс шел хорошо, пока он не собрал build_dir/csu/crti.S, gcc сообщает об ошибке «duplicate .fnstart directive».
были сгенерированы initfini.s и crti.s, но я не знаю, были ли они действительными или нет.
Makefile намеревается разделить initfini.s на crti.s и crtn.s, поэтому пары .fnstart .fnend в initfini.s были разделены на crti.s и crtn.s, а затем они не были сопоставлены, что привело к жалобе gcc на директиву duplicate .fnstart .
Итак, как я могу скомпилировать crti.o и crtn.o с этой версией 4.4.1 gcc? Приветствуются любые советы.
initfini.s
.arch armv5te
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 2
.eabi_attribute 30, 2
.eabi_attribute 18, 4
.file "initfini.c"
#APP
#include "defs.h"
/*@HEADER_ENDS*/
/*@TESTS_BEGIN*/
.text
.align 2
.global dummy
.type dummy, %function
dummy:
.fnstart
.LFB8:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
cmp r0, #0
stmfd sp!, {r3, lr}
.save {r3, lr}
.LCFI0:
ldmeqfd sp!, {r3, pc}
blx r0
ldmfd sp!, {r3, pc}
.LFE8:
.fnend
#APP
/*@TESTS_END*/
/*@_init_PROLOG_BEGINS*/
.align 2
.type call_gmon_start, %function
call_gmon_start:
.fnstart
.LFB9:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldr r3, .L8
ldr r0, .L8 4
.LPIC0:
add r3, pc, r3
ldr r2, [r3, r0]
cmp r2, #0
bxeq lr
b __gmon_start__(PLT)
.L9:
.align 2
.L8:
.word _GLOBAL_OFFSET_TABLE_-(.LPIC0 8)
.word __gmon_start__(GOT)
.LFE9:
.fnend
#APP
.section .init
.section .init,"ax",%progbits
.align 2
.global _init
.type _init, %function
_init:
.fnstart
.LFB10:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
stmfd sp!, {r3, lr}
.save {r3, lr}
.LCFI1:
bl call_gmon_start(PLT)
#APP
@ 96 "../sysdeps/generic/initfini.c" 1
ALIGN
@ 0 "" 2
@ 97 "../sysdeps/generic/initfini.c" 1
END_INIT
@ 0 "" 2
@ 99 "../sysdeps/generic/initfini.c" 1
/*@_init_PROLOG_ENDS*/
@ 0 "" 2
@ 100 "../sysdeps/generic/initfini.c" 1
/*@_init_EPILOG_BEGINS*/
@ 0 "" 2
@ 101 "../sysdeps/generic/initfini.c" 1
.section .init
@ 0 "" 2
ldmfd sp!, {r3, pc}
.LFE10:
.fnend
#APP
END_INIT
/*@_init_EPILOG_ENDS*/
/*@_fini_PROLOG_BEGINS*/
.section .fini
.section .fini,"ax",%progbits
.align 2
.global _fini
.type _fini, %function
_fini:
.fnstart
.LFB11:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
stmfd sp!, {r3, lr}
.save {r3, lr}
.LCFI2:
#APP
@ 116 "../sysdeps/generic/initfini.c" 1
ALIGN
@ 0 "" 2
@ 117 "../sysdeps/generic/initfini.c" 1
END_FINI
@ 0 "" 2
@ 118 "../sysdeps/generic/initfini.c" 1
/*@_fini_PROLOG_ENDS*/
@ 0 "" 2
bl i_am_not_a_leaf(PLT)
#APP
@ 129 "../sysdeps/generic/initfini.c" 1
/*@_fini_EPILOG_BEGINS*/
@ 0 "" 2
@ 130 "../sysdeps/generic/initfini.c" 1
.section .fini
@ 0 "" 2
ldmfd sp!, {r3, pc}
.LFE11:
.fnend
#APP
END_FINI
/*@_fini_EPILOG_ENDS*/
/*@TRAILER_BEGINS*/
.weak __gmon_start__
.weak __gmon_start__
.weak __gmon_start__
.weak __gmon_start__
.weak __gmon_start__
.ident "GCC: (Sourcery G Lite 2009q3-67) 4.4.1"
.section .note.GNU-stack,"",%progbits
crti.s
.arch armv5te
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 2
.eabi_attribute 30, 2
.eabi_attribute 18, 4
.file "initfini.c"
#APP
#include "defs.h"
/*@HEADER_ENDS*/
/*@_init_PROLOG_BEGINS*/
.align 2
.type call_gmon_start, %function
call_gmon_start:
.fnstart
.LFB9:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldr r3, .L8
ldr r0, .L8 4
.LPIC0:
add r3, pc, r3
ldr r2, [r3, r0]
cmp r2, #0
bxeq lr
b __gmon_start__(PLT)
.L9:
.align 2
.L8:
.word _GLOBAL_OFFSET_TABLE_-(.LPIC0 8)
.word __gmon_start__(GOT)
.LFE9:
.fnend
#APP
.section .init
.section .init,"ax",%progbits
.align 2
.global _init
.type _init, %function
_init:
.fnstart
.LFB10:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
stmfd sp!, {r3, lr}
.save {r3, lr}
.LCFI1:
bl call_gmon_start(PLT)
#APP
@ 96 "../sysdeps/generic/initfini.c" 1
ALIGN
@ 0 "" 2
@ 97 "../sysdeps/generic/initfini.c" 1
END_INIT
@ 0 "" 2
@ 99 "../sysdeps/generic/initfini.c" 1
/*@_init_PROLOG_ENDS*/
/*@_fini_PROLOG_BEGINS*/
.section .fini
.section .fini,"ax",%progbits
.align 2
.global _fini
.type _fini, %function
_fini:
.fnstart
.LFB11:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
stmfd sp!, {r3, lr}
.save {r3, lr}
.LCFI2:
#APP
@ 116 "../sysdeps/generic/initfini.c" 1
ALIGN
@ 0 "" 2
@ 117 "../sysdeps/generic/initfini.c" 1
END_FINI
@ 0 "" 2
@ 118 "../sysdeps/generic/initfini.c" 1
/*@_fini_PROLOG_ENDS*/
/*@TRAILER_BEGINS*/
.weak __gmon_start__
.weak __gmon_start__
.weak __gmon_start__
.weak __gmon_start__
.weak __gmon_start__
.ident "GCC: (Sourcery G Lite 2009q3-67) 4.4.1"
.section .note.GNU-stack,"",%progbits
версия gcc
arm-none-linux-gnueabi-gcc (Sourcery G Lite 2009q3-67) 4.4.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
команда компиляции
arm-none-linux-gnueabi-gcc ../ports/sysdeps/arm/initfini.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -g -Wstrict-prototypes -g0 -fPIC -fno-inline-functions -fno-toplevel-reorder -fno-section-anchors -I../include -I/home/user/Downloads/glibc-2.10.1/build/csu -I/home/user/Downloads/glibc-2.10.1/build -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/eabi/nptl -I../ports/sysdeps/unix/sysv/linux/arm/eabi -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/eabi -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports -I.. -I../libio -I. -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DHAVE_INITFINI -S -g0 -fPIC -fno-inline-functions -fno-toplevel-reorder -fno-section-anchors -finhibit-size-directive -fno-exceptions -o /home/user/Downloads/glibc-2.10.1/build/csu/initfini.s
arm-none-linux-gnueabi-gcc /home/user/Downloads/glibc-2.10.1/build/csu/crti.S -c -I../include -I/home/user/Downloads/glibc-2.10.1/build/csu -I/home/user/Downloads/glibc-2.10.1/build -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/eabi/nptl -I../ports/sysdeps/unix/sysv/linux/arm/eabi -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/eabi -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports -I.. -I../libio -I. -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DHAVE_INITFINI -DASSEMBLER -I/home/user/Downloads/glibc-2.10.1/build/csu/. -Wa,--noexecstack -g0 -o /home/user/Downloads/glibc-2.10.1/build/csu/crti.o
Ответ №1:
Оба .fnstart
и .fnend
являются директивами LLVM, обозначающими начальную и конечную позиции функции.
Вы должны заменить их на .func
и .endfunc
соответственно для GCC.