# Re: \[PATCH\] ARM: add a private asm/unaligned.h

- List: linux-arm-kernel
- 4 messages, 3 authors
- Page: https://ratatoskr.run/linux-arm-kernel/2017/10/5120513/t

## Re: \[PATCH\] ARM: add a private asm/unaligned.h

- From: Gregory CLEMENT \<hidden\>
- Date: 2017-10-30 15:33:09 
- Message: https://ratatoskr.run/linux-arm-kernel/2017/10/5120513.md

```text
Hi Ard,
 
 On lun., oct. 30 2017, Ard Biesheuvel [ref] wrote:

> On 30 October 2017 at 15:09, Gregory CLEMENT
> [ref] wrote:
>> Hi Ard,
>>
>>  On lun., oct. 30 2017, Ard Biesheuvel [ref] wrote:
>>
>>> On 30 October 2017 at 15:05, Gregory CLEMENT
>>> [ref] wrote:
>>>> Hi Ard,
>>>>
>>>>  On lun., oct. 30 2017, Ard Biesheuvel [ref] wrote:
>>>>
>>> ...
>>>>>
>>>>> Could you please share the output of 'readelf -S' for those vmlinux
>>>>> decompressor images?
>>>>
>>>> Here it is:
>>>>
>>>> In the meantime I also used an arm-linux-gnueabihf- in case it could be
>>>> related to the toolchain, I had te same issue and here it is the readelf
>>>> output:
>>>> arm-linux-gnueabi-readelf -S ../build/vmlinux
>>>
>>> Actually, I meant the 'vmlinux' file in arch/arm/boot/compressed, not
>>> the main one.
>>
>> Here it is then:
>>
>> arm-linux-gnueabi-readelf -S ../build/arch/arm/boot/compressed/vmlinux
>> There are 22 section headers, starting at offset 0x4b3e14:
>>
>> Section Headers:
>>   [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
>>   [ 0]                   NULL            00000000 000000 000000 00      0   0  0
>>   [ 1] .text             PROGBITS        00000000 010000 005ef8 00  AX  0   0 32
>>   [ 2] .rodata           PROGBITS        00005ef8 015ef8 000d4c 00   A  0   0  4
>>   [ 3] .piggydata        PROGBITS        00006c44 016c44 48a33a 00   A  0   0  1
>>   [ 4] .got.plt          PROGBITS        00490f80 4a0f80 00000c 04  WA  0   0  4
>>   [ 5] .got              PROGBITS        00490f8c 4a0f8c 000028 00  WA  0   0  4
>>   [ 6] .pad              PROGBITS        00490fb4 4a0fb4 000004 00  WA  0   0  1
>>   [ 7] .bss              NOBITS          00490fb8 4a0fb8 00001c 00  WA  0   0  4
>>   [ 8] .stack            NOBITS          00490fd8 4a0fb8 001000 00  WA  0   0  1
>>   [ 9] .comment          PROGBITS        00000000 4a0fb8 00001c 01  MS  0   0  1
>>   [10] .ARM.attributes   ARM_ATTRIBUTES  00000000 4a0fd4 00002d 00      0   0  1
>>   [11] .debug_line       PROGBITS        00000000 4a1001 00281b 00      0   0  1
>>   [12] .debug_info       PROGBITS        00000000 4a381c 0066cb 00      0   0  1
>>   [13] .debug_abbrev     PROGBITS        00000000 4a9ee7 0013ea 00      0   0  1
>>   [14] .debug_aranges    PROGBITS        00000000 4ab2d8 0001a8 00      0   0  8
>>   [15] .debug_str        PROGBITS        00000000 4ab480 0019b4 01  MS  0   0  1
>>   [16] .debug_ranges     PROGBITS        00000000 4ace38 000640 00      0   0  8
>>   [17] .debug_frame      PROGBITS        00000000 4ad478 001010 00      0   0  4
>>   [18] .debug_loc        PROGBITS        00000000 4ae488 003643 00      0   0  1
>>   [19] .symtab           SYMTAB          00000000 4b1acc 0015b0 10     20 225  4
>>   [20] .strtab           STRTAB          00000000 4b307c 000cc5 00      0   0  1
>>   [21] .shstrtab         STRTAB          00000000 4b3d41 0000d2 00      0   0  1
>> Key to Flags:
>>   W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
>>   L (link order), O (extra OS processing required), G (group), T (TLS),
>>   C (compressed), x (unknown), o (OS specific), E (exclude),
>>   y (purecode), p (processor specific)
>>
>
> And this is from the build the build that generated the linker assert?

Humm no, actually it was with the wrong branch. If I have the patch
"ARM: verify size of zImage" then arch/arm/boot/compressed/vmlinux is
not generated.

But if I remove this patch then I can generate this file and so:
arm-linux-gnueabi-readelf -S ../build/arch/arm/boot/compressed/vmlinux
There are 22 section headers, starting at offset 0x4b402c:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 010000 005ef8 00  AX  0   0 32
  [ 2] .rodata           PROGBITS        00005ef8 015ef8 000d4c 00   A  0   0  4
  [ 3] .piggydata        PROGBITS        00006c44 016c44 48a552 00   A  0   0  1
  [ 4] .got.plt          PROGBITS        00491198 4a1198 00000c 04  WA  0   0  4
  [ 5] .got              PROGBITS        004911a4 4a11a4 000028 00  WA  0   0  4
  [ 6] .pad              PROGBITS        004911cc 4a11cc 000004 00  WA  0   0  1
  [ 7] .bss              NOBITS          004911d0 4a11d0 00001c 00  WA  0   0  4
  [ 8] .stack            NOBITS          004911f0 4a11d0 001000 00  WA  0   0  1
  [ 9] .comment          PROGBITS        00000000 4a11d0 00001c 01  MS  0   0  1
  [10] .ARM.attributes   ARM_ATTRIBUTES  00000000 4a11ec 00002d 00      0   0  1
  [11] .debug_line       PROGBITS        00000000 4a1219 00281b 00      0   0  1
  [12] .debug_info       PROGBITS        00000000 4a3a34 0066cb 00      0   0  1
  [13] .debug_abbrev     PROGBITS        00000000 4aa0ff 0013ea 00      0   0  1
  [14] .debug_aranges    PROGBITS        00000000 4ab4f0 0001a8 00      0   0  8
  [15] .debug_str        PROGBITS        00000000 4ab698 0019b4 01  MS  0   0  1
  [16] .debug_ranges     PROGBITS        00000000 4ad050 000640 00      0   0  8
  [17] .debug_frame      PROGBITS        00000000 4ad690 001010 00      0   0  4
  [18] .debug_loc        PROGBITS        00000000 4ae6a0 003643 00      0   0  1
  [19] .symtab           SYMTAB          00000000 4b1ce4 0015b0 10     20 225  4
  [20] .strtab           STRTAB          00000000 4b3294 000cc5 00      0   0  1
  [21] .shstrtab         STRTAB          00000000 4b3f59 0000d2 00      0   0  1

>
> Could you check the value of _edata in the output of 'nm vmlinux'
> please?
With this kernel:

arm-linux-gnueabi-nm  ../build/arch/arm/boot/compressed/vmlinux | grep _edata
004911d0 D _edata

Gregory

>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
```

## Re: \[PATCH\] ARM: add a private asm/unaligned.h

- From: Ard Biesheuvel \<hidden\>
- Date: 2017-10-30 15:35:42 
- Message: https://ratatoskr.run/linux-arm-kernel/2017/10/5120514.md

```text
On 30 October 2017 at 15:33, Gregory CLEMENT
[ref] wrote:
> Hi Ard,
>
>  On lun., oct. 30 2017, Ard Biesheuvel [ref] wrote:
>
>> On 30 October 2017 at 15:09, Gregory CLEMENT
>> [ref] wrote:
>>> Hi Ard,
>>>
>>>  On lun., oct. 30 2017, Ard Biesheuvel [ref] wrote:
>>>
>>>> On 30 October 2017 at 15:05, Gregory CLEMENT
>>>> [ref] wrote:
>>>>> Hi Ard,
>>>>>
>>>>>  On lun., oct. 30 2017, Ard Biesheuvel [ref] wrote:
>>>>>
>>>> ...
>>>>>>
>>>>>> Could you please share the output of 'readelf -S' for those vmlinux
>>>>>> decompressor images?
>>>>>
>>>>> Here it is:
>>>>>
>>>>> In the meantime I also used an arm-linux-gnueabihf- in case it could be
>>>>> related to the toolchain, I had te same issue and here it is the readelf
>>>>> output:
>>>>> arm-linux-gnueabi-readelf -S ../build/vmlinux
>>>>
>>>> Actually, I meant the 'vmlinux' file in arch/arm/boot/compressed, not
>>>> the main one.
>>>
>>> Here it is then:
>>>
>>> arm-linux-gnueabi-readelf -S ../build/arch/arm/boot/compressed/vmlinux
>>> There are 22 section headers, starting at offset 0x4b3e14:
>>>
>>> Section Headers:
>>>   [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
>>>   [ 0]                   NULL            00000000 000000 000000 00      0   0  0
>>>   [ 1] .text             PROGBITS        00000000 010000 005ef8 00  AX  0   0 32
>>>   [ 2] .rodata           PROGBITS        00005ef8 015ef8 000d4c 00   A  0   0  4
>>>   [ 3] .piggydata        PROGBITS        00006c44 016c44 48a33a 00   A  0   0  1
>>>   [ 4] .got.plt          PROGBITS        00490f80 4a0f80 00000c 04  WA  0   0  4
>>>   [ 5] .got              PROGBITS        00490f8c 4a0f8c 000028 00  WA  0   0  4
>>>   [ 6] .pad              PROGBITS        00490fb4 4a0fb4 000004 00  WA  0   0  1
>>>   [ 7] .bss              NOBITS          00490fb8 4a0fb8 00001c 00  WA  0   0  4
>>>   [ 8] .stack            NOBITS          00490fd8 4a0fb8 001000 00  WA  0   0  1
>>>   [ 9] .comment          PROGBITS        00000000 4a0fb8 00001c 01  MS  0   0  1
>>>   [10] .ARM.attributes   ARM_ATTRIBUTES  00000000 4a0fd4 00002d 00      0   0  1
>>>   [11] .debug_line       PROGBITS        00000000 4a1001 00281b 00      0   0  1
>>>   [12] .debug_info       PROGBITS        00000000 4a381c 0066cb 00      0   0  1
>>>   [13] .debug_abbrev     PROGBITS        00000000 4a9ee7 0013ea 00      0   0  1
>>>   [14] .debug_aranges    PROGBITS        00000000 4ab2d8 0001a8 00      0   0  8
>>>   [15] .debug_str        PROGBITS        00000000 4ab480 0019b4 01  MS  0   0  1
>>>   [16] .debug_ranges     PROGBITS        00000000 4ace38 000640 00      0   0  8
>>>   [17] .debug_frame      PROGBITS        00000000 4ad478 001010 00      0   0  4
>>>   [18] .debug_loc        PROGBITS        00000000 4ae488 003643 00      0   0  1
>>>   [19] .symtab           SYMTAB          00000000 4b1acc 0015b0 10     20 225  4
>>>   [20] .strtab           STRTAB          00000000 4b307c 000cc5 00      0   0  1
>>>   [21] .shstrtab         STRTAB          00000000 4b3d41 0000d2 00      0   0  1
>>> Key to Flags:
>>>   W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
>>>   L (link order), O (extra OS processing required), G (group), T (TLS),
>>>   C (compressed), x (unknown), o (OS specific), E (exclude),
>>>   y (purecode), p (processor specific)
>>>
>>
>> And this is from the build the build that generated the linker assert?
>
> Humm no, actually it was with the wrong branch. If I have the patch
> "ARM: verify size of zImage" then arch/arm/boot/compressed/vmlinux is
> not generated.
>
> But if I remove this patch then I can generate this file and so:
> arm-linux-gnueabi-readelf -S ../build/arch/arm/boot/compressed/vmlinux
> There are 22 section headers, starting at offset 0x4b402c:
>
> Section Headers:
>   [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
>   [ 0]                   NULL            00000000 000000 000000 00      0   0  0
>   [ 1] .text             PROGBITS        00000000 010000 005ef8 00  AX  0   0 32
>   [ 2] .rodata           PROGBITS        00005ef8 015ef8 000d4c 00   A  0   0  4
>   [ 3] .piggydata        PROGBITS        00006c44 016c44 48a552 00   A  0   0  1
>   [ 4] .got.plt          PROGBITS        00491198 4a1198 00000c 04  WA  0   0  4
>   [ 5] .got              PROGBITS        004911a4 4a11a4 000028 00  WA  0   0  4
>   [ 6] .pad              PROGBITS        004911cc 4a11cc 000004 00  WA  0   0  1
>   [ 7] .bss              NOBITS          004911d0 4a11d0 00001c 00  WA  0   0  4
>   [ 8] .stack            NOBITS          004911f0 4a11d0 001000 00  WA  0   0  1
>   [ 9] .comment          PROGBITS        00000000 4a11d0 00001c 01  MS  0   0  1
>   [10] .ARM.attributes   ARM_ATTRIBUTES  00000000 4a11ec 00002d 00      0   0  1
>   [11] .debug_line       PROGBITS        00000000 4a1219 00281b 00      0   0  1
>   [12] .debug_info       PROGBITS        00000000 4a3a34 0066cb 00      0   0  1
>   [13] .debug_abbrev     PROGBITS        00000000 4aa0ff 0013ea 00      0   0  1
>   [14] .debug_aranges    PROGBITS        00000000 4ab4f0 0001a8 00      0   0  8
>   [15] .debug_str        PROGBITS        00000000 4ab698 0019b4 01  MS  0   0  1
>   [16] .debug_ranges     PROGBITS        00000000 4ad050 000640 00      0   0  8
>   [17] .debug_frame      PROGBITS        00000000 4ad690 001010 00      0   0  4
>   [18] .debug_loc        PROGBITS        00000000 4ae6a0 003643 00      0   0  1
>   [19] .symtab           SYMTAB          00000000 4b1ce4 0015b0 10     20 225  4
>   [20] .strtab           STRTAB          00000000 4b3294 000cc5 00      0   0  1
>   [21] .shstrtab         STRTAB          00000000 4b3f59 0000d2 00      0   0  1
>
>>
>> Could you check the value of _edata in the output of 'nm vmlinux'
>> please?
> With this kernel:
>
> arm-linux-gnueabi-nm  ../build/arch/arm/boot/compressed/vmlinux | grep _edata
> 004911d0 D _edata
>

Well, that is disappointing. This means the ASSERT() does not work
reliably, and we're back to using a bunch of shell scripts to check
whether _edata appears at the end of the image.

Which version of binutils are you using?
```

## Re: \[PATCH\] ARM: add a private asm/unaligned.h

- From: Russell King - ARM Linux \<linux@armlinux.org.uk\>
- Date: 2017-10-30 15:55:29 
- Message: https://ratatoskr.run/linux-arm-kernel/2017/10/5120538.md

```text
On Mon, Oct 30, 2017 at 04:33:07PM +0100, Gregory CLEMENT wrote:
> Humm no, actually it was with the wrong branch. If I have the patch
> "ARM: verify size of zImage" then arch/arm/boot/compressed/vmlinux is
> not generated.
> 
> But if I remove this patch then I can generate this file and so:
> arm-linux-gnueabi-readelf -S ../build/arch/arm/boot/compressed/vmlinux
> There are 22 section headers, starting at offset 0x4b402c:
> 
> Section Headers:
>   [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
>   [ 0]                   NULL            00000000 000000 000000 00      0   0  0
>   [ 1] .text             PROGBITS        00000000 010000 005ef8 00  AX  0   0 32
>   [ 2] .rodata           PROGBITS        00005ef8 015ef8 000d4c 00   A  0   0  4
>   [ 3] .piggydata        PROGBITS        00006c44 016c44 48a552 00   A  0   0  1
>   [ 4] .got.plt          PROGBITS        00491198 4a1198 00000c 04  WA  0   0  4
>   [ 5] .got              PROGBITS        004911a4 4a11a4 000028 00  WA  0   0  4
>   [ 6] .pad              PROGBITS        004911cc 4a11cc 000004 00  WA  0   0  1
>   [ 7] .bss              NOBITS          004911d0 4a11d0 00001c 00  WA  0   0  4
>   [ 8] .stack            NOBITS          004911f0 4a11d0 001000 00  WA  0   0  1
>   [ 9] .comment          PROGBITS        00000000 4a11d0 00001c 01  MS  0   0  1
>   [10] .ARM.attributes   ARM_ATTRIBUTES  00000000 4a11ec 00002d 00      0   0  1
>   [11] .debug_line       PROGBITS        00000000 4a1219 00281b 00      0   0  1
>   [12] .debug_info       PROGBITS        00000000 4a3a34 0066cb 00      0   0  1
>   [13] .debug_abbrev     PROGBITS        00000000 4aa0ff 0013ea 00      0   0  1
>   [14] .debug_aranges    PROGBITS        00000000 4ab4f0 0001a8 00      0   0  8
>   [15] .debug_str        PROGBITS        00000000 4ab698 0019b4 01  MS  0   0  1
>   [16] .debug_ranges     PROGBITS        00000000 4ad050 000640 00      0   0  8
>   [17] .debug_frame      PROGBITS        00000000 4ad690 001010 00      0   0  4
>   [18] .debug_loc        PROGBITS        00000000 4ae6a0 003643 00      0   0  1
>   [19] .symtab           SYMTAB          00000000 4b1ce4 0015b0 10     20 225  4
>   [20] .strtab           STRTAB          00000000 4b3294 000cc5 00      0   0  1
>   [21] .shstrtab         STRTAB          00000000 4b3f59 0000d2 00      0   0  1

I don't like readelf's output - please can you post the output of
arm-linux-objdump -h ../build/arch/arm/boot/compressed/vmlinux
instead.

Thanks.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
```

## Re: \[PATCH\] ARM: add a private asm/unaligned.h

- From: Russell King - ARM Linux \<linux@armlinux.org.uk\>
- Date: 2017-10-30 16:59:29 
- Message: https://ratatoskr.run/linux-arm-kernel/2017/10/5120577.md

```text
On Mon, Oct 30, 2017 at 03:35:38PM +0000, Ard Biesheuvel wrote:
> Well, that is disappointing. This means the ASSERT() does not work
> reliably, and we're back to using a bunch of shell scripts to check
> whether _edata appears at the end of the image.

That didn't work too well here.  While it did correctly detect some
instances:

zImage size (8008200) disagrees with linked size (8008192)

it also misdetected others:

zImage size (13348808) disagrees with linked size (-928003328)

It seems to suggest that _magic_end - _magic_start = 0xc8afcb00.
zImage size is 0xcbafc8.  That points at the addresses output by
"nm" being dependent on the endian-ness of the image, which to
me seems utterly insane.

I wouldn't be surprised if that is toolchain version dependent
as well.

IMHO, our toolchain is a mess!

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
```
