Add -fno-plt,-fplt to ignored flags

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Add -fno-plt,-fplt to ignored flags

Boris Kolpackov via cfe-dev
In GCC there is a -fno-plt [1] flag not implemented in Clang which results in compilation failure:
clang-4.0: error: unknown argument: '-fno-plt'

I created patch that adds -fno-plt and -fplt to existing ignored flags list making it compatible with gcc for package building. I tested it and it works as expected. I sent this patch already to cfe-commits [2] list as advised [3]. I would be grateful if anyone could review it and merge when it's acceptable.

Thank you for your attention. Jordan Glover

[2] https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20170703/197341.html

Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td    (revision 307280)
+++ include/clang/Driver/Options.td    (working copy)
@@ -2497,6 +2497,7 @@
 defm non_call_exceptions : BooleanFFlag<"non-call-exceptions">, Group<clang_ignored_f_Group>;
 defm peel_loops : BooleanFFlag<"peel-loops">, Group<clang_ignored_gcc_optimization_f_Group>;
 defm permissive : BooleanFFlag<"permissive">, Group<clang_ignored_f_Group>;
+defm plt : BooleanFFlag<"plt">, Group<clang_ignored_f_Group>;
 defm prefetch_loop_arrays : BooleanFFlag<"prefetch-loop-arrays">, Group<clang_ignored_gcc_optimization_f_Group>;
 defm printf : BooleanFFlag<"printf">, Group<clang_ignored_f_Group>;
 defm profile : BooleanFFlag<"profile">, Group<clang_ignored_f_Group>;
Index: test/Driver/clang_f_opts.c
===================================================================
--- test/Driver/clang_f_opts.c    (revision 307280)
+++ test/Driver/clang_f_opts.c    (working copy)
@@ -275,6 +275,7 @@
 // RUN:     -fno-fat-lto-objects -ffat-lto-objects                            \
 // RUN:     -fno-merge-constants -fmerge-constants                            \
 // RUN:     -fno-caller-saves -fcaller-saves                                  \
+// RUN:     -fno-plt                                                          \
 // RUN:     -fno-reorder-blocks -freorder-blocks                              \
 // RUN:     -fno-schedule-insns2 -fschedule-insns2                            \
 // RUN:     -fno-stack-check                                                  \
@@ -281,6 +282,7 @@
 // RUN:     -fno-check-new -fcheck-new                                        \
 // RUN:     -ffriend-injection                                                \
 // RUN:     -fno-implement-inlines -fimplement-inlines                        \
+// RUN:     -fplt                                                             \
 // RUN:     -fstack-check                                                     \
 // RUN:     -fforce-addr                                                      \
 // RUN:     -malign-functions=100                                             \


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Add -fno-plt,-fplt to ignored flags

Boris Kolpackov via cfe-dev
On Fri, Jul 07, 2017 at 07:32:00AM -0400, Jordan Glover via cfe-dev wrote:
> In GCC there is a -fno-plt [1] flag not implemented in Clang which results in compilation failure:
> clang-4.0: error: unknown argument: '-fno-plt'

Can you please slap whoever decided to use a random new GCC flag without
checking for its existance first?

I have seen no evidence of this flag used in the wild so far, so I'm
quite reluctant to accept this change.

Joerg
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Add -fno-plt,-fplt to ignored flags

Boris Kolpackov via cfe-dev
Thanks for the reply.

-fno-plt flag is going to be used as default build flag for every package available in Archlinux [1]. There were concerns about that change breaking clang but it was decided to add patch similar as mine [2]. Also some developers advised to submit such patch upstream [3][4].

Jordan Glover

[1] https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/pacman&id=0cd22d4454e0e1b3ae589b95274f808001465c15
[2] https://git.archlinux.org/svntogit/packages.git/tree/trunk/0001-GCC-compatibility-Ignore-the-fno-plt-flag.patch?h=packages/llvm
[3] https://lists.archlinux.org/pipermail/arch-dev-public/2017-July/028928.html
[4] https://lists.archlinux.org/pipermail/arch-dev-public/2017-July/028929.html

-------- Original Message --------
Subject: Re: [cfe-dev] Add -fno-plt,-fplt to ignored flags
To: Jordan Glover <[hidden email]>

On Fri, Jul 07, 2017 at 07:32:00AM -0400, Jordan Glover via cfe-dev wrote:
> In GCC there is a -fno-plt [1] flag not implemented in Clang which results in compilation failure:
> clang-4.0: error: unknown argument: "-fno-plt"

Can you please slap whoever decided to use a random new GCC flag without
checking for its existance first?

I have seen no evidence of this flag used in the wild so far, so I"m
quite reluctant to accept this change.

Joerg


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Add -fno-plt,-fplt to ignored flags

Boris Kolpackov via cfe-dev
On Fri, Jul 07, 2017 at 08:26:14AM -0400, Jordan Glover wrote:
> Thanks for the reply.
> -fno-plt flag is going to be used as default build flag for every
> package available in Archlinux [1]. There were concerns about that
> change breaking clang but it was decided to add patch similar as mine
> [2]. Also some developers advised to submit such patch upstream [3][4].

So clang should this flag because Archlinux can't do compiler-specific
flag definitions and want to push a questionable flag everywhere? Sorry
if I'm a bit sarcastic, but that doesn't sound like a very good reason.

Joerg
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Add -fno-plt,-fplt to ignored flags

Boris Kolpackov via cfe-dev
It's also for convenience those users  which want to use clang instead gcc which is the default compiler. This way they could change it easily without breakage. The list of ignored flags for gcc compatibility  already exist with many entries so why don't use it in that case? There are no security consequences when this flag is silently ignored. On the other hand clang already added fstack-check flag to ignore list which could mislead users as it have security implications as shoved in " stack-clash".

I reverse your question - what's the reason to not add it to the list? It doesn't interfere with anything. Some users will benefit and others wouldn't care. I understand that you personally aren't interested but please think about others who are.

Jordan Glover

-------- Original Message --------
Subject: Re: [cfe-dev] Add -fno-plt,-fplt to ignored flags
To: Jordan Glover <[hidden email]>

On Fri, Jul 07, 2017 at 08:26:14AM -0400, Jordan Glover wrote:
> Thanks for the reply.
> -fno-plt flag is going to be used as default build flag for every
> package available in Archlinux [1]. There were concerns about that
> change breaking clang but it was decided to add patch similar as mine
> [2]. Also some developers advised to submit such patch upstream [3][4].

So clang should this flag because Archlinux can"t do compiler-specific
flag definitions and want to push a questionable flag everywhere? Sorry
if I"m a bit sarcastic, but that doesn"t sound like a very good reason.

Joerg


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Add -fno-plt,-fplt to ignored flags

Boris Kolpackov via cfe-dev
On Fri, Jul 07, 2017 at 09:30:17AM -0400, Jordan Glover wrote:
> The list of ignored flags for gcc compatibility already exist with many
> entries so why don't use it in that case?

The list of ignored flags is a result of evaluation wide spread historic
(ab)use. It is not meant as compensation because someone decides to use
*new* GCC flags without checking if it is actually supported by the
compiler.

Joerg
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Add -fno-plt,-fplt to ignored flags

Boris Kolpackov via cfe-dev
In reply to this post by Boris Kolpackov via cfe-dev
I think we actually want to implement this flag in the near future. Maybe Sri can say more.

On Fri, Jul 7, 2017 at 4:32 AM, Jordan Glover via cfe-dev <[hidden email]> wrote:
In GCC there is a -fno-plt [1] flag not implemented in Clang which results in compilation failure:
clang-4.0: error: unknown argument: '-fno-plt'

I created patch that adds -fno-plt and -fplt to existing ignored flags list making it compatible with gcc for package building. I tested it and it works as expected. I sent this patch already to cfe-commits [2] list as advised [3]. I would be grateful if anyone could review it and merge when it's acceptable.

Thank you for your attention. Jordan Glover


Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td    (revision 307280)
+++ include/clang/Driver/Options.td    (working copy)
@@ -2497,6 +2497,7 @@
 defm non_call_exceptions : BooleanFFlag<"non-call-exceptions">, Group<clang_ignored_f_Group>;
 defm peel_loops : BooleanFFlag<"peel-loops">, Group<clang_ignored_gcc_optimization_f_Group>;
 defm permissive : BooleanFFlag<"permissive">, Group<clang_ignored_f_Group>;
+defm plt : BooleanFFlag<"plt">, Group<clang_ignored_f_Group>;
 defm prefetch_loop_arrays : BooleanFFlag<"prefetch-loop-arrays">, Group<clang_ignored_gcc_optimization_f_Group>;
 defm printf : BooleanFFlag<"printf">, Group<clang_ignored_f_Group>;
 defm profile : BooleanFFlag<"profile">, Group<clang_ignored_f_Group>;
Index: test/Driver/clang_f_opts.c
===================================================================
--- test/Driver/clang_f_opts.c    (revision 307280)
+++ test/Driver/clang_f_opts.c    (working copy)
@@ -275,6 +275,7 @@
 // RUN:     -fno-fat-lto-objects -ffat-lto-objects                            \
 // RUN:     -fno-merge-constants -fmerge-constants                            \
 // RUN:     -fno-caller-saves -fcaller-saves                                  \
+// RUN:     -fno-plt                                                          \
 // RUN:     -fno-reorder-blocks -freorder-blocks                              \
 // RUN:     -fno-schedule-insns2 -fschedule-insns2                            \
 // RUN:     -fno-stack-check                                                  \
@@ -281,6 +282,7 @@
 // RUN:     -fno-check-new -fcheck-new                                        \
 // RUN:     -ffriend-injection                                                \
 // RUN:     -fno-implement-inlines -fimplement-inlines                        \
+// RUN:     -fplt                                                             \
 // RUN:     -fstack-check                                                     \
 // RUN:     -fforce-addr                                                      \
 // RUN:     -malign-functions=100                                             \


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev