From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id C3E483853D58 for ; Thu, 17 Nov 2022 19:12:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C3E483853D58 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x62f.google.com with SMTP id ft34so7435718ejc.12 for ; Thu, 17 Nov 2022 11:12:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pTi//8vImSwB3gBxGobgjvtoy+LnmK549LGV+nQx1fM=; b=hwxv3wIqbUHHnFAkm/msWzi6DM73lTlr+w4QhpGJDMcXq5KzdGiyZONQNUrWUjHq3V 9ikLYCFZ7dITvau23LoWLDgUR27dBERtMvZ/EPySgqbl8fT9ONOBUJ8iYLQpD2sXCtmD s/TJk2S0YsnyV6Wuw4ClJLrF8WYHGZfHp9h8KQRUSIfvTQJUJsAJuhEC6eJiJmdaL/Uz mE4YCYpfhlw4Moqc+PuPIrHnAa1OJinn92Z/TBKFBYfBr7OQ5QE3yIBIY9nrGOV9fTKW IsTCgr5FCGgIc0MNnsMMvZzKy3I9/3eMDofjpDj7y48G3W4P7J8Uz58dOFigohlTwpbw M6tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pTi//8vImSwB3gBxGobgjvtoy+LnmK549LGV+nQx1fM=; b=kqt1Dg/5B+yR/TVtD0KxP6g4fNP5ziJM3y6kRfUNiT+P0uW8AKt1Szhk+/cuQ/0Mo8 W9FOW9Se2fPee+Y2Q74a+cniNKj5/1RfNAuqMkAXX9sN6haA8p7LOo/V/1BSULRQ1MiR xzdSqGKvgyW8jQjgeGIR59LavzIo/7LgTSjXlema2QEZ280Z9M2x1NVZERzX1DPRIV9e ICRzjnG7b8ztkpM+/WbdRpsSomB449DGfHKUjVFUlSebwbRRdQXGJigRrvQZRzFE6iPx yGjKQHfESx/YVf0BBczvdYTnQfnVB6lYnhF4I9kMGYSl3fUHUeOLKiwxb+2c2Y94zd8G u1xQ== X-Gm-Message-State: ANoB5pkWp99fIQ/ljcGtSDF1cY02Yg9YqviurGKiScgs2sVW8UaS8uJn fXaKmCIHn1ar68HoIbAjjPxi9dsY9mpW/jbvifTaNC0E X-Google-Smtp-Source: AA0mqf5Gx08pKoE0YCxPexzjkGLdkXr7dtfBaY5PFd7kL4DdJ8MZjT3gXGjbLDXuwApSn1R7CZpVlkiv1e5GjO3vTuw= X-Received: by 2002:a17:906:144c:b0:7ad:cda3:93c7 with SMTP id q12-20020a170906144c00b007adcda393c7mr3360184ejc.500.1668712343499; Thu, 17 Nov 2022 11:12:23 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "H.J. Lu" Date: Thu, 17 Nov 2022 11:11:45 -0800 Message-ID: Subject: Re: [PATCH] binutils: partially revert 17c6c3b99156fe82c1e637e1a5fd9f163ac788c8 To: =?UTF-8?B?5b6Q5oyB5oGSIFh1IENoaWhlbmc=?= Cc: "binutils@sourceware.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3015.9 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_LOTSOFHASH,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Nov 17, 2022 at 11:01 AM =E5=BE=90=E6=8C=81=E6=81=92 Xu Chiheng wrote: > > binutils-2.36 and earlier works > binutils-2.37 and later does not work. It worked by accident before. May I ask why you want to do it this way? > ________________________________ > From: H.J. Lu > Sent: Friday, November 18, 2022 02:50 > To: =E5=BE=90=E6=8C=81=E6=81=92 Xu Chiheng > Cc: binutils@sourceware.org > Subject: Re: [PATCH] binutils: partially revert 17c6c3b99156fe82c1e637e1a= 5fd9f163ac788c8 > > On Thu, Nov 17, 2022 at 10:28 AM =E5=BE=90=E6=8C=81=E6=81=92 Xu Chiheng <= chiheng.xu@gmail.com> wrote: > > > > No. not using NASM. > > > > using x86_64-elf-g++ -m32 to generate 32 bit code(elf32). > > using x86_64-elf-objcopy to convert it to elf64. > > then link the 32 bit code(elf64) with 64 bit code. > > > > This is an unsupported operation. > > H.J. > > > > > > ________________________________ > > From: H.J. Lu > > Sent: Friday, November 18, 2022 02:06 > > To: =E5=BE=90=E6=8C=81=E6=81=92 Xu Chiheng > > Cc: binutils@sourceware.org > > Subject: Re: [PATCH] binutils: partially revert 17c6c3b99156fe82c1e637e= 1a5fd9f163ac788c8 > > > > On Thu, Nov 17, 2022 at 9:44 AM =E5=BE=90=E6=8C=81=E6=81=92 Xu Chiheng = via Binutils > > wrote: > > > > > > Phenomenal: In 32 bit and 64 bit mixed code, ld can't do relocation > > > for 32 bit code. > > > It is caused by commit 17c6c3b99156fe82c1e637e1a5fd9f163ac788c8. > > > > > > > > > > > > > > > /* src_mask selects the part of the instruction (or data) to be use= d > > > in the relocation sum. If the target relocations don't have an > > > addend in the reloc, eg. ELF USE_REL, src_mask will normally equ= al > > > dst_mask to extract the addend from the section contents. If > > > relocations do have an addend in the reloc, eg. ELF USE_RELA, th= is > > > field should normally be zero. Non-zero values for ELF USE_RELA > > > targets should be viewed with suspicion as normally the value in > > > the dst_mask part of the section contents should be ignored. */ > > > bfd_vma src_mask; > > > > > > > > > > > > Author: Jan Beulich 2021-05-07 18:05:12 > > > Committer: Jan Beulich 2021-05-07 18:05:12 > > > Parent: 98da05bf2698b55b73453480a3fbb92f163d2c7b (x86: don't mix disp > > > and imm processing) > > > Child: 4cf88725da1cb503be04d3237354105ec170bc86 ([gdb/symtab] Fix > > > infinite recursion in dwarf2_cu::get_builder()) > > > Branches: master, test0558-01 and many more (41) > > > Follows: gdb-10-branchpoint > > > Precedes: binutils-2_37, gdb-11-branchpoint > > > > > > x86-64/ELF: clear src_mask for all reloc types > > > > > > x86-64 uses rela relocations. The comment next to the field's dec= laration > > > says "Non-zero values for ELF USE_RELA targets should be viewed w= ith > > > suspicion ..." And indeed the fields being non-zero causes sectio= n > > > contents to be accumulated into the final relocated values in add= ition to > > > the relocations' addends, which is contrary to the ELF spec. > > > > Are you using NASM? > > > > -- > > H.J. > > > > -- > H.J. --=20 H.J.