From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Tue, 18 Jun 2013 16:54:57 +0200 Subject: [U-Boot] [PATCH v3 0/6] Optimize ARM relocation In-Reply-To: <51BDBEAC.3040706@myspectrum.nl> References: <1369724512-4047-1-git-send-email-albert.u.boot@aribaud.net> <1370953055-13482-1-git-send-email-albert.u.boot@aribaud.net> <20130611144729.5bbf542b@lilith> <20130613110545.5e3c1708@lilith> <51BA1569.7010103@myspectrum.nl> <51BDBEAC.3040706@myspectrum.nl> Message-ID: <20130618165457.47f57f79@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Jeroen, On Sun, 16 Jun 2013 15:33:32 +0200, Jeroen Hofstee wrote: > Hello Albert, > > On 06/13/2013 08:54 PM, Jeroen Hofstee wrote: > > > >>>> binaries only use one type of relocation record, > >>>> R_ARM_RELATIVE., then optimizing relocation code > >>>> accordingly. > >>> > > > > fyi, I had a look at the clang build and it doesn't boot > after these patches... > > When constant pointers are used without fpie, e.g. the > arguments to printf, gcc will load the address with ldr / > R_ARM_ABS32, clang sets the address with a movw / > movt pair. Hmm... Why do you remove -fpie from the gcc build? > ld -r will make the former relative, but the movw / movt > cannot be fixed. So I set fpie for clang, which generates > a couple of R_ARM_ABS32: > > Most notably a reference to do_bootd. Since it is no > longer valid after this patch and used in command.c this > crashes the board (unless there happens to be a valid > address in it). gcc seems to always recalculate it using pc. > > Another symbol is _start, but that looks easily fixable. > > The last one looks similar like the do_bootd and I haven't > bothered to check the details. Can you give more precise info on the issue? Such as the U-Boot codebase (even if not in shape for submitting) and clang compiler version you are using, so that I can try the build on my side and have a look at how/why r_arm_abs32 relocation recodes are generated and how to avoid it? > Regards, > Jeroen Amicalement, -- Albert.