X-Recipient: archive-cygwin@delorie.com
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B57AB3858D28
Authentication-Results: sourceware.org; dmarc=none (p=none dis=none)
 header.from=SystematicSw.ab.ca
Authentication-Results: sourceware.org;
 spf=none smtp.mailfrom=systematicsw.ab.ca
X-Authority-Analysis: v=2.4 cv=EIdlb3VC c=1 sm=1 tr=0 ts=616336d8
 a=T+ovY1NZ+FAi/xYICV7Bgg==:117 a=T+ovY1NZ+FAi/xYICV7Bgg==:17
 a=IkcTkHD0fZMA:10 a=niFrTMwtAAAA:8 a=w_pzkKWiAAAA:8 a=uXHIkvRuAAAA:8
 a=TImcKGuyeGIbufSLrCcA:9 a=QEXdDO2ut3YA:10 a=pdnwLGf5Sn8A:10
 a=np3TA3Oix3-V2ZI7LYEf:22 a=sRI3_1zDfAgwuvI8zelB:22 a=zDY1CQ7QJ_oyYkGJc_zN:22
To: cygwin@cygwin.com
References: <CAPCuWjnnFLWZKSjF5Yz=vBxUnoJ=+ONtgeKeLwfsVy3ZvJatYQ@mail.gmail.com>
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
Organization: Systematic Software
Subject: Re: ld linker with option -m elf_i386 stopped working in new version
 of cygwin.
Message-ID: <4aff570c-04e0-41d4-7ebd-87a72de72e90@SystematicSw.ab.ca>
Date: Sun, 10 Oct 2021 12:54:15 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.14.0
MIME-Version: 1.0
In-Reply-To: <CAPCuWjnnFLWZKSjF5Yz=vBxUnoJ=+ONtgeKeLwfsVy3ZvJatYQ@mail.gmail.com>
Content-Language: en-CA
X-CMAE-Envelope: MS4xfCsim7YJcx0qsXZ2N3+O43ybQSlDc06sFHZ8SQyDYjGytEoaCZNI3pspXiSawrLdMBvSR5k3G+eGwimlQ+fyp25cDFNYMugayKijHYQ9omJ6XR9xdrRP
 IfDT8frL7VCi4syOy6ysjcvEcmz7UpyiDFiagrK3cfhI+C0KNMXtjgossm+SvlEsUGiMcK1pEot83gg7vZtdvPMBpRW5LvsE087ZgVCu0kBrPZius3yoNCia
 glyKP7mfesJf/D7+dA5jQw==
X-Spam-Status: No, score=-1160.4 required=5.0 tests=BAYES_00,
 KAM_ASCII_DIVIDERS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A,
 RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,
 RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE,
 TXREP autolearn=no autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Reply-To: cygwin@cygwin.com
Cc: Ronaldo Luiz Alonso <ronaldo.luiz.alonso@gmail.com>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

On 2021-10-10 09:17, Ronaldo Luiz Alonso via Cygwin wrote:
> Hello everybody!
> I am a professor teaching operational system and using a tutorial in
> french by michelizza:
> https://michelizza.developpez.com/realiser-son-propre-systeme/
> In order to build the system and debug it in bochs I use the
> following Makefile:
> ------------------------------------------------------------------------
> OBJ=kernel
> CC=gcc -Wall *-m32* -g
> 
> all: $(OBJ)
> 
> kernel: kernel.o screen.o lib.o gdt.o idt.o interrupt.o int.o pic.o
> syscalls.o mm.o printk.o process.o schedule.o sched.o
> * ld --oformat binary -m elf_i386 -Ttext 1000 $^ -o $@*
> 
> int.o: int.asm
> nasm -f elf -o $@ $^
> 
> sched.o: sched.asm
> nasm -f elf -o $@ $^
> 
> .o: .c
> $(CC) -c $^
> 
> clean:
> rm -f $(OBJ) *.o
> ------------------------------------------------------------------------
> Note that the system is compiled using -m 32 (system is for machines with
> 32 bits) bits and the linker uses elf_i386 multiboot format.
> 
> This was working fine few weeks later, but when I run setup again to update
> cygwin it stops working and ld complains that* this emulation mode is no
> longer  supported! *
>   The system now only links and builds PE windows executables!
> 
> The question is:
> *how can I get and build an older version of ld source, so that this works
> again in cygwin ?*
> *Is it possible?*
> *or should I give up developping this kernel using windows and cygwin and
> turn back to Linux?*

$ ld --help | egrep 'elf|386'
ld: supported targets: pe-x86-64 pei-x86-64 pe-bigobj-x86-64 
elf64-x86-64 elf64-l1om elf64-k1om pe-i386 pei-i386 elf32-i386 
elf32-iamcu elf64-little elf64-big elf32-little elf32-big srec 
symbolsrec verilog tekhex binary ihex plugin
ld: supported emulations: i386pep i386pe
i386pep:
i386pe:

Package binutils ld still supports elf32-i386 but not emulation.

For now you can still roll back to 2.36 and see if that supports the 
target and emulation you are using; you may also have to roll back its 
dependencies:

depends2: cygwin, libintl8, zlib0

You can also still download the earlier Cygwin source package and 
maintain that as an effective fork.
Older source package build control script definitions and patches are 
available under:

https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/binutils.git

and you may need earlier releases of build tools:

build-depends: cygport, dejagnu, libgmp-devel, libiconv-devel, 
libintl-devel, libisl-devel, libmpc-devel, libmpfr-devel, zlib-devel

Older Cygwin Setup and package releases remain available at the Cygwin 
Time Machine:

http://www.crouchingtigerhiddenfruitbat.org/Cygwin/timemachine.html

As Cygwin is a rolling release system, you need to pay attention to 
announcement notices of test and stable releases of packages on which 
your work depends.
New bug fix releases can quickly roll somewhat older releases out of the 
available archives.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
