mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-11 16:46:14 +08:00
PR linker/4844
* genscript.sh: Add support for generating a .xa script for use with the --auto-import option. * ld.texinfo: Document the new behaviour of the --auto-import option. * ldint.texinfo: Document new script generation. * emulparams/i386pe.sh (GENERATE_AUTO_IMPORT): Define. * emulparams/i386pe_posix.sh (GENERATE_AUTO_IMPORT): Define. * emulparams/i386pep.sh (GENERATE_AUTO_IMPORT): Define. * emultemp/pe.em (..._get_script): Support the use of the auto import script. * scripttempl/pe.sc: Put the .rdata input sections into the .data output section when creating an auto import script. * scripttempl/pep.sc: Likewise.
This commit is contained in:
17
ld/ChangeLog
17
ld/ChangeLog
@ -1,3 +1,20 @@
|
|||||||
|
2007-10-01 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR linker/4844
|
||||||
|
* genscript.sh: Add support for generating a .xa script for use
|
||||||
|
with the --auto-import option.
|
||||||
|
* ld.texinfo: Document the new behaviour of the --auto-import
|
||||||
|
option.
|
||||||
|
* ldint.texinfo: Document new script generation.
|
||||||
|
* emulparams/i386pe.sh (GENERATE_AUTO_IMPORT): Define.
|
||||||
|
* emulparams/i386pe_posix.sh (GENERATE_AUTO_IMPORT): Define.
|
||||||
|
* emulparams/i386pep.sh (GENERATE_AUTO_IMPORT): Define.
|
||||||
|
* emultemp/pe.em (..._get_script): Support the use of the auto
|
||||||
|
import script.
|
||||||
|
* scripttempl/pe.sc: Put the .rdata input sections into the .data
|
||||||
|
output section when creating an auto import script.
|
||||||
|
* scripttempl/pep.sc: Likewise.
|
||||||
|
|
||||||
2007-09-26 Brian Watt <bwatt@us.ibm.com>
|
2007-09-26 Brian Watt <bwatt@us.ibm.com>
|
||||||
|
|
||||||
* emultempl/spu_ovl.S: Add debug printf code.
|
* emultempl/spu_ovl.S: Add debug printf code.
|
||||||
|
@ -7,3 +7,4 @@ ENTRY="_mainCRTStartup"
|
|||||||
SUBSYSTEM=PE_DEF_SUBSYSTEM
|
SUBSYSTEM=PE_DEF_SUBSYSTEM
|
||||||
INITIAL_SYMBOL_CHAR=\"_\"
|
INITIAL_SYMBOL_CHAR=\"_\"
|
||||||
TARGET_PAGE_SIZE=0x1000
|
TARGET_PAGE_SIZE=0x1000
|
||||||
|
GENERATE_AUTO_IMPORT_SCRIPT=1
|
||||||
|
@ -8,3 +8,4 @@ SUBSYSTEM=7
|
|||||||
EXECUTABLE_NAME=a.out
|
EXECUTABLE_NAME=a.out
|
||||||
INITIAL_SYMBOL_CHAR=\"_\"
|
INITIAL_SYMBOL_CHAR=\"_\"
|
||||||
TARGET_PAGE_SIZE=0x1000
|
TARGET_PAGE_SIZE=0x1000
|
||||||
|
GENERATE_AUTO_IMPORT_SCRIPT=1
|
||||||
|
@ -7,3 +7,4 @@ ENTRY="_mainCRTStartup"
|
|||||||
SUBSYSTEM=PE_DEF_SUBSYSTEM
|
SUBSYSTEM=PE_DEF_SUBSYSTEM
|
||||||
INITIAL_SYMBOL_CHAR=\"_\"
|
INITIAL_SYMBOL_CHAR=\"_\"
|
||||||
TARGET_PAGE_SIZE=0x1000
|
TARGET_PAGE_SIZE=0x1000
|
||||||
|
GENERATE_AUTO_IMPORT_SCRIPT=1
|
||||||
|
@ -1891,6 +1891,10 @@ echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
|
|||||||
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
|
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
|
||||||
echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
|
echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
|
||||||
sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
|
sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
|
||||||
|
if test -n "$GENERATE_AUTO_IMPORT_SCRIPT" ; then
|
||||||
|
echo ' ; else if (link_info.pei386_auto_import == 1) return' >> e${EMULATION_NAME}.c
|
||||||
|
sed $sc ldscripts/${EMULATION_NAME}.xa >> e${EMULATION_NAME}.c
|
||||||
|
fi
|
||||||
echo ' ; else return' >> e${EMULATION_NAME}.c
|
echo ' ; else return' >> e${EMULATION_NAME}.c
|
||||||
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
|
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
|
||||||
echo '; }' >> e${EMULATION_NAME}.c
|
echo '; }' >> e${EMULATION_NAME}.c
|
||||||
|
@ -1659,6 +1659,10 @@ echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
|
|||||||
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
|
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
|
||||||
echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
|
echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
|
||||||
sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
|
sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
|
||||||
|
if test -n "$GENERATE_AUTO_IMPORT_SCRIPT" ; then
|
||||||
|
echo ' ; else if (link_info.pei386_auto_import == 1) return' >> e${EMULATION_NAME}.c
|
||||||
|
sed $sc ldscripts/${EMULATION_NAME}.xa >> e${EMULATION_NAME}.c
|
||||||
|
fi
|
||||||
echo ' ; else return' >> e${EMULATION_NAME}.c
|
echo ' ; else return' >> e${EMULATION_NAME}.c
|
||||||
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
|
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
|
||||||
echo '; }' >> e${EMULATION_NAME}.c
|
echo '; }' >> e${EMULATION_NAME}.c
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
# sun3.xc [used when the linker is invoked with "-z combreloc"]
|
# sun3.xc [used when the linker is invoked with "-z combreloc"]
|
||||||
# sun3.xsc [used when the linker is invoked with "--shared"]
|
# sun3.xsc [used when the linker is invoked with "--shared"]
|
||||||
# sun3.xdc [used when the linker is invoked with "-pie"]
|
# sun3.xdc [used when the linker is invoked with "-pie"]
|
||||||
|
# sun3.xa [used when the linker is invoked with "--enable-auto-import"]
|
||||||
#
|
#
|
||||||
# It also produced the C source file:
|
# It also produced the C source file:
|
||||||
#
|
#
|
||||||
@ -386,6 +387,16 @@ if test -n "$GENERATE_PIE_SCRIPT"; then
|
|||||||
unset CREATE_PIE
|
unset CREATE_PIE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -n "$GENERATE_AUTO_IMPORT_SCRIPT"; then
|
||||||
|
LD_FLAG=auto_import
|
||||||
|
DATA_ALIGNMENT=${DATA_ALIGNMENT_}
|
||||||
|
(
|
||||||
|
echo "/* Script for ld --enable-auto-import: Like the default script except read only data is placed into .data */"
|
||||||
|
. ${CUSTOMIZER_SCRIPT} ${EMULATION_NAME}
|
||||||
|
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
|
||||||
|
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xa
|
||||||
|
fi
|
||||||
|
|
||||||
case " $EMULATION_LIBPATH " in
|
case " $EMULATION_LIBPATH " in
|
||||||
*" ${EMULATION_NAME} "*) COMPILE_IN=true;;
|
*" ${EMULATION_NAME} "*) COMPILE_IN=true;;
|
||||||
esac
|
esac
|
||||||
|
@ -1568,15 +1568,15 @@ at link time. Searching @option{-rpath} in this way is only supported
|
|||||||
by native linkers and cross linkers which have been configured with
|
by native linkers and cross linkers which have been configured with
|
||||||
the @option{--with-sysroot} option.
|
the @option{--with-sysroot} option.
|
||||||
@item
|
@item
|
||||||
On an ELF system, if the @option{-rpath} and @code{rpath-link} options
|
On an ELF system, for native linkers, if the @option{-rpath} and
|
||||||
were not used, search the contents of the environment variable
|
@option{-rpath-link} options were not used, search the contents of the
|
||||||
@code{LD_RUN_PATH}. It is for the native linker only.
|
environment variable @code{LD_RUN_PATH}.
|
||||||
@item
|
@item
|
||||||
On SunOS, if the @option{-rpath} option was not used, search any
|
On SunOS, if the @option{-rpath} option was not used, search any
|
||||||
directories specified using @option{-L} options.
|
directories specified using @option{-L} options.
|
||||||
@item
|
@item
|
||||||
For a native linker, the contents of the environment variable
|
For a native linker, the search the contents of the environment
|
||||||
@code{LD_LIBRARY_PATH}.
|
variable @code{LD_LIBRARY_PATH}.
|
||||||
@item
|
@item
|
||||||
For a native ELF linker, the directories in @code{DT_RUNPATH} or
|
For a native ELF linker, the directories in @code{DT_RUNPATH} or
|
||||||
@code{DT_RPATH} of a shared library are searched for shared
|
@code{DT_RPATH} of a shared library are searched for shared
|
||||||
@ -2220,6 +2220,12 @@ building the import libraries with those DATA exports. Note: Use of the
|
|||||||
to be made writable. This does not conform to the PE-COFF format
|
to be made writable. This does not conform to the PE-COFF format
|
||||||
specification published by Microsoft.
|
specification published by Microsoft.
|
||||||
|
|
||||||
|
Note - use of the 'auto-import' extension will also cause read only
|
||||||
|
data which would normally be placed into the .rdata section to be
|
||||||
|
placed into the .data section instead. This is in order to work
|
||||||
|
around a problem with consts that is described here:
|
||||||
|
http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
|
||||||
|
|
||||||
Using 'auto-import' generally will 'just work' -- but sometimes you may
|
Using 'auto-import' generally will 'just work' -- but sometimes you may
|
||||||
see this message:
|
see this message:
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ If @code{SCRIPT_NAME} is set to @var{script}, @code{genscripts.sh} will
|
|||||||
invoke @file{scripttempl/@var{script}.sc}.
|
invoke @file{scripttempl/@var{script}.sc}.
|
||||||
|
|
||||||
The @file{genscripts.sh} script will invoke the @file{scripttempl}
|
The @file{genscripts.sh} script will invoke the @file{scripttempl}
|
||||||
script 5 to 8 times. Each time it will set the shell variable
|
script 5 to 9 times. Each time it will set the shell variable
|
||||||
@code{LD_FLAG} to a different value. When the linker is run, the
|
@code{LD_FLAG} to a different value. When the linker is run, the
|
||||||
options used will direct it to select a particular script. (Script
|
options used will direct it to select a particular script. (Script
|
||||||
selection is controlled by the @code{get_script} emulation entry point;
|
selection is controlled by the @code{get_script} emulation entry point;
|
||||||
@ -292,6 +292,13 @@ this value if @code{GENERATE_COMBRELOC_SCRIPT} is defined in the
|
|||||||
The @file{emultempl} script must arrange to use this script at the
|
The @file{emultempl} script must arrange to use this script at the
|
||||||
appropriate time, normally when the linker is invoked with the @code{-shared
|
appropriate time, normally when the linker is invoked with the @code{-shared
|
||||||
-z combreloc} option. The output has an extension of @file{.xsc}.
|
-z combreloc} option. The output has an extension of @file{.xsc}.
|
||||||
|
@item auto_import
|
||||||
|
The @file{scripttempl} script is only invoked with @code{LD_FLAG} set to
|
||||||
|
this value if @code{GENERATE_AUTO_IMPORT_SCRIPT} is defined in the
|
||||||
|
@file{emulparams} file. The @file{emultempl} script must arrange to
|
||||||
|
use this script at the appropriate time, normally when the linker is
|
||||||
|
invoked with the @code{--enable-auto-import} option. The output has
|
||||||
|
an extension of @file{.xa}.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
Besides the shell variables set by the @file{emulparams} script, and the
|
Besides the shell variables set by the @file{emulparams} script, and the
|
||||||
|
@ -13,8 +13,16 @@ fi
|
|||||||
# use grouped sections instead).
|
# use grouped sections instead).
|
||||||
if test "${RELOCATING}"; then
|
if test "${RELOCATING}"; then
|
||||||
R_TEXT='*(SORT(.text$*))'
|
R_TEXT='*(SORT(.text$*))'
|
||||||
|
if test "x$LD_FLAG" = "xauto_import" ; then
|
||||||
|
R_DATA='*(SORT(.data$*))
|
||||||
|
*(.rdata)
|
||||||
|
*(SORT(.rdata$*))'
|
||||||
|
R_RDATA=''
|
||||||
|
else
|
||||||
R_DATA='*(SORT(.data$*))'
|
R_DATA='*(SORT(.data$*))'
|
||||||
R_RDATA='*(SORT(.rdata$*))'
|
R_RDATA='*(.rdata)
|
||||||
|
*(SORT(.rdata$*))'
|
||||||
|
fi
|
||||||
R_IDATA='
|
R_IDATA='
|
||||||
SORT(*)(.idata$2)
|
SORT(*)(.idata$2)
|
||||||
SORT(*)(.idata$3)
|
SORT(*)(.idata$3)
|
||||||
@ -37,7 +45,7 @@ if test "${RELOCATING}"; then
|
|||||||
else
|
else
|
||||||
R_TEXT=
|
R_TEXT=
|
||||||
R_DATA=
|
R_DATA=
|
||||||
R_RDATA=
|
R_RDATA='*(.rdata)'
|
||||||
R_IDATA=
|
R_IDATA=
|
||||||
R_CRT=
|
R_CRT=
|
||||||
R_RSRC=
|
R_RSRC=
|
||||||
@ -93,7 +101,6 @@ SECTIONS
|
|||||||
|
|
||||||
.rdata ${RELOCATING+BLOCK(__section_alignment__)} :
|
.rdata ${RELOCATING+BLOCK(__section_alignment__)} :
|
||||||
{
|
{
|
||||||
*(.rdata)
|
|
||||||
${R_RDATA}
|
${R_RDATA}
|
||||||
${RELOCATING+ *(.eh_frame)}
|
${RELOCATING+ *(.eh_frame)}
|
||||||
${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = .;}
|
${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = .;}
|
||||||
|
@ -13,8 +13,16 @@ fi
|
|||||||
# use grouped sections instead).
|
# use grouped sections instead).
|
||||||
if test "${RELOCATING}"; then
|
if test "${RELOCATING}"; then
|
||||||
R_TEXT='*(SORT(.text$*))'
|
R_TEXT='*(SORT(.text$*))'
|
||||||
|
if test "x$LD_FLAG" = "xauto_import" ; then
|
||||||
|
R_DATA='*(SORT(.data$*))
|
||||||
|
*(.rdata)
|
||||||
|
*(SORT(.rdata$*))'
|
||||||
|
R_RDATA=''
|
||||||
|
else
|
||||||
R_DATA='*(SORT(.data$*))'
|
R_DATA='*(SORT(.data$*))'
|
||||||
R_RDATA='*(SORT(.rdata$*))'
|
R_RDATA='*(.rdata)
|
||||||
|
*(SORT(.rdata$*))'
|
||||||
|
fi
|
||||||
R_IDATA='
|
R_IDATA='
|
||||||
SORT(*)(.idata$2)
|
SORT(*)(.idata$2)
|
||||||
SORT(*)(.idata$3)
|
SORT(*)(.idata$3)
|
||||||
@ -37,7 +45,7 @@ if test "${RELOCATING}"; then
|
|||||||
else
|
else
|
||||||
R_TEXT=
|
R_TEXT=
|
||||||
R_DATA=
|
R_DATA=
|
||||||
R_RDATA=
|
R_RDATA='*(.rdata)'
|
||||||
R_IDATA=
|
R_IDATA=
|
||||||
R_CRT=
|
R_CRT=
|
||||||
R_RSRC=
|
R_RSRC=
|
||||||
@ -93,7 +101,6 @@ SECTIONS
|
|||||||
|
|
||||||
.rdata ${RELOCATING+BLOCK(__section_alignment__)} :
|
.rdata ${RELOCATING+BLOCK(__section_alignment__)} :
|
||||||
{
|
{
|
||||||
*(.rdata)
|
|
||||||
${R_RDATA}
|
${R_RDATA}
|
||||||
${RELOCATING+ *(.eh_frame)}
|
${RELOCATING+ *(.eh_frame)}
|
||||||
${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = .;}
|
${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = .;}
|
||||||
|
Reference in New Issue
Block a user