aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-08-13 02:08:26 +0000
committerAlan Modra <amodra@gmail.com>2002-08-13 02:08:26 +0000
commitc553bb910d30224f6d5e1e10a67a839093e97fa0 (patch)
tree52c723c7b8b604e0ecff9ffe0ca914faf69e074f /ld
parent8e7157081c0a1cee57d160591c2c50f9e0c145e3 (diff)
downloadgdb-c553bb910d30224f6d5e1e10a67a839093e97fa0.zip
gdb-c553bb910d30224f6d5e1e10a67a839093e97fa0.tar.gz
gdb-c553bb910d30224f6d5e1e10a67a839093e97fa0.tar.bz2
* emulparams/elf32_dlx.sh (TARGET_PAGE_SIZE): Set to 1.
(MAXPAGESIZE): Set to 1. * ld.h (ALIGN_N): Delete. * ldexp.h (align_n): Declare. * ldexp.c (align_n): New function. (fold_binary): Use align_n instead of ALIGN_N. (exp_fold_tree): Likewise. * ldlang.c (lang_size_sections_1): Likewise. (lang_one_common): Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog13
-rw-r--r--ld/emulparams/elf32_dlx.sh4
-rw-r--r--ld/ld.h8
-rw-r--r--ld/ldexp.c19
-rw-r--r--ld/ldexp.h1
-rw-r--r--ld/ldlang.c7
6 files changed, 34 insertions, 18 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 5c6c8cc..2801a99 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,16 @@
+2002-08-13 Alan Modra <amodra@bigpond.net.au>
+
+ * emulparams/elf32_dlx.sh (TARGET_PAGE_SIZE): Set to 1.
+ (MAXPAGESIZE): Set to 1.
+
+ * ld.h (ALIGN_N): Delete.
+ * ldexp.h (align_n): Declare.
+ * ldexp.c (align_n): New function.
+ (fold_binary): Use align_n instead of ALIGN_N.
+ (exp_fold_tree): Likewise.
+ * ldlang.c (lang_size_sections_1): Likewise.
+ (lang_one_common): Likewise.
+
2002-07-31 Graeme Peterson <gp@qnx.com>
* configure.tgt: Add support for powerpc{le}-*-nto* targets.
diff --git a/ld/emulparams/elf32_dlx.sh b/ld/emulparams/elf32_dlx.sh
index a3e2f46..d3ff81c 100644
--- a/ld/emulparams/elf32_dlx.sh
+++ b/ld/emulparams/elf32_dlx.sh
@@ -4,6 +4,6 @@ OUTPUT_FORMAT="elf32-dlx"
ARCH=dlx
MACHINE=
TEXT_START_ADDR=0
-TARGET_PAGE_SIZE=0
+TARGET_PAGE_SIZE=1
EMBEDDED=yes
-MAXPAGESIZE=0
+MAXPAGESIZE=1
diff --git a/ld/ld.h b/ld/ld.h
index 12f3f69..438e00d 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -91,14 +91,6 @@ typedef struct user_section_struct {
#define LONG_SIZE (4)
#define QUAD_SIZE (8)
-/* ALIGN macro changed to ALIGN_N to avoid */
-/* conflict in /usr/include/machine/machparam.h */
-/* WARNING: If THIS is a 64 bit address and BOUNDARY is a 32 bit int,
- you must coerce boundary to the same type as THIS.
- ??? Is there a portable way to avoid this. */
-#define ALIGN_N(this, boundary) \
- ((( (this) + ((boundary) -1)) & (~((boundary)-1))))
-
typedef struct {
/* 1 => assign space to common symbols even if `relocatable_output'. */
boolean force_common_definition;
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 3beb4cf..8e3ea63 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -350,7 +350,7 @@ fold_binary (tree, current_section, allocation_done, dot, dotp)
{
bfd_vma maxpage = result.value;
- result.value = ALIGN_N (dot, maxpage);
+ result.value = align_n (dot, maxpage);
if (exp_data_seg.phase != exp_dataseg_adjust)
{
result.value += dot & (maxpage - 1);
@@ -593,14 +593,14 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
{
case ALIGN_K:
if (allocation_done != lang_first_phase_enum)
- result = new_rel_from_section (ALIGN_N (dot, result.value),
+ result = new_rel_from_section (align_n (dot, result.value),
current_section);
else
result.valid_p = false;
break;
case ABSOLUTE:
- if (allocation_done != lang_first_phase_enum && result.valid_p)
+ if (allocation_done != lang_first_phase_enum)
{
result.value += result.section->bfd_section->vma;
result.section = abs_output_section;
@@ -629,7 +629,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
if (allocation_done == lang_allocating_phase_enum)
{
make_abs (&result);
- result.value = ALIGN_N (dot, result.value);
+ result.value = align_n (dot, result.value);
}
else
result.valid_p = false;
@@ -1127,3 +1127,14 @@ exp_get_abs_int (tree, def, name, allocation_done)
return res.value;
}
+
+bfd_vma align_n (value, align)
+ bfd_vma value;
+ bfd_vma align;
+{
+ if (align <= 1)
+ return value;
+
+ value = (value + align - 1) / align;
+ return value * align;
+}
diff --git a/ld/ldexp.h b/ld/ldexp.h
index edf335d..3f3508e 100644
--- a/ld/ldexp.h
+++ b/ld/ldexp.h
@@ -122,5 +122,6 @@ int exp_get_value_int PARAMS ((etree_type *, int, char *, lang_phase_type));
fill_type *exp_get_fill PARAMS ((etree_type *, fill_type *, char *,
lang_phase_type));
bfd_vma exp_get_abs_int PARAMS ((etree_type *, int, char *, lang_phase_type));
+bfd_vma align_n PARAMS ((bfd_vma, bfd_vma));
#endif
diff --git a/ld/ldlang.c b/ld/ldlang.c
index a777e5a..79de098 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -3047,9 +3047,8 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
/* Put the section within the requested block size, or
align at the block boundary. */
- after = ALIGN_N (os->bfd_section->vma
+ after = align_n (os->bfd_section->vma
+ os->bfd_section->_raw_size / opb,
- /* The coercion here is important, see ld.h. */
(bfd_vma) os->block_value);
if (bfd_is_abs_section (os->bfd_section))
@@ -3748,8 +3747,8 @@ lang_one_common (h, info)
section = h->u.c.p->section;
/* Increase the size of the section. */
- section->_cooked_size = ALIGN_N ((section->_cooked_size + opb - 1) / opb,
- (bfd_size_type) (1 << power_of_two)) * opb;
+ section->_cooked_size = align_n ((section->_cooked_size + opb - 1) / opb,
+ (bfd_vma) 1 << power_of_two) * opb;
/* Adjust the alignment if necessary. */
if (power_of_two > section->alignment_power)