This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PING [PATCH] Add USER_LABEL_PREFIX before __bss_start in elf.sc


Andreas Schwab wrote:
Jie Zhang <jie.zhang@analog.com> writes:

I sent this patch one year ago. But there was no response at that time.

http://sourceware.org/ml/binutils/2008-07/msg00290.html

That patch is still applicable on latest CVS HEAD. Is it OK?

There are other symbols that lack ${USER_LABEL_PREFIX}:


    ${RELOCATING+_stack = .;}
  ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);}
  ${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);}
  ${RELOCATING+PROVIDE (${ETEXT_NAME} = .);}

Also, the unprefixed symbols should probably be PROVIDEd for
compatibility.

How about this patch. It adds ${USER_LABEL_PREFIX} to _stack, etext, _stack and __bss_start. Now ENTRY can be removed from emulparams/bfin.sh.

I don't think there is compatibility issue. bfin is the only target which defines USER_LABEL_PREFIX. So this patch is NULL for all other targets.

Tested with native x86_64 and cross bfin-elf, bfin-uclinux, bfin-linux-uclibc. Is it OK now?


Jie


	* scripttempl/elf.sc: Add ${USER_LABEL_PREFIX} to _start, etext,
	_stack and __bss_start.
	* emulparams/bfin.sh (ENTRY): Remove.

Index: emulparams/bfin.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/bfin.sh,v
retrieving revision 1.8
diff -u -r1.8 bfin.sh
--- emulparams/bfin.sh	12 Jul 2008 08:54:13 -0000	1.8
+++ emulparams/bfin.sh	1 Sep 2009 00:29:23 -0000
@@ -5,7 +5,6 @@
 TARGET_PAGE_SIZE=0x1000
 ARCH=bfin
 MACHINE=
-ENTRY=__start
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 EMBEDDED=yes
Index: scripttempl/elf.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf.sc,v
retrieving revision 1.93
diff -u -r1.93 elf.sc
--- scripttempl/elf.sc	21 Aug 2009 10:38:14 -0000	1.93
+++ scripttempl/elf.sc	1 Sep 2009 00:29:23 -0000
@@ -89,14 +89,14 @@
 #
 #  Each of these can also have corresponding .rel.* and .rela.* sections.
 
-test -z "$ENTRY" && ENTRY=_start
+test -z "$ENTRY" && ENTRY=${USER_LABEL_PREFIX}_start
 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
 if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
 test -z "${ELFSIZE}" && ELFSIZE=32
 test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
 test "$LD_FLAG" = "N" && DATA_ADDR=.
-test -z "${ETEXT_NAME}" && ETEXT_NAME=etext
+test -z "${ETEXT_NAME}" && ETEXT_NAME=${USER_LABEL_PREFIX}etext
 test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
 test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
 test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
@@ -254,7 +254,7 @@
   }"
 STACK="  .stack        ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
   {
-    ${RELOCATING+_stack = .;}
+    ${RELOCATING+${USER_LABEL_PREFIX}_stack = .;}
     *(.stack)
   }"
 
@@ -501,7 +501,7 @@
   ${SDATA}
   ${OTHER_SDATA_SECTIONS}
   ${RELOCATING+${DATA_END_SYMBOLS-${USER_LABEL_PREFIX}_edata = .; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
-  ${RELOCATING+__bss_start = .;}
+  ${RELOCATING+${USER_LABEL_PREFIX}__bss_start = .;}
   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
   ${SBSS}
   ${BSS_PLT+${PLT}}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]