aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2019-04-10 18:36:05 -0700
committerH.J. Lu <hjl.tools@gmail.com>2019-04-10 18:36:22 -0700
commit795e3bb7de9ce2eb1ec3de3faf8f6bc925a58c9e (patch)
treee4ea81ab3b4c6d6168fcde00cca9679c8286d0f6
parent3f52fdbcb599f76b4838020721ca6c9f1cc28f84 (diff)
downloadgdb-795e3bb7de9ce2eb1ec3de3faf8f6bc925a58c9e.zip
gdb-795e3bb7de9ce2eb1ec3de3faf8f6bc925a58c9e.tar.gz
gdb-795e3bb7de9ce2eb1ec3de3faf8f6bc925a58c9e.tar.bz2
ld: Don't define __rel[a]_iplt_start/__rel[a]_iplt_end in PIE
__rel[a]_iplt_start and __rel[a]_iplt_end are defined to handle IFUNC in static executables. For PIE, since IFUNC is handled as the part of the normal dynamic relocation processing, there is no need to define these symbols in PIE. * scripttempl/elf.sc (CREATE_PIC): New. Set for CREATE_SHLIB or CREATE_PIE. (__rel_iplt_start): Don't define for CREATE_PIC. (__rel_iplt_end): Likewise. (__rela_iplt_start): Likewise. (__rela_iplt_end): Likewise.
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/scripttempl/elf.sc17
2 files changed, 18 insertions, 8 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index be95a21..4abb467 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2019-04-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * scripttempl/elf.sc (CREATE_PIC): New. Set for CREATE_SHLIB or
+ CREATE_PIE.
+ (__rel_iplt_start): Don't define for CREATE_PIC.
+ (__rel_iplt_end): Likewise.
+ (__rela_iplt_start): Likewise.
+ (__rela_iplt_end): Likewise.
+
2019-04-10 Alan Modra <amodra@gmail.com>
* testsuite/ld-elf/shared.exp: Don't xfail PR ld/20995 for
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index bd75841..f9f0f7d 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -109,6 +109,7 @@ else
FILL=
fi
+test -n "$CREATE_SHLIB$CREATE_PIE" && CREATE_PIC=" "
test -z "$RODATA_NAME" && RODATA_NAME=rodata
test -z "$SDATA_NAME" && SDATA_NAME=sdata
test -z "$SBSS_NAME" && SBSS_NAME=sbss
@@ -160,15 +161,15 @@ REL_IFUNC=".rel.ifunc ${RELOCATING-0} : { *(.rel.ifunc) }"
RELA_IFUNC=".rela.ifunc ${RELOCATING-0} : { *(.rela.ifunc) }"
REL_IPLT=".rel.iplt ${RELOCATING-0} :
{
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}
*(.rel.iplt)
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}
}"
RELA_IPLT=".rela.iplt ${RELOCATING-0} :
{
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}
*(.rela.iplt)
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}
}"
DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
@@ -463,16 +464,16 @@ cat >> ldscripts/dyntmp.$$ <<EOF
.rel.plt ${RELOCATING-0} :
{
*(.rel.plt)
- ${IREL_IN_PLT+${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}}
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}}
${IREL_IN_PLT+${RELOCATING+*(.rel.iplt)}}
- ${IREL_IN_PLT+${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}}
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}}
}
.rela.plt ${RELOCATING-0} :
{
*(.rela.plt)
- ${IREL_IN_PLT+${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}}
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}}
${IREL_IN_PLT+${RELOCATING+*(.rela.iplt)}}
- ${IREL_IN_PLT+${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}}
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}}
}
${OTHER_PLT_RELOC_SECTIONS}
EOF