diff options
author | Alan Modra <amodra@gmail.com> | 2002-05-23 08:08:48 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-05-23 08:08:48 +0000 |
commit | 18e1d4877373547c80bd8ac79a7884390f95f4a9 (patch) | |
tree | 54dc8c8f5a258a3981dd58f51b324f800359aa5c /gas/config/obj-ieee.c | |
parent | 9d66a1d9d68238024e4accd78e82f3432c6292af (diff) | |
download | gdb-18e1d4877373547c80bd8ac79a7884390f95f4a9.zip gdb-18e1d4877373547c80bd8ac79a7884390f95f4a9.tar.gz gdb-18e1d4877373547c80bd8ac79a7884390f95f4a9.tar.bz2 |
* write.c (size_seg): Check adjustment to last frag.
(SUB_SEGMENT_ALIGN): If HANDLE_ALIGN defined, pad out last frag to
section alignment.
* config/obj-coff.c (SUB_SEGMENT_ALIGN): Likewise.
* config/obj-ieee.c (SUB_SEGMENT_ALIGN): Likewise.
(write_object_file): Invoke md_do_align if available, and use
frag_align_code on text sections.
* config/obj-vms.h (SUB_SEGMENT_ALIGN): Now two args.
* config/tc-m88k.h (SUB_SEGMENT_ALIGN): Likewise.
* config/tc-ppc.h (SUB_SEGMENT_ALIGN): Likewise.
* config/tc-sh.h (SUB_SEGMENT_ALIGN): Likewise.
* config/tc-i386.h (SUB_SEGMENT_ALIGN): Likewise. Define for
BFD_ASSEMBLER too.
Diffstat (limited to 'gas/config/obj-ieee.c')
-rw-r--r-- | gas/config/obj-ieee.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/gas/config/obj-ieee.c b/gas/config/obj-ieee.c index 505bb35..1846a92 100644 --- a/gas/config/obj-ieee.c +++ b/gas/config/obj-ieee.c @@ -493,6 +493,20 @@ obj_symbol_new_hook (symbolP) } #if 1 + +#ifndef SUB_SEGMENT_ALIGN +#ifdef HANDLE_ALIGN +/* The last subsegment gets an aligment corresponding to the alignment + of the section. This allows proper nop-filling at the end of + code-bearing sections. */ +#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) \ + (!(FRCHAIN)->frch_next || (FRCHAIN)->frch_next->frch_seg != (SEG) \ + ? get_recorded_alignment (SEG) : 0) +#else +#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 2 +#endif +#endif + extern void write_object_file () { @@ -512,20 +526,33 @@ write_object_file () subseg_set (1, 0); subseg_set (2, 0); subseg_set (3, 0); + + /* Run through all the sub-segments and align them up. Also + close any open frags. We tack a .fill onto the end of the + frag chain so that any .align's size can be worked by looking + at the next frag. */ for (frchain_ptr = frchain_root; frchain_ptr != (struct frchain *) NULL; frchain_ptr = frchain_ptr->frch_next) { - /* Run through all the sub-segments and align them up. Also - close any open frags. We tack a .fill onto the end of the - frag chain so that any .align's size can be worked by looking - at the next frag. */ + int alignment; subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg); -#ifndef SUB_SEGMENT_ALIGN -#define SUB_SEGMENT_ALIGN(SEG) 2 + + alignment = SUB_SEGMENT_ALIGN (now_seg, frchain_ptr) + +#ifdef md_do_align + md_do_align (alignment, (char *) NULL, 0, 0, alignment_done); +#endif + if (subseg_text_p (now_seg)) + frag_align_code (alignment, 0); + else + frag_align (alignment, 0, 0); + +#ifdef md_do_align + alignment_done: #endif - frag_align (SUB_SEGMENT_ALIGN (now_seg), 0, 0); + frag_wane (frag_now); frag_now->fr_fix = 0; know (frag_now->fr_next == NULL); |