Re: need NOTES in vmlinux.lds.S

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/9/07, Roland McGrath <roland@xxxxxxxxxx> 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/
[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@xxxxxxxxx>

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) }
 }

[Index of Archives]     [Linux Kernel]     [Sparc Linux]     [DCCP]     [Linux ARM]     [Yosemite News]     [Linux SCSI]     [Linux x86_64]     [Linux for Ham Radio]

  Powered by Linux