Path: csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: objcopy -I binary etc... Was: C23 thoughts and opinions Date: Thu, 06 Jun 2024 07:44:47 -0700 Organization: A noiseless patient Spider Lines: 23 Message-ID: <86tti6ku5c.fsf@linuxsc.com> References: <20240530180345.00003d9f@yahoo.com> <20240531161937.000063af@yahoo.com> <20240531162811.00006719@yahoo.com> <20240531164835.00007128@yahoo.com> <20240531173437.00003bee@yahoo.com> <86frtwq2lz.fsf@linuxsc.com> <2QG6O.11963$qQk3.6582@fx18.iad> <86bk4kp50e.fsf@linuxsc.com> <20240606145633.000061f5@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 06 Jun 2024 16:44:47 +0200 (CEST) Injection-Info: dont-email.me; posting-host="d27732bb70530c4a14d68e0b12f92cb8"; logging-data="1634015"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xzZOvMAcxrILNs6hHjueMSVvkKAdJaho=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:s87qoZMy/hP1i97nGiaJ5m6oIlk= sha1:KdJZwrARoRDbqKhUSVWquMsZTjc= Xref: csiph.com comp.lang.c:385625 Michael S writes: > On Sat, 01 Jun 2024 17:22:57 -0700 > Tim Rentsch wrote: [..differences in gcc and clang that might be explained by ld...] >> I expect you are right. I run ld directly only rarely, and >> certainly am no expert. In my tests I was simply blindly >> following the example shown in your posting (with some variations >> after my attempts gave the wrong answer, trying to get it to >> work). It didn't occur to me to consider ld. >> >> Using clang for the final link step always gave the right answer, >> if I remember correctly. > > I reproduced your findings. The difference between gcc and clang is not > in ld, but in ld invocation options. > Specifically, gcc calls ld with -pie, clang calls ld without it. > gcc default behaviour can be overwritten with -no-pie switch. > I suppose that gcc4 has the same default as clang. Makes sense. Thank you for the explanation.