From: Ben Gras Date: Wed, 19 Mar 2014 23:01:48 +0000 (+0100) Subject: gold -Ttext=.. workaround X-Git-Tag: v3.3.0~203 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/dnssec-keyfromlabel.html?a=commitdiff_plain;h=6611dddc317baa4da4ebe62a3472a88df482f8bd;p=minix.git gold -Ttext=.. workaround replace invocations of -Ttext=.. with --section-start=.text=.. for gnu gold-ld. it was giving very weird results when given page-rounded values. --section-start=.text=.. works for both bfd-ld and gold. --- diff --git a/sys/arch/i386/stand/boot/Makefile.boot b/sys/arch/i386/stand/boot/Makefile.boot index a0b460865..68b687e83 100644 --- a/sys/arch/i386/stand/boot/Makefile.boot +++ b/sys/arch/i386/stand/boot/Makefile.boot @@ -137,12 +137,18 @@ CLEANFILES+= ${PROG}.tmp ${PROG}.map ${PROG}.syms vers.c vers.c: ${VERSIONFILE} ${SOURCES} ${LIBLIST} ${.CURDIR}/../Makefile.boot ${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT} +.if defined(__MINIX) +# BJG +# -Wl,-Ttext,0 changed to --section-start=.text=0 twice below of a gold problem. +# did not leave both versions in because of the huge continued line. +.endif + # Anything that calls 'real_to_prot' must have a %pc < 0x10000. # We link the program, find the callers (all in libi386), then # explicitly pull in the required objects before any other library code. ${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot ${_MKTARGET_LINK} - bb="$$( ${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,-Ttext,0 -Wl,-cref \ + bb="$$( ${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,--section-start=.text=0 -Wl,-cref \ ${OBJS} ${LIBLIST} | ( \ while read symbol file; do \ [ -z "$$file" ] && continue; \ @@ -158,7 +164,7 @@ ${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot do :; \ done; \ ) )"; \ - ${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,-Ttext,0 \ + ${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,--section-start=.text=0 \ -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} $$bb ${LIBLIST} ${OBJCOPY} -O binary ${PROG}.syms ${PROG} diff --git a/sys/arch/i386/stand/bootxx/Makefile.bootxx b/sys/arch/i386/stand/bootxx/Makefile.bootxx index 0eedfe038..52abc5b9a 100644 --- a/sys/arch/i386/stand/bootxx/Makefile.bootxx +++ b/sys/arch/i386/stand/bootxx/Makefile.bootxx @@ -140,8 +140,13 @@ CLEANFILES+= ${PROG}.sym ${PROG}.map ${PROG}: ${OBJS} ${LIBLIST} ${_MKTARGET_LINK} +.if defined(__MINIX) + ${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,--section-start=.text=${PRIMARY_LOAD_ADDRESS} \ + -T ${LDSCRIPT} -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} ${LIBLIST} +.else ${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,-Ttext,${PRIMARY_LOAD_ADDRESS} \ -T ${LDSCRIPT} -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} ${LIBLIST} +.endif ${OBJCOPY} -O binary ${PROG}.sym ${PROG} @ sz=$$(${TOOL_STAT} -f '%z' ${PROG}); \ if [ "$$sz" -gt "${BOOTXX_MAXSIZE}" ]; then \ diff --git a/sys/arch/i386/stand/cdboot/Makefile b/sys/arch/i386/stand/cdboot/Makefile index 1662c180b..db7b13c23 100644 --- a/sys/arch/i386/stand/cdboot/Makefile +++ b/sys/arch/i386/stand/cdboot/Makefile @@ -53,8 +53,13 @@ CLEANFILES+= ${PROG}.tmp ${PROG}: ${OBJS} ${_MKTARGET_LINK} +.if defined(__MINIX) + ${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,--section-start=.text=${PRIMARY_LOAD_ADDRESS} \ + ${OBJS} +.else ${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,${PRIMARY_LOAD_ADDRESS} \ ${OBJS} +.endif @ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\' \ | ${TOOL_SED} 's/^0*//' ); \ echo "#### There are $$1 free bytes in ${PROG}" diff --git a/sys/arch/i386/stand/mbr/Makefile.mbr b/sys/arch/i386/stand/mbr/Makefile.mbr index 59743b2a6..c91e700a3 100644 --- a/sys/arch/i386/stand/mbr/Makefile.mbr +++ b/sys/arch/i386/stand/mbr/Makefile.mbr @@ -56,7 +56,11 @@ AFLAGS.gpt.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:} ${PROG}: ${OBJS} ${_MKTARGET_LINK} +.if defined(__MINIX) + ${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,--section-start=.text=${LOADADDR} ${OBJS} +.else ${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,${LOADADDR} ${OBJS} +.endif @ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\' \ | ${TOOL_SED} 's/^0*//' ); \ echo "#### There are $$1 free bytes in ${PROG}"