[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/20984] New: different DOT value in the 'same' place
From: |
pangbw at gmail dot com |
Subject: |
[Bug binutils/20984] New: different DOT value in the 'same' place |
Date: |
Wed, 21 Dec 2016 01:31:55 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=20984
Bug ID: 20984
Summary: different DOT value in the 'same' place
Product: binutils
Version: 2.22
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: pangbw at gmail dot com
Target Milestone: ---
Created attachment 9708
--> https://sourceware.org/bugzilla/attachment.cgi?id=9708&action=edit
linker script
Steps to show the issue:
1. cat t.c
#include <stdio.h>
extern char tdata_size [];
extern char tdata_tbss_size [];
extern char tdata_tbss_size2 [];
extern char tdata_tbss_size3 [];
__thread int tls = 0;
int main()
{
printf("Hello DOT. %d %d %d %d\n",
tdata_size, tdata_tbss_size, tdata_tbss_size2, tdata_tbss_size3);
return 0;
}
2. tdata_size, tdata_tbss_size, tdata_tbss_size2 and tdata_tbss_size3 are
defined in the attached link script x.link:
tdata_start = .;
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
tdata_size = . - tdata_start;
.tbss : {
*(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
tbss_end = .;
}
tdata_tbss_size = . - tdata_start;
tdata_tbss_size2 = tbss_end - tdata_start;
tdata_tbss_size3 = SIZEOF(.tdata) + SIZEOF(.tbss);
3. gcc -static t.c -Wl,-T x.link
4. ./a.out
Hello DOT. 34 34 90 88
I got this result on Ubuntu precise (12.04.5 LTS), also got the slightly
different result on another different Linux host.
I can understand the difference between tdata_tbss_size2 and tdata_tbss_size3
is caused by alignment, but why tdata_tbss_size is different than
tdata_tbss_size2?
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/20984] New: different DOT value in the 'same' place,
pangbw at gmail dot com <=