This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH v2][MIPS] fix CRT_CALL_STATIC_FUNCTION macro
- From: "Maciej W. Rozycki" <macro at linux-mips dot org>
- To: Petar Jovanovic <petar dot jovanovic at rt-rk dot com>
- Cc: "'Moore, Catherine'" <Catherine_Moore at mentor dot com>, 'Matthew Fortune' <Matthew dot Fortune at imgtec dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 16 Apr 2015 19:22:57 +0100 (BST)
- Subject: RE: [PATCH v2][MIPS] fix CRT_CALL_STATIC_FUNCTION macro
- Authentication-results: sourceware.org; auth=none
- References: <003e01d04179$ccc38bc0$664aa340$ at rt-rk dot com> <6D39441BF12EF246A7ABCE6654B0235320FCA3F1 at LEMAIL01 dot le dot imgtec dot org> <FD3DCEAC5B03E9408544A1E416F11242018915136E at NA-MBX-04 dot mgc dot mentorg dot com> <000201d04723$f69b1350$e3d139f0$ at rt-rk dot com> <FD3DCEAC5B03E9408544A1E416F112420189153090 at NA-MBX-04 dot mgc dot mentorg dot com> <000501d07865$e26f2830$a74d7890$ at rt-rk dot com>
On Thu, 16 Apr 2015, Petar Jovanovic wrote:
> > There isn't any need to execute a large testcase. Instead, try adding a
> short version of your test to the directory gcc/testsuite/gcc.target/mips.
> > There are examples of other tests there they check for specific assembler
> sequences by using scan-assembler. See umips-swp-1.c (and others) for a
> specific example of how to do this.
> > Let me know if you need additional help.
> > Thanks,
> > Catherine
>
> Hi Catherine,
>
> Sorry for late response, I have missed to follow up on this.
> IIUC, scan-assembler will scan assembly file generated from a test file.
> This particular change will - on the other hand - modify crtend.o and thus
> init section. Is there a 'scan-assembler' functionality over a final linked
> executable, as that would actually test the change?
You'd need `objdump' for doing that and there is no ready-to-use solution
within the GCC test suite available, you'd have to cook something up
yourself, perhaps starting with `[find_binutils_prog objdump]'.
Another solution might be using an auxiliary linker script (`-Wl,-T,...'
or maybe just an implicit linker script will do; see the LD manual for
details) to place the sections the jump is made between apart manually at
addresses appropriate for JAL to fail. They span does not have to be
large -- when placed correctly, even `JAL .' can jump to the wrong place,
which is what LD is supposed to catch as a relocation error -- so a test
executable successfully linked with your correction in place won't be
large, it doesn't have to take more than 2 virtual pages.
The downside of the latter solution are possible portability issues with
the linker script. You won't have to run your executable AFAICT from
glibc BZ #17601 as you'll get a link error if a jump target is out of
range. So you could make it a mere link test, no need to run it.
Maciej