From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 22D4F385841F for ; Thu, 21 Mar 2024 16:59:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 22D4F385841F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 22D4F385841F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::530 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711040400; cv=none; b=m2Gr+xS4tsDja/vnR120TykHlHKvkKvvdLz1dBuAtbGzMPEFeYwgjQYCJl7F705SNGvy8qPwKysKnrla/viZs4pAwpTFJiZf4BviPSy300Jf2GSheeU7Y3VjWCQHKbTacIvlLa5jw+6UeyT0S4Nf75Tei6KbYbC5wjAjc/1gjj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711040400; c=relaxed/simple; bh=IJ/FxrT9vvxIEvIq2nsqtC2ATjO86+K4uNLqw8a9tl8=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=KpWSl8VajyE4b4fH+GluFFoQSKMxQ89idP0s/l5fN1CjnXNt08dRX6vm+Aj/GuEUb+HKdRVSQNuDV3vMxxEYbz5KTby6ruY5Ltw2bmHzrqGgx3OOhu/6E4t81Rqt2ElvJdItdT/xRnArQfYHMzdREhFW494scL3E2Ro9HEo08HU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56bcede226eso963074a12.1 for ; Thu, 21 Mar 2024 09:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1711040398; x=1711645198; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:cc:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6Kk/XtNGHyl2XjNs7axrIAKmCbeIrajAJ6GAYYGZsQs=; b=deHja7sM8GDCQgxDlpM2hu0TJwI03gZRxOcIrSlRDFQRHzasu8Jwx7G6cwuE3rIAOx T0yPFf9EGap77b89dlu4VttfmnmNUjGnthBpmRKSlVxPfNLJRO01rPRDnU1CMRcCilZy 0z5dkkTaHL3fysfWBO8n5L2xAT6r2uWTUn6FUzTfuvOKmA36UgCSMLjtwkd+lDyCooSs e6/b4iNb/vRnAEtp19wBYPUu9pcO/jYYroD/dL6i8pvK7Dmkwwg66MK/RfsMY8EulsMk B0S755r/WB7FMvxASbc3eUsNsaqxRV5/a3S6X6npthSElIYYT2HKRgh+joh7z0T1CVk6 hg1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711040398; x=1711645198; h=content-transfer-encoding:in-reply-to:autocrypt:from:cc:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6Kk/XtNGHyl2XjNs7axrIAKmCbeIrajAJ6GAYYGZsQs=; b=de0nSp91uQXSbQtdTFidcB7EeNBEV3n1sSNLvr8hbA39uxgcYjNc5lldpmQdWPwDeN vibxqLl+507rY1ku90g8ax+SWyg7OA5Ntrqml45gDfseUasqUM6xg1ARbWLnvbbU4YNP Oi8NCVdbO8O3vbuWhZxgfrNKnDayLRduxYp8pCHWOZoc0zEwK/cVF/hfV5nDxkqAI+Q5 neslMGqrvSFkLLDF3HgA7gFqQl2jkPBqMjn3IIs7ZsQ+uN2YI3UhoeREC6cf9ZXxM0GK g0lwdB+O6uBDm8At0+MygAjxOm2UaHU3UzY1XCu2LBMBEHtqkr/rZISDIOwDAu4Rh5Z6 9i3A== X-Gm-Message-State: AOJu0YwJCaKVYyDHgjI6Xf4x9Ckq9h+xHrN7Y6tF3O9eWS2hhHByfYj8 gCSzLu8RcH/8ZbL4b+shDmy0tF90u6t/9MJ81GlldsGbhGuL1DV+s9+BfRasM0bRvJ2hYPVp16A = X-Google-Smtp-Source: AGHT+IET+D+KnVoJyRTQYL7660Vop4VgkXTVJmQEoIG0lCptE3qdrshv/cJKXzbB5ZkecDD/7rGbuQ== X-Received: by 2002:a50:8e5d:0:b0:56b:dace:ec86 with SMTP id 29-20020a508e5d000000b0056bdaceec86mr366585edx.9.1711040397785; Thu, 21 Mar 2024 09:59:57 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ig3-20020a056402458300b00568b6d731e1sm70342edb.4.2024.03.21.09.59.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Mar 2024 09:59:57 -0700 (PDT) Message-ID: <494659da-1a66-48a9-976d-da19ab55a87e@suse.com> Date: Thu, 21 Mar 2024 17:59:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: RFC: Objcopy: Section alignment Content-Language: en-US To: Nick Clifton References: <875xxf63e7.fsf@redhat.com> Cc: binutils@sourceware.org From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/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ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <875xxf63e7.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3025.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham 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 21.03.2024 15:55, Nick Clifton wrote: > It was recently pointed out to me that objcopy's --section-alignment > option does not actually set the alignment of any sections. It just > sets a field in the PE file format's optional header. This is rather > confusing for the user. Hmm. For one --file-alignment would then want similar treatment, but afaict that might be more difficult to achieve (sections would need moving around in the file). Plus I seem to vaguely recall that there wants to be a certain correlation between section and file alignments of individual sections, which you may break with such an adjustment. > Plus it turns out that even if a section's alignment is set via the > --set=section-alignment option, its LMA and VMA will not be changed to > match the new alignment. Perhaps do just this change in a first step? Albeit ... > @@ -4267,6 +4289,30 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) > if (!bfd_set_section_alignment (osection, alignment)) > err = _("failed to set alignment"); > > + /* If the VMA is not aligned and it was not set by the user > + then adjust it. */ > + if (osection->vma & ((1 << alignment) - 1) > + && change_section_address == 0 > + && find_section_list (bfd_section_name (isection), false, > + SECTION_CONTEXT_ALTER_VMA > + | SECTION_CONTEXT_SET_VMA) == NULL) > + { > + osection->vma += (1 << alignment); > + osection->vma &= ~ ((1 << alignment) -1); > + } > + > + /* If the LMA is not aligned and it was not set by the user > + then adjust it. */ > + if (osection->lma & ((1 << alignment) - 1) > + && change_section_address == 0 > + && find_section_list (bfd_section_name (isection), false, > + SECTION_CONTEXT_ALTER_LMA > + | SECTION_CONTEXT_SET_LMA) == NULL) > + { > + osection->lma += (1 << alignment); > + osection->lma &= ~ ((1 << alignment) -1); > + } ... by doing this adjustment, aren't you at risk of creating overlapping sections? Should --set-section-alignment= perhaps be limited to relocatable files? Jan