From: Alan Modra Date: Tue, 13 Aug 2002 02:08:26 +0000 (+0000) Subject: * emulparams/elf32_dlx.sh (TARGET_PAGE_SIZE): Set to 1. X-Git-Tag: drow-cplus-branchpoint~840 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c553bb910d30224f6d5e1e10a67a839093e97fa0;p=external%2Fbinutils.git * 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. --- 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 + + * 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 * 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)