Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Hiroyuki Machida <machida@sm.sony.co.jp>
To: ian@zembu.com
Cc: kk@ddeorg.soft.net, binutils@sourceware.cygnus.com,
	linux@cthulhu.engr.sgi.com, debian-mips@lists.debian.org
Subject: Re: MIPS gas problem
Date: Fri, 21 Apr 2000 12:30:14 +0900	[thread overview]
Message-ID: <20000421123014J.machida@sm.sony.co.jp> (raw)
In-Reply-To: <20000420164812.17210.qmail@daffy.airs.com>


Hi Ian,

From: Ian Lance Taylor <ian@zembu.com>
Subject: Re: MIPS gas problem
Date: 20 Apr 2000 09:48:12 -0700

>    [~] gcc -c  rotest.c -o rotest.o
>    rotest.c:8: warning: alignment of `global1' is greater than maximum object 
>    file alignment. Using 8.

This message is a gcc issue, as you said. 

But, my reported plobelm is really binutils issue. Sorry to confuse
you. I will describe the problem using only asm file, again. 

Assmbling and linking attached al.S, I got the following result.

% cc -o al -save-temps al.S

% nm al.o | grep global
0000000000000400 R global1
0000000000001000 R global2
0000000000000000 R globalc

% nm al | grep global
0000000000400dc0 R global1
00000000004019c0 R global2
00000000004009c0 R globalc

Alignments of global1 and global2  in "al.o" looks good. But in "al" 
not.

% objdump -h al.o | grep rodata
  5 .rodata       00001010  0000000000000000  0000000000000000 00000250  2**4

% objdump -h al | grep rodata
  9 .rodata       00001010  00000000004009c0  00000000004009c0 000009c0  2**4


I think when ld gathers read only section, the alignment will be broken.
Because .rodata section alignment of al.o is not the maximum rodata
object's alignment value(in this case 2**12).

I tracked down and found that s_change_sec():gas/config/tc-mips.c
resets section alignment to 2**4. 
So, the maximum rodata object's alignment value will be lost in the
following sequence. 

	.rdata		// reset  section-alignment to 2**4
	.algin	10	// update section-alignment to 2**10
        .type    global1,@object;
        .size    global1,4;
global1:
        .word   0;

	.rdata		// reset  section-alignment to 2**4, Why??
	.align	2	// not update ( 2 <= current section-alignment)
string:
        .ascii  "test\n"
	

I want to know the reason why s_change_sec() always reset
section-alignment to 2**4. I think this is wrong.



--- al.S
        .abicalls

        .globl  globalc;
        .rdata;
        .type    globalc,@object;
        .size    globalc,1;
globalc:
        .byte   97;

// rodata aligned 10 (1024)
        .globl  global1;
        .align  10;
        .type    global1,@object;
        .size    global1,4;
global1:
        .word   0;

// rodata aligned 12 (4096)
        .globl  global2;
        .align  12;
        .type    global2,@object;
        .size    global2,4;
global2:
        .word   1;

// data
        .globl  total_ng
        .data
        .align  2
        .type    total_ng,@object
        .size    total_ng,4
total_ng:
        .word   0

// rodata again
        .rdata
        .align  2
string:
        .ascii  "test\n"
        .text
        .align  3
        .globl  main
        .ent    main
main:
        nop;
        nop
        nop
        .end main
--- endof al.S

---
Hiroyuki Machida
Creative Station		SCE Inc./Sony Corp.

  parent reply	other threads:[~2000-04-21  3:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-20  2:13 MIPS gas problem Hiroyuki Machida
2000-04-20 10:16 ` Florian Lohoff
2000-04-20 12:07 ` Koundinya.K
     [not found]   ` <20000420164812.17210.qmail@daffy.airs.com>
2000-04-21  1:52     ` Hiroyuki Machida
2000-04-24  5:06       ` Koundinya.K
2000-04-21  3:30     ` Hiroyuki Machida [this message]
     [not found]       ` <20000421154859.3820.qmail@daffy.airs.com>
2000-04-24  3:16         ` Hiroyuki Machida
2000-04-24  3:16           ` Hiroyuki Machida

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000421123014J.machida@sm.sony.co.jp \
    --to=machida@sm.sony.co.jp \
    --cc=binutils@sourceware.cygnus.com \
    --cc=debian-mips@lists.debian.org \
    --cc=ian@zembu.com \
    --cc=kk@ddeorg.soft.net \
    --cc=linux@cthulhu.engr.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox