aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2012-12-18 20:42:43 +0000
committerRoland McGrath <roland@gnu.org>2012-12-18 20:42:43 +0000
commit9d5777a34cbf1c1497e1c76f455381a643dfd2b1 (patch)
tree5afc8b030a3c49c0abad86312ca5a052870a35bc /ld/scripttempl
parentd8a4f9280adc96f46d63bbdbfd089fc9c7c30b3e (diff)
downloadgdb-9d5777a34cbf1c1497e1c76f455381a643dfd2b1.zip
gdb-9d5777a34cbf1c1497e1c76f455381a643dfd2b1.tar.gz
gdb-9d5777a34cbf1c1497e1c76f455381a643dfd2b1.tar.bz2
ld/
* ld.texinfo (Options): Describe -Trodata-segment. * ldlex.h (enum option_values): Add OPTION_TRODATA_SEGMENT. * lexsup.c (ld_options, parse_args): Handle -Trodata-segment. * scripttempl/elf.sc (RODATA_ADDR, SHLIB_RODATA_ADDR): Wrap SEGMENT_START("rodata-segment", ...) + SIZEOF_HEADERS around the value.
Diffstat (limited to 'ld/scripttempl')
-rw-r--r--ld/scripttempl/elf.sc24
1 files changed, 19 insertions, 5 deletions
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index 72d2af7..cb162e8 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -492,12 +492,26 @@ cat <<EOF
EOF
if test -n "${SEPARATE_CODE}"; then
+ if test -n "${RODATA_ADDR}"; then
+ RODATA_ADDR="\
+SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR}) + SIZEOF_HEADERS"
+ else
+ RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))}"
+ RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR})"
+ fi
+ if test -n "${SHLIB_RODATA_ADDR}"; then
+ SHLIB_RODATA_ADDR="\
+SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS"
+ else
+ SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})"
+ SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
+ fi
cat <<EOF
/* Adjust the address for the rodata segment. We want to adjust up to
the same address within the page on the next page up. */
- ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${RODATA_ADDR-ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))};}}}
- ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_RODATA_ADDR-ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))};}}
- ${CREATE_PIE+${RELOCATING+. = ${SHLIB_RODATA_ADDR-ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))};}}
+ ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${RODATA_ADDR};}}}
+ ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_RODATA_ADDR};}}
+ ${CREATE_PIE+${RELOCATING+. = ${SHLIB_RODATA_ADDR};}}
EOF
emit_early_ro
emit_dyn
@@ -650,8 +664,8 @@ cat <<EOF
.debug_ranges 0 : { *(.debug_ranges) }
/* DWARF Extension. */
- .debug_macro 0 : { *(.debug_macro) }
-
+ .debug_macro 0 : { *(.debug_macro) }
+
${TINY_DATA_SECTION}
${TINY_BSS_SECTION}