From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 8794B3861010 for ; Thu, 7 Dec 2023 15:50:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8794B3861010 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8794B3861010 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701964239; cv=none; b=MXN0TTHquO4N0O80kCKI9OftcyAM6zo6vXlKaFlqc1csdGtLqHlkHwE8wAhEQ8C7ZIvHPRe404h345AbMCKdLBL1nGMSRdX+D/G2f0p8+hZk5V6RjgYp5uWRBbgcH7L5BmJSaPTGgatBgpAdeYCKi6ENsXCmJ3u6HZ5j11wYWpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701964239; c=relaxed/simple; bh=psKjupBR+NaHky1c1WnftHgnRs3EF4X4bB3Zi3xVPg0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Lac4Tx4O1gWvhv/O1bWyYZ7V3ltgEbRUq8t4BQr0WFyF9VELBNXfIgZSUoc/FS2Ht7v/JtHp9pYBfjruuyqT1Bw3y659iPguq3Jr9VCyVueg1cHR5dEUnhp/mUovFl0kJ6rYLnobJ1lzIYaZ5zROslo8QFSOD7ZJV6B/DnMQ6Vk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701964238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=h6Wbhnqpi6Jl8NHPpNR5Wk/N9yihC2SBe0bZ00Copko=; b=gawUXOZmArcwNo3KwEeHErmmGD8FFGvSKKfn2HQjENnolgEcUcG5AweMUD73Owa4uqMgJS MLrKb+fWjjJ1OkjMXs0iKjDZ1MgLDNgV1uqYSXumBd5zItsOqpNnPMnp5oS+mZClSO7Y0y oxFmDKIDGaV4U3JVCsCUymS3mnsk+K8= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-674-e3MQvivnPP2iFDSsQro4bw-1; Thu, 07 Dec 2023 10:50:36 -0500 X-MC-Unique: e3MQvivnPP2iFDSsQro4bw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40b40234bd5so6629115e9.0 for ; Thu, 07 Dec 2023 07:50:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701964235; x=1702569035; h=content-transfer-encoding:in-reply-to:autocrypt:from: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=h6Wbhnqpi6Jl8NHPpNR5Wk/N9yihC2SBe0bZ00Copko=; b=LnidHd8d54BLWcfLtd+sYfZQKSZxVooRYEkZu3QFp0q7oMDa0+Zwju9NL7IMvUmcXJ xKXgz06KcfYPCLfCHNx/5vRvw+ZEOU/U+AS4t4LEW5xgg/6ImEVVuoeSkhswjfk/dnru TpmEwd1MCRMBYjcU274r37au0p+0t5Q2M0ipqxu0b2htI6E2JWrHfC+8baxwgfaE3N6t BD4+Lb0dhDCQfUPZbNudypi9Y7c0mt0UWkyTDmUciJOxzmYDoEYDC6OyX4rAEPJQxV6A zLFQ+VpWCTQvCLguHfkMi323Oxf1h/U+bGAGRVEhcKt53sLYPgZABIUNO75Y3hq5XzD0 HYxQ== X-Gm-Message-State: AOJu0YxiptTHJ1Whff+tnU5pXzNAmnQwhlBVYYIpSIFrV/zleNMhys4z Ww/yK9Gpr/BzgqmdcMJzEeuCjnzQQzxNiqs66p2W6pnKDRcI0r9FDXrDQf+BnV+WMbsgO4+XrEn d017nSsxrJJUtSn5WINjbX7yjPw== X-Received: by 2002:a05:600c:1986:b0:40b:5e21:d343 with SMTP id t6-20020a05600c198600b0040b5e21d343mr1689533wmq.76.1701964235077; Thu, 07 Dec 2023 07:50:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUkJ1HwCfjjBLU5Zf4gWdKVFFEHo/3KjN9w9VDIll9RjZKGWlF8jhKsQwxGziewJsAXMM+Lg== X-Received: by 2002:a05:600c:1986:b0:40b:5e21:d343 with SMTP id t6-20020a05600c198600b0040b5e21d343mr1689528wmq.76.1701964234756; Thu, 07 Dec 2023 07:50:34 -0800 (PST) Received: from [192.168.1.11] ([79.123.79.31]) by smtp.gmail.com with ESMTPSA id d17-20020a05600c34d100b0040b501ddd34sm2337917wmq.48.2023.12.07.07.50.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Dec 2023 07:50:34 -0800 (PST) Message-ID: <93a44089-7ad5-4122-9df4-1cce6042c648@redhat.com> Date: Thu, 7 Dec 2023 15:50:33 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Question: default linker scripts and emulations To: Georg-Johann Lay , binutils@sourceware.org References: <26f6143b-cd4c-4c7d-bf06-4265d17f417f@gjlay.de> <627688a1-176c-4a8e-984e-3848c902b273@redhat.com> From: Nick Clifton Autocrypt: addr=nickc@redhat.com; keydata= xsFNBFm/2cUBEADkvRqMWfAryJ52T4J/640Av5cam9ojdFih9MjcX7QWFxIzJfTFYq2z+nb4 omdfZosdCJL2zGcn6C0AxpHNvxR9HMDkEyFHKrjDh4xWU+pH4z9azQEqJh331X7UzbZldqQo 16VkuVavgsTJaHcXm+nG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S5MG45irMQXELGQyxkrafc8lwHeABYstoK8dpopTcJGE3dZGL3JNz 1YWxQ5AV4uyqBn5N8RubcA8NzR6DQP+OGPIwzMketvVC/cbbKDZqf0uTDy3jP65OFhSkTEIy nYv1Mb4JJl3Sq+haUbfWLAV5nboSuHmiZE6Bz2+TjdoVkNwHBfpqxu6MlWka+P98SUcmY8iV hPy9QC1XFOGdFDFf1kYgHW27mFwds35NQhNARgftAVz9FZXruW6tFIIfisjr3rVjD9R8VgL7 l5vMr9ylOFpepnI6+wd2X1566HW7F1Zw1DIrY2NHL7kL5635bHrJY4n7o/n7Elk/Ca/MAqzd IZxz6orfXeImsqZ6ODn4Y47PToS3Tr3bMNN9N6tmOPQZkJGHDBExbhAi/Jp8fpWxMmpVCUl6 c85cOBCR4s8tZsvGYOjR3CvqKrX4bb8GElrhOvAJa6DdmZXc7AyoVMaTvhpq3gJYKmC64oqt 7zwIHwaCxTbP6C6oUp9ENRV7nHnXN3BlvIgCo4QEs6HkDzkmgYlCEOKBiDyVMSkPDZdsspa+ K4GlU2Swi/BDJMjtDxyo+K0M81LXXxOeRfEIfPtZ3ddxBKPva1uSsuz+pbN9d1JY8Ko5T/h1 6susi2ReUyNJEJaSnjO5z13TQ1U= In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-GB Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: Hi Georg-Johann, >>> Is it possible to add a new option to the linker so it picks a different ld script, such that: >>> >>> o The same emulation is used. >>> >>> o All works a usual, e.g. when the user request -T myscript.ld, use myscript.ld provided it is a complete ld script and not just INSERT AFTER etc. > Then there's the technical problem that the compiler needs to know the install path (in configure and when running) and provide the complete path to avr108.ld. > > Just dropping avr108.ld in $install/avr/lib/ldscripts is not enough that the linker can find it with -Tavr108.ld > > Then the specs would need to be able to select different ld-script flavours like *.x, *.xn, *.xr, etc depending on options like -r and whatnot. > > And the default ld-scripts are contained in the ld executable, so that changing the scripts on file won't have any effect (except you select them explicitly with -T). > > IMO specs cannot resolve that in a reasonable way, in particular the distinction between complete ld-scripts and snippets. OK, so it sounds to me like what is needed is an option to tell the linker where to find its default scripts, and if used, override the use of the built in scripts. So for example: avr-ld foo.o [Uses built in avr1.x script] avr-ld -m avr2 foo.o [Uses built in avr2.x script] avr-ld -m avr2 -r foo.o [Uses built in avr2.xr script] avr-ld -m avr2 -T bar.ld foo.o [Uses ./bar.ld unless it contains INSERT, in which case it uses the built in avr2.x script augmented by ./bar.ld] avr-ld --default-script-path /usr/lib/avr foo.o [Uses /usr/lib/avr/avr1.x. Generates an error if it does not exist. Does not use the built in avr1.x script] avr-ld -m avr2 --default-script-path /usr/lib/avr foo.o [Uses /usr/lib/avr/avr2.x. Generates an error if it does not exist. Does not use the built in avr2.x script] avr-ld -m avr2 -r --default-script-path /usr/lib/avr foo.o [Uses /usr/lib/avr/avr2.xr. Generates an error if it does not exist. Does not use the built in avr2.xr script] avr-ld -m avr2 -T bar.ld --default-script-path /usr/lib/avr foo.o [Uses ./bar.ld unless it contains INSERT, in which case it uses /usr/lib/avr/avr2.x augmented by ./bar.ld] And, for completeness sake, assuming that bar.ld does not exist in the current directory: avr-ld -m avr2 -L /usr/foo -T bar.ld --default-script-path /usr/lib/avr foo.o [Uses /usr/foo/bar.ld unless it contains INSERT, in which case it uses /usr/lib/avr/avr2.x augmented by /usr/foo/bar.ld] Is this what you had in mind ? Cheers Nick PS, If this is what you had in mind, then I think that it could be done, but I am not sure that it should be done. I feel that their ought to be an easier way to achieve the same results without adding any new code to the linker. I am not sure - at the moment - what that easier way might be however.