Source-Changes-D archive

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

Re: CVS commit: src/sys/kern



On 12.02.2017 22:52, Valeriy E. Ushakov wrote:
> Module Name:	src
> Committed By:	uwe
> Date:		Sun Feb 12 21:52:46 UTC 2017
> 
> Modified Files:
> 	src/sys/kern: exec_elf.c
> 
> Log Message:
> netbsd_elf_signature - look at note segments (phdrs) not note
> sections.  They point to the same data in the file, but sections are
> for linkers and are not necessarily present in an executable.
> 
> The original switch from phdrs to shdrs seems to be just a cop-out to
> avoid parsing multiple notes per segment, which doesn't really avoid
> the problem b/c sections also can contain multiple notes.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.87 -r1.88 src/sys/kern/exec_elf.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 
> 


This change broke assembly framework of mine.

(amd64)
$ cat start.S
.globl _start

.section ".note.netbsd.ident", "", @note
        .long 2f-1f
        .long 4f-3f
        .long 1
1:      .asciz "NetBSD"
2:      .p2align 2
3:      .long 700000001
4:      .p2align 2

.section .text
_start:
        andq $0xfffffffffffffff0, %rsp
        subq $0x8, %rsp
        call main
        movq %rax, %rdi
        movq $0x1, %rax
        syscall

$ cat minimal.c
int main(void)
{
return 5;
}

$ gcc -nostdlib start.S minimal.c -o minimal

This program reports invalid NetBSD executable now. It was inspired by
https://wiki.netbsd.org/examples/netbsd_assembly/

Reverting this commit locally makes the executable work again.

Is this a regression or is the template wrong?

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index