* [committed] Don't pass -m32 to libcc1 on arm-linux
@ 2018-01-19 9:17 Yao Qi
2018-01-19 16:24 ` Andreas Schwab
0 siblings, 1 reply; 4+ messages in thread
From: Yao Qi @ 2018-01-19 9:17 UTC (permalink / raw)
To: gdb-patches
When I run gdb.compile/ tests on arm-linux, I get the following fails,
(gdb) compile code -- ;^M
arm-none-linux-gnueabihf-gcc: error: unrecognized command line option '-m32'; did you mean '-mbe32'?^M
Compilation failed.^M
(gdb) compile code (void) param^M
arm-none-linux-gnueabihf-gcc: error: unrecognized command line option '-m32'; did you mean '-mbe32'?^M
Compilation failed.^M
(gdb) FAIL: gdb.compile/compile-ops.exp: compile code (void) param
This patch fixes it by implementing gcc_target_options gdbarch method
for arm-linux to override option "-m32".
gdb:
2018-01-19 Yao Qi <yao.qi@linaro.org>
* arm-linux-tdep.c (arm_linux_gcc_target_options): New function.
(arm_linux_init_abi): Install it.
---
gdb/ChangeLog | 5 +++++
gdb/arm-linux-tdep.c | 11 +++++++++++
2 files changed, 16 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6709f44..53fde81 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2018-01-19 Yao Qi <yao.qi@linaro.org>
+ * arm-linux-tdep.c (arm_linux_gcc_target_options): New function.
+ (arm_linux_init_abi): Install it.
+
+2018-01-19 Yao Qi <yao.qi@linaro.org>
+
* osabi.c (gdb_osabi_names): Extend the regexp for
arm-linux-gnueabihf.
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index d1262cc..e8f8c4e 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1712,6 +1712,15 @@ arm_linux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
return find_solib_trampoline_target (frame, pc);
}
+/* Implement the gcc_target_options gdbarch method. */
+
+static char *
+arm_linux_gcc_target_options (struct gdbarch *gdbarch)
+{
+ /* GCC doesn't know "-m32". */
+ return NULL;
+}
+
static void
arm_linux_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
@@ -1992,6 +2001,8 @@ arm_linux_init_abi (struct gdbarch_info info,
arm_linux_record_tdep.arg5 = ARM_A1_REGNUM + 4;
arm_linux_record_tdep.arg6 = ARM_A1_REGNUM + 5;
arm_linux_record_tdep.arg7 = ARM_A1_REGNUM + 6;
+
+ set_gdbarch_gcc_target_options (gdbarch, arm_linux_gcc_target_options);
}
void
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [committed] Don't pass -m32 to libcc1 on arm-linux
2018-01-19 9:17 [committed] Don't pass -m32 to libcc1 on arm-linux Yao Qi
@ 2018-01-19 16:24 ` Andreas Schwab
2018-01-19 16:34 ` Pedro Alves
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2018-01-19 16:24 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On Jan 19 2018, Yao Qi <qiyaoltc@gmail.com> wrote:
> This patch fixes it by implementing gcc_target_options gdbarch method
> for arm-linux to override option "-m32".
Why is that not the default?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [committed] Don't pass -m32 to libcc1 on arm-linux
2018-01-19 16:24 ` Andreas Schwab
@ 2018-01-19 16:34 ` Pedro Alves
2018-01-19 17:49 ` Yao Qi
0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2018-01-19 16:34 UTC (permalink / raw)
To: Andreas Schwab, Yao Qi; +Cc: gdb-patches
On 01/19/2018 04:24 PM, Andreas Schwab wrote:
> On Jan 19 2018, Yao Qi <qiyaoltc@gmail.com> wrote:
>
>> This patch fixes it by implementing gcc_target_options gdbarch method
>> for arm-linux to override option "-m32".
>
> Why is that not the default?
I think for really no good reason other than the coincidence that
the first couple ports that implemented this hook could share the
same set of "-m" options.
I agree that changing the default would be better. "-m" options are,
by design, machine-specific.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [committed] Don't pass -m32 to libcc1 on arm-linux
2018-01-19 16:34 ` Pedro Alves
@ 2018-01-19 17:49 ` Yao Qi
0 siblings, 0 replies; 4+ messages in thread
From: Yao Qi @ 2018-01-19 17:49 UTC (permalink / raw)
To: Pedro Alves; +Cc: Andreas Schwab, GDB Patches
On Fri, Jan 19, 2018 at 4:34 PM, Pedro Alves <palves@redhat.com> wrote:
> On 01/19/2018 04:24 PM, Andreas Schwab wrote:
>> On Jan 19 2018, Yao Qi <qiyaoltc@gmail.com> wrote:
>>
>>> This patch fixes it by implementing gcc_target_options gdbarch method
>>> for arm-linux to override option "-m32".
>>
>> Why is that not the default?
> I think for really no good reason other than the coincidence that
> the first couple ports that implemented this hook could share the
> same set of "-m" options.
The compile project was started for x86, so it had x86 options in
default.
char *
default_gcc_target_options (struct gdbarch *gdbarch)
{
return xstrprintf ("-m%d%s", gdbarch_ptr_bit (gdbarch),
gdbarch_ptr_bit (gdbarch) == 64 ? " -mcmodel=large" : "");
}
which is not correct for other arches. What is more, we have
no way to disable "compile" feature even it is not support on
some arches. If libcc1.so can be loaded in GDB, GDB thinks
everything is OK, and use it unconditionally for "compile"
feature.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-19 17:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19 9:17 [committed] Don't pass -m32 to libcc1 on arm-linux Yao Qi
2018-01-19 16:24 ` Andreas Schwab
2018-01-19 16:34 ` Pedro Alves
2018-01-19 17:49 ` Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox