Re: [arch-dev-public] Changing compilation flags

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [arch-dev-public] Changing compilation flags

arch general mailing list-2
FYI clang devs don't want to take 1 line patch adding another no-op flag upstream.
https://lists.llvm.org/pipermail/cfe-dev/2017-July/054588.html

> -------- Original Message --------
> Subject: Re: [arch-dev-public] Changing compilation flags
> From: [hidden email]
> To: Evangelos Foutras <[hidden email]>
> Daniel Micay <[hidden email]>, Public mailing list for Arch Linux development <[hidden email]>
> On 5 July 2017 at 19:51, Daniel Micay <[hidden email]> wrote:
> So I think it would be a good idea to flip the default to -z,now in the
> linker if we"re going to use -fno-plt. I think they"d take a patch for
> that upstream. Clang issue could be avoided with a 1 line patch adding
> another no-op flag and they"d take that upstream. It"s harmless to use
> the slower lazy linking calling convention when -fno-plt is passed.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [arch-dev-public] Changing compilation flags

arch general mailing list-2
I'm surprised as it seemed to me that Daniel took it for granted that patch like that will get accepted. Anyway it's hard for an outsider to successfully submit anything to big upstream project. I hope you'll be more lucky if/when you decide to upstream your pie/ssp patches.
It would be nice if makepkg have some conditionals i.e. :
if cc=clang then
cflags="-march=x86-64 -mtune=generic -O2 -pipe -fsanitize=safe-stack -fsanitize=cfi -fvisibility=hidden
if cc=gcc then
cflags="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fstack-check

> -------- Original Message --------
> Subject: Re: [arch-dev-public] Changing compilation flags
> From: [hidden email]
> To: Jordan Glover <[hidden email]>
> [hidden email] <[hidden email]>, Daniel Micay <[hidden email]>, Public mailing list for Arch Linux development <[hidden email]>, [hidden email]
> Thanks for trying to push the change upstream. I"m sorry they weren"t
> very receptive of it; your responses were on point and further
> clarified our intended use case.
> I"m not sure what Joerg meant by saying "Arch Linux can"t do
> compiler-specific flag definitions". He could be thinking of a regular
> project that can check for supported compiler flags, but AFAIK that
> concept is not readily transferable to distro-wide flags. (Even if it
> was, it would also apply to stack-check and friends so it"s a weak
> argument in my opinion.)
> At the end of the day, it"s not an issue to carry this patch
> downstream in Arch. :-)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [arch-dev-public] Changing compilation flags

LoneVVolf
On 08-07-17 04:31, Evangelos Foutras via arch-general wrote:
> There are multiple ways the compiler can be selected; two of them are: 1)
> exporting CC/CXX in the PKGBUILD and 2) the project's configure script
> picking one of the available compilers. makepkg can't realistically know
> which compiler is going to be used and thus must have only one set of flags
> that is supported by both GCC and Clang.
>

An alternative solution would be to tailor things to the compiler used
by the majority (gcc) and to avoid clang as much as possible.
That would ocourse require special settings for packages compiled with
clang.

NOTE : whether that is a good idea is another matter, but it IS an option.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [arch-dev-public] Changing compilation flags

arch general mailing list-2
On 07/08/2017 06:53 AM, LoneVVolf wrote:

> On 08-07-17 04:31, Evangelos Foutras via arch-general wrote:
>> There are multiple ways the compiler can be selected; two of them are: 1)
>> exporting CC/CXX in the PKGBUILD and 2) the project's configure script
>> picking one of the available compilers. makepkg can't realistically know
>> which compiler is going to be used and thus must have only one set of flags
>> that is supported by both GCC and Clang.
>>
>
> An alternative solution would be to tailor things to the compiler used
> by the majority (gcc) and to avoid clang as much as possible.
> That would ocourse require special settings for packages compiled with
> clang.
>
> NOTE : whether that is a good idea is another matter, but it IS an option.
AIUI that is already what we do, in the sense that gcc is the assumed
default everywhere, and our (C|CXX|LD)FLAGS are written with the
assumption that gcc is the default compiler.

Any packages that need to deviate from the default makepkg.conf flags
(because they *already* have special settings to use clang, those
settings are in the project build configuration files) can currently
modify those flags on a PKGBUILD-by-PKGBUILD basis, or alternatively we
can try to get clang to deal with basic gcc compatibility in a graceful
manner.

--
Eli Schwartz


signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [arch-dev-public] Changing compilation flags

arch general mailing list-2
My idea was to have general CC=, CXX=... options set in makepkg.conf, then makepkg would use:
CFLAGS_GCC when CC=gcc and CFLAGS_CLANG when CC=clang
This way instead of setting common minimal compatible flags we could enable all features that compiler have and maintainer/user would only need to set different CC= option in PKGBUILD or globally in makepkg.conf (it's already possible but flags have to be also manually changed).

> -------- Original Message --------
> Subject: Re: [arch-general] [arch-dev-public] Changing compilation flags
> From: [hidden email]
> To: [hidden email]
> Eli Schwartz <[hidden email]>
> On 07/08/2017 06:53 AM, LoneVVolf wrote:
>> On 08-07-17 04:31, Evangelos Foutras via arch-general wrote:
>>> There are multiple ways the compiler can be selected; two of them are: 1)
>>> exporting CC/CXX in the PKGBUILD and 2) the project"s configure script
>>> picking one of the available compilers. makepkg can"t realistically know
>>> which compiler is going to be used and thus must have only one set of flags
>>> that is supported by both GCC and Clang.
>>>
>>
>> An alternative solution would be to tailor things to the compiler used
>> by the majority (gcc) and to avoid clang as much as possible.
>> That would ocourse require special settings for packages compiled with
>> clang.
>>
>> NOTE : whether that is a good idea is another matter, but it IS an option.
> AIUI that is already what we do, in the sense that gcc is the assumed
> default everywhere, and our (C|CXX|LD)FLAGS are written with the
> assumption that gcc is the default compiler.
> Any packages that need to deviate from the default makepkg.conf flags
> (because they *already* have special settings to use clang, those
> settings are in the project build configuration files) can currently
> modify those flags on a PKGBUILD-by-PKGBUILD basis, or alternatively we
> can try to get clang to deal with basic gcc compatibility in a graceful
> manner.
> --
> Eli Schwartz
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [arch-dev-public] Changing compilation flags

arch general mailing list-2
In reply to this post by arch general mailing list-2
spec file? only supported by gcc, but that seems to be kinda the point
here. I think this is what most distros do (and possibly also how
--enable-default-* works).
Loading...