diff options
author | Nick Clifton <nickc@redhat.com> | 2016-06-27 13:49:09 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-06-27 13:51:06 +0100 |
commit | 2edb36e77f3ff468eac2b2c8954e9c031148e724 (patch) | |
tree | f408bcf2dfebe45d565e12499f25b7dcc3c0f2f2 /gas/write.c | |
parent | c9301e31817019c38ab52da0e72fa1e3bf75332c (diff) | |
download | gdb-2edb36e77f3ff468eac2b2c8954e9c031148e724.zip gdb-2edb36e77f3ff468eac2b2c8954e9c031148e724.tar.gz gdb-2edb36e77f3ff468eac2b2c8954e9c031148e724.tar.bz2 |
Add command line option to stop the assembler from padding the end of sections to their alignment boundary.
PR gas/20247
* as.h (do_not_pad_sections_to_alignment): New global variable.
* as.c (show_usage): Add --no-pad-sections.
(parse_args): Likewise.
* write.c (size_seg): Skip padding the end of the section if
requested from the command line.
(SUB_SEGMENT_ALIGN): Likewise.
* doc/as.texinfo: Document the new option.
* NEWS: Mention the new feature.
* testsuite/gas/elf/section11.s: New test.
* testsuite/gas/elf/section11.d: New test driver.
* testsuite/gas/elf/elf.exp: Run the new test.
Diffstat (limited to 'gas/write.c')
-rw-r--r-- | gas/write.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gas/write.c b/gas/write.c index 0dfca0c..9af1f80 100644 --- a/gas/write.c +++ b/gas/write.c @@ -579,7 +579,12 @@ size_seg (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) x = bfd_set_section_flags (abfd, sec, flags); gas_assert (x); - newsize = md_section_align (sec, size); + /* If permitted, allow the backend to pad out the section + to some alignment boundary. */ + if (do_not_pad_sections_to_alignment) + newsize = size; + else + newsize = md_section_align (sec, size); x = bfd_set_section_size (abfd, sec, newsize); gas_assert (x); @@ -1696,7 +1701,7 @@ set_symtab (void) } /* Finish the subsegments. After every sub-segment, we fake an - ".align ...". This conforms to BSD4.2 brane-damage. We then fake + ".align ...". This conforms to BSD4.2 brain-damage. We then fake ".fill 0" because that is the kind of frag that requires least thought. ".align" frags like to have a following frag since that makes calculating their intended length trivial. */ @@ -1708,6 +1713,7 @@ set_symtab (void) code-bearing sections. */ #define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) \ (!(FRCHAIN)->frch_next && subseg_text_p (SEG) \ + && !do_not_pad_sections_to_alignment \ ? get_recorded_alignment (SEG) \ : 0) #else |