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.
This commit is contained in:
parent
4a71196e69
commit
6611dddc31
4 changed files with 22 additions and 2 deletions
|
@ -137,12 +137,18 @@ CLEANFILES+= ${PROG}.tmp ${PROG}.map ${PROG}.syms vers.c
|
||||||
vers.c: ${VERSIONFILE} ${SOURCES} ${LIBLIST} ${.CURDIR}/../Makefile.boot
|
vers.c: ${VERSIONFILE} ${SOURCES} ${LIBLIST} ${.CURDIR}/../Makefile.boot
|
||||||
${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT}
|
${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.
|
# Anything that calls 'real_to_prot' must have a %pc < 0x10000.
|
||||||
# We link the program, find the callers (all in libi386), then
|
# We link the program, find the callers (all in libi386), then
|
||||||
# explicitly pull in the required objects before any other library code.
|
# explicitly pull in the required objects before any other library code.
|
||||||
${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot
|
${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot
|
||||||
${_MKTARGET_LINK}
|
${_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} | ( \
|
${OBJS} ${LIBLIST} | ( \
|
||||||
while read symbol file; do \
|
while read symbol file; do \
|
||||||
[ -z "$$file" ] && continue; \
|
[ -z "$$file" ] && continue; \
|
||||||
|
@ -158,7 +164,7 @@ ${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot
|
||||||
do :; \
|
do :; \
|
||||||
done; \
|
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}
|
-Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} $$bb ${LIBLIST}
|
||||||
${OBJCOPY} -O binary ${PROG}.syms ${PROG}
|
${OBJCOPY} -O binary ${PROG}.syms ${PROG}
|
||||||
|
|
||||||
|
|
|
@ -140,8 +140,13 @@ CLEANFILES+= ${PROG}.sym ${PROG}.map
|
||||||
|
|
||||||
${PROG}: ${OBJS} ${LIBLIST}
|
${PROG}: ${OBJS} ${LIBLIST}
|
||||||
${_MKTARGET_LINK}
|
${_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} \
|
${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,-Ttext,${PRIMARY_LOAD_ADDRESS} \
|
||||||
-T ${LDSCRIPT} -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} ${LIBLIST}
|
-T ${LDSCRIPT} -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} ${LIBLIST}
|
||||||
|
.endif
|
||||||
${OBJCOPY} -O binary ${PROG}.sym ${PROG}
|
${OBJCOPY} -O binary ${PROG}.sym ${PROG}
|
||||||
@ sz=$$(${TOOL_STAT} -f '%z' ${PROG}); \
|
@ sz=$$(${TOOL_STAT} -f '%z' ${PROG}); \
|
||||||
if [ "$$sz" -gt "${BOOTXX_MAXSIZE}" ]; then \
|
if [ "$$sz" -gt "${BOOTXX_MAXSIZE}" ]; then \
|
||||||
|
|
|
@ -53,8 +53,13 @@ CLEANFILES+= ${PROG}.tmp
|
||||||
|
|
||||||
${PROG}: ${OBJS}
|
${PROG}: ${OBJS}
|
||||||
${_MKTARGET_LINK}
|
${_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} \
|
${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,${PRIMARY_LOAD_ADDRESS} \
|
||||||
${OBJS}
|
${OBJS}
|
||||||
|
.endif
|
||||||
@ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\<free_space\>' \
|
@ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\<free_space\>' \
|
||||||
| ${TOOL_SED} 's/^0*//' ); \
|
| ${TOOL_SED} 's/^0*//' ); \
|
||||||
echo "#### There are $$1 free bytes in ${PROG}"
|
echo "#### There are $$1 free bytes in ${PROG}"
|
||||||
|
|
|
@ -56,7 +56,11 @@ AFLAGS.gpt.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
|
||||||
|
|
||||||
${PROG}: ${OBJS}
|
${PROG}: ${OBJS}
|
||||||
${_MKTARGET_LINK}
|
${_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}
|
${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,${LOADADDR} ${OBJS}
|
||||||
|
.endif
|
||||||
@ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\<mbr_space\>' \
|
@ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\<mbr_space\>' \
|
||||||
| ${TOOL_SED} 's/^0*//' ); \
|
| ${TOOL_SED} 's/^0*//' ); \
|
||||||
echo "#### There are $$1 free bytes in ${PROG}"
|
echo "#### There are $$1 free bytes in ${PROG}"
|
||||||
|
|
Loading…
Reference in a new issue