ab827c028e
generated from lib/csu/common/crtbrand.c (which ultimately ends up in executables and shared libraries, via crt1.o, gcrt1.o or Scrt1.o). For all arches except sparc, gcc emits the section directive for the abitag struct in crtbrand.c with a PROGBITS type. However, newer versions of binutils (after 2.16.90) require the section to be of NOTE type, to guarantee that the .note.ABI-tag section correctly ends up in the first page of the final executable. Unfortunately, there is no clean way to tell gcc to use another section type, so crtbrand.c (or the C files that include it) must be compiled in multiple steps: - Compile the .c file to a .s file. - Edit the .s file to change the 'progbits' type to 'note', for the section directive that defines the .note.ABI-tag section. - Compile the .s file to an object file. These steps are done in the invididual Makefiles for each applicable arch. Reviewed by: kib
39 lines
887 B
Makefile
39 lines
887 B
Makefile
# $FreeBSD$
|
|
|
|
.PATH: ${.CURDIR}/../common
|
|
|
|
SRCS= crt1.c crti.S crtn.S
|
|
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
|
|
OBJS+= gcrt1.o
|
|
CFLAGS+= -Wall -Wno-unused \
|
|
-I${.CURDIR}/../common \
|
|
-I${.CURDIR}/../../libc/include
|
|
|
|
all: ${OBJS}
|
|
|
|
CLEANFILES= ${OBJS}
|
|
CLEANFILES+= crt1.s gcrt1.s
|
|
|
|
# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not
|
|
# directly compiled to .o files.
|
|
|
|
crt1.s: crt1.c
|
|
${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
|
|
sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
|
|
|
|
crt1.o: crt1.s
|
|
${CC} ${CFLAGS} -c -o ${.TARGET} crt1.s
|
|
|
|
gcrt1.s: crt1.c
|
|
${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c
|
|
sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
|
|
|
|
gcrt1.o: gcrt1.s
|
|
${CC} ${CFLAGS} -c -o ${.TARGET} gcrt1.s
|
|
|
|
realinstall:
|
|
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
|
${OBJS} ${DESTDIR}${LIBDIR}
|
|
|
|
.include <bsd.lib.mk>
|