This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Enable 0x10 alignment for aarch64 symbols as is done for x86_64


Sorry about being vague, yes you are correct I mean sections not symbols.
I have put in alot of printf's to figure out whats going on though and
I compare outputs when linking for aarch64 and x86_64.

The 0x10 alignment I am talking about is that in the

void Output_section::set_final_data_size() {

function within output.cc which then calls in a for loop iterating
over all elements in "this->input_sections()"

void Output_section::Input_section::set_address_and_file_offset(
    uint64_t address,
    off_t file_offset,
    off_t section_file_offset)
{

The x86_64 linking prints show me that there are extra sections within
the list that are not input sections (from the if statement
is_input_section() that has a size that pads the next section to be
0x10 aligned.
On the other hand aarch64 linking prints show me that these extra
sections are not present when linking for aarch64, thus not being 0x10
aligned.

I'm trying to find where in gold these extra sections are put into the
input_sections_ list.
I see where the symbols are initially grabbed from the object files
with no extra "padding sections"

Can you tell me where this decision for putting in extra padding
sections happens?

Regards,

Chris

On Thu, Apr 16, 2015 at 4:30 PM, Cary Coutant <ccoutant@gmail.com> wrote:
>> I am currently utilizing gold to align program symbols as well as
>> library symbols of newlib into the binary I am producing.
>>
>> I see that symbols are grabbed from object files and stored in Symtab
>> (this->table_) without the 0x10 alignment and then get lost in the
>> code until they are already in Output_section::Input_section_list
>> (this->input_sections) where their final address is set (using
>> function set_address_and_file_offset)WITH an alignment to make sure
>> the next symbol is mod 16 (0x10)
>>
>> Where is this non-input section element being placed into the
>> input_sections_list???
>>
>> I realize there are arch specific files (aarch64.cc, x86_64.cc) but
>> cannot find where this 0x10 offset or additional padding option is
>> within the x86_64.cc file
>>
>> Any help would be nice. Thank you for your time in advance!
>
> I'm going to need a little more information about what you're trying
> to do. I don't know what you are referring to when you say "this
> non-input section element". And what "0x10 alignment" are you talking
> about?
>
> Symbols don't have an alignment; sections do. When we layout an input
> section, we adjust its offset within the output section to the
> required alignment, and also adjust the output section's alignment to
> the largest required alignment of its input sections. Symbols (except
> for absolute symbols) merely have a value relative to the input
> section where they are defined.
>
> -cary


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]