[gold patch] Don't allocate space in file for BSS sections
Cary Coutant
ccoutant@google.com
Fri Apr 12 23:52:00 GMT 2013
In a relocatable link, gold is allocating file space for BSS sections.
This patch avoids that by testing for SHT_NOBITS when updating the
file offset.
Tested on x86_64. OK to apply?
-cary
gold/
* layout.cc (Layout::set_relocatable_section_offsets): Don't
allocate space in file for BSS sections.
-------------- next part --------------
gold/
* layout.cc (Layout::set_relocatable_section_offsets): Don't
allocate space in file for BSS sections.
commit 54024611e11e68d6107ed2e9f46839b1e892c116
Author: Cary Coutant <ccoutant@google.com>
Date: Fri Apr 12 16:49:21 2013 -0700
Don't allocate space in file for bss sections.
diff --git a/gold/layout.cc b/gold/layout.cc
index 8b88deaa..f2dc6da 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -3594,7 +3594,8 @@ Layout::set_relocatable_section_offsets(Output_data* file_header,
(*p)->set_address(0);
(*p)->set_file_offset(off);
(*p)->finalize_data_size();
- off += (*p)->data_size();
+ if ((*p)->type() != elfcpp::SHT_NOBITS)
+ off += (*p)->data_size();
(*p)->set_out_shndx(*pshndx);
++*pshndx;
More information about the Binutils
mailing list