public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "David Mosberger-Tang" <dmosberger@gmail.com>
To: linux-ia64@vger.kernel.org
Subject: Re: need NOTES in vmlinux.lds.S
Date: Thu, 09 Aug 2007 17:53:15 +0000	[thread overview]
Message-ID: <ed5aea430708091053h11b8fbd6pd88d7bed31823535@mail.gmail.com> (raw)
In-Reply-To: <ed5aea430708082330o7277cb2el89c7b89f120c9643@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3260 bytes --]

On 8/9/07, Roland McGrath <roland@redhat.com> wrote:
> That placement is probably fine (the standard size is 36 bytes, so don't
> fret too much about how optimal its location is).  Since ia64 has an
> explicit PHDRS, it would be ideal to add there a "note PT_NOTE" and then use:
>
>         NOTES :code :note
>         code_continues : { } :code
>
> Instead of the second line you can append :code to the next brace group.
> (Without one or the other, the following sections will also be included in
> the size of the PT_NOTE segment.)
>
> Adding the PT_NOTE phdr is not essential, but it keeps vmlinux holding to
> that standard ELF convention, and it's what the other machines do.

Sure, that sounds reasonable.  Updated patch attached.

I tried this patch with Linus' 2.6.23-rc2 tree and the resulting
kernel boots fine, though there are some scary-looking error messages:

WARNING: at /data/sc/linux-2.6/kernel/irq/resend.c:70 check_irq_resend()

Call Trace:
 [<a0000001000132e0>] show_stack+0x80/0xa0
                                sp=e00000407ff97bc0 bsp=e00000407ff90f58
 [<a000000100013330>] dump_stack+0x30/0x60
                                sp=e00000407ff97d90 bsp=e00000407ff90f40
 [<a0000001000db860>] check_irq_resend+0x1e0/0x200
                                sp=e00000407ff97d90 bsp=e00000407ff90ef8
 [<a0000001000dadd0>] enable_irq+0x210/0x240
                                sp=e00000407ff97d90 bsp=e00000407ff90ec8
 [<a0000001004f9aa0>] probe_hwif+0x440/0x1800
                                sp=e00000407ff97d90 bsp=e00000407ff90db0
 [<a0000001004fc7d0>] probe_hwif_init_with_fixup+0x30/0x180
                                sp=e00000407ff97d90 bsp=e00000407ff90d80
 [<a0000001005037c0>] ide_setup_pci_device+0x160/0x1c0
                                sp=e00000407ff97d90 bsp=e00000407ff90d40
 [<a0000001004e2670>] init_setup_cmd64x+0x30/0x60
                                sp=e00000407ff97da0 bsp=e00000407ff90d18
 [<a0000001004e25c0>] cmd64x_init_one+0x140/0x160
                                sp=e00000407ff97da0 bsp=e00000407ff90cf0
 [<a000000100933a10>] ide_scan_pcidev+0xf0/0x180
                                sp=e00000407ff97e00 bsp=e00000407ff90cb8
 [<a000000100933b20>] ide_scan_pcibus+0x80/0x2e0
                                sp=e00000407ff97e00 bsp=e00000407ff90c80
 [<a0000001009338c0>] ide_init+0xc0/0x120
                                sp=e00000407ff97e00 bsp=e00000407ff90c60
 [<a0000001009003c0>] kernel_init+0x1a0/0x6a0
                                sp=e00000407ff97e00 bsp=e00000407ff90c00
 [<a0000001000113b0>] kernel_thread_helper+0xd0/0x100
                                sp=e00000407ff97e30 bsp=e00000407ff90bd0
 [<a000000100008dc0>] start_kernel_thread+0x20/0x40
                                sp=e00000407ff97e30 bsp=e00000407ff90bd0

and a bunch of these:

 target0:0:6: FAST-80 WIDE SCSI 160.0 MB/s DT (12.5 ns, offset 62)
sd 0:0:6:0: [sdb] Device not ready: <6>: Sense Key : Not Ready [current]
: Add. Sense: Logical unit not ready, initializing command required

However, the kernel still works fine, as near as I can tell and I
don't think these errors are due to my patch. ;-)

Tony, can you apply this to your tree?

  --david
-- 
Mosberger Consulting LLC, http://www.mosberger-consulting.com/

[-- Attachment #2: note.diff --]
[-- Type: text/plain, Size: 1575 bytes --]

[IA64] Add NOTES to linker script such that the kernel can be built with
       recent versions of binutils.  Without this patch, final link fails
       with this error:

        ld: .tmp_vmlinux1: section `.text' can't be allocated in segment 0
        ld: final link failed: Bad value

       This error is due to the fact that the --build-id option is used
       with newer linkers to include a .notes section on the kernel, but
       without the NOTES macro, that section won't be included in the kernel
       which then leads to the above error message.

Signed-off-by: David Mosberger-Tang <dmosberger@gmail.com>

diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 83e8067..446f12d 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -20,6 +20,7 @@ PHDRS {
   code   PT_LOAD;
   percpu PT_LOAD;
   data   PT_LOAD;
+  note   PT_NOTE;
 }
 SECTIONS
 {
@@ -62,6 +63,9 @@ SECTIONS
 
   /* Read-only data */
 
+  NOTES :code :note		/* put .notes in text and mark in PT_NOTE  */
+  code_continues : {} :code	/* switch back to regular program...  */
+
   /* Exception table */
   . = ALIGN(16);
   __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET)
@@ -276,10 +280,6 @@ SECTIONS
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
   /* These must appear regardless of  .  */
-  /* Discard them for now since Intel SoftSDV cannot handle them.
-  .comment 0 : { *(.comment) }
-  .note 0 : { *(.note) }
-  */
   /DISCARD/ : { *(.comment) }
   /DISCARD/ : { *(.note) }
 }

  parent reply	other threads:[~2007-08-09 17:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-09  6:30 need NOTES in vmlinux.lds.S David Mosberger-Tang
2007-08-09  6:44 ` Roland McGrath
2007-08-09 17:53 ` David Mosberger-Tang [this message]
2007-08-09 18:04 ` Luck, Tony
2007-08-09 18:52 ` Thomas Gleixner

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=ed5aea430708091053h11b8fbd6pd88d7bed31823535@mail.gmail.com \
    --to=dmosberger@gmail.com \
    --cc=linux-ia64@vger.kernel.org \
    /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