Message ID | CA+yXCZDrBcrNo2wXm++qqbST9Sxxp0E4720gN90GP99ShfJV1Q@mail.gmail.com |
---|---|
State | New |
Headers | show |
Series | RISC-V: Pass --no-relax to linker if -mno-relax is present. | expand |
On Wed, Apr 18, 2018 at 3:10 AM, Kito Cheng <kito.cheng@gmail.com> wrote: > * config/riscv/elf.h (LINK_SPEC): Pass --no-relax if > -mno-relax is present. > * config/riscv/linux.h (LINK_SPEC): Ditto. It is easy enough to use -Wl,--no-relax and there are other linker options that require -Wl so I don't think this is very useful. However, I think it could be useful if it turned off relaxation in both the assembler and the linker, since currently there is no easy way to do that. For the assembler, there is no option, but we can emit .option norelax at the asm file start. It needs to be a real option in order to make this work. Also, options should have a doc entry, which is more important when it is a real option. Jim
Hi Jim: Turned off both the assembler and the linker sounds good idea to me, but it's not support on current assembler now, and gcc might release in next few month, so I afraid we'll have a short time gap that is -mno-relax is broken due to assembler not support that command line option in the latest release yet? On Thu, Apr 19, 2018 at 8:51 AM, Jim Wilson <jimw@sifive.com> wrote: > On Wed, Apr 18, 2018 at 3:10 AM, Kito Cheng <kito.cheng@gmail.com> wrote: >> * config/riscv/elf.h (LINK_SPEC): Pass --no-relax if >> -mno-relax is present. >> * config/riscv/linux.h (LINK_SPEC): Ditto. > > It is easy enough to use -Wl,--no-relax and there are other linker > options that require -Wl so I don't think this is very useful. > > However, I think it could be useful if it turned off relaxation in > both the assembler and the linker, since currently there is no easy > way to do that. For the assembler, there is no option, but we can > emit .option norelax at the asm file start. It needs to be a real > option in order to make this work. Also, options should have a doc > entry, which is more important when it is a real option. > > Jim > > -- > You received this message because you are subscribed to the Google Groups "RISC-V Patches" group. > To unsubscribe from this group and stop receiving emails from it, send an email to patches+unsubscribe@groups.riscv.org. > To post to this group, send email to patches@groups.riscv.org. > Visit this group at https://groups.google.com/a/groups.riscv.org/group/patches/. > To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/patches/CAFyWVaaz7Wh3GhYEdf%2BbEMfQFb4bHpVJ3hxYM72C-ce0o4ji3w%40mail.gmail.com. > For more options, visit https://groups.google.com/a/groups.riscv.org/d/optout.
On 04/18/2018 06:59 PM, Kito Cheng wrote: > Hi Jim: > > Turned off both the assembler and the linker sounds good idea to me, > but it's not support on current assembler now, and gcc might release in > next few month, so I afraid we'll have a short time gap that is > -mno-relax is broken due to assembler not support that command > line option in the latest release yet? Sorry, I didn't look at this closely enough. We already have a -mrelax/-mno-relax added by Palmer. You even mentioned that. So all your patch is doing is adding support to pass it to the linker, which is OK. You are right that we can't release a compiler that uses the new assembler option until after there is an assembler release, so we can't modify gcc to use it until after the gcc-8 release branch is made. But we don't need it for now, as we have Palmer's patch. I still think it was a good idea to add the assembler option though, to make it a little more user friendly. Anyways, this patch is OK. I have committed it. Jim
From 1f18c78eb54c9e5aa66b4490af61f8803fa47267 Mon Sep 17 00:00:00 2001 From: Kito Cheng <kito.cheng@gmail.com> Date: Wed, 18 Apr 2018 11:22:45 +0800 Subject: [PATCH] RISC-V: Pass --no-relax to linker if -mno-relax is present. 2018-04-18 Kito Cheng <kito.cheng@gmail.com> * config/riscv/elf.h (LINK_SPEC): Pass --no-relax if -mno-relax is present. * config/riscv/linux.h (LINK_SPEC): Ditto. --- gcc/config/riscv/elf.h | 1 + gcc/config/riscv/linux.h | 1 + 2 files changed, 2 insertions(+) diff --git a/gcc/config/riscv/elf.h b/gcc/config/riscv/elf.h index f39e83234d2..a8357bb6e18 100644 --- a/gcc/config/riscv/elf.h +++ b/gcc/config/riscv/elf.h @@ -19,6 +19,7 @@ along with GCC; see the file COPYING3. If not see #define LINK_SPEC "\ -melf" XLEN_SPEC "lriscv \ +%{mno-relax:--no-relax} \ %{shared}" /* Link against Newlib libraries, because the ELF backend assumes Newlib. diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index ad03654e8d6..aa8a28d5d31 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h @@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see #define LINK_SPEC "\ -melf" XLEN_SPEC "lriscv \ +%{mno-relax:--no-relax} \ %{shared} \ %{!shared: \ %{!static: \ -- 2.11.2