Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #180155 > unrolled thread

In Stretch, gcc producing position independent binaries by default?

Started byNeoklis Kyriazis <nkcyham@yahoo.com>
First post2017-04-15 16:00 +0200
Last post2017-04-15 19:30 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.debian.user

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  In Stretch, gcc producing position independent binaries by default? Neoklis Kyriazis <nkcyham@yahoo.com> - 2017-04-15 16:00 +0200
    Re: In Stretch, gcc producing position independent binaries by  default? Reco <recoverym4n@gmail.com> - 2017-04-15 16:30 +0200
      Re: In Stretch, gcc producing position independent binaries by  default? Neoklis Kyriazis <nkcyham@yahoo.com> - 2017-04-15 16:50 +0200
        Re: In Stretch, gcc producing position independent binaries by  default? Reco <recoverym4n@gmail.com> - 2017-04-15 19:30 +0200

#180155 — In Stretch, gcc producing position independent binaries by default?

FromNeoklis Kyriazis <nkcyham@yahoo.com>
Date2017-04-15 16:00 +0200
SubjectIn Stretch, gcc producing position independent binaries by default?
Message-ID<twwp3-7d2-7@gated-at.bofh.it>
Hi,

I have recently completed my first installation of Debian (stretch)
and I am compiling some apps from source. I have noticed that filers
show binaries produce by gcc as being shared library objects instead
of just ELF executables.

I eventually, by searching, I worked around this by specifying the 

-no-pie flag in CFLAGS but I would like to know if gcc is by default
set up to produce 
position independent binaries or if I have not set up things correctly.



My thanks in advance
--
Best Regards
Neoklis - Ham Radio Call:5B4AZ
http://www.5b4az.org/

[toc] | [next] | [standalone]


#180158 — Re: In Stretch, gcc producing position independent binaries by default?

FromReco <recoverym4n@gmail.com>
Date2017-04-15 16:30 +0200
SubjectRe: In Stretch, gcc producing position independent binaries by default?
Message-ID<twwS5-7Dd-1@gated-at.bofh.it>
In reply to#180155
	Hi.

On Sat, 15 Apr 2017 13:50:59 +0000 (UTC)
Neoklis Kyriazis <nkcyham@yahoo.com> wrote:

> Hi,
> 
> I have recently completed my first installation of Debian (stretch)
> and I am compiling some apps from source. I have noticed that filers
> show binaries produce by gcc as being shared library objects instead
> of just ELF executables.
> 
> I eventually, by searching, I worked around this by specifying the 
> 
> -no-pie flag in CFLAGS but I would like to know if gcc is by default
> set up to produce 
> position independent binaries or if I have not set up things correctly.

They patched gcc to produce PIE by default - and that's one of Debian
stretch release goals. See:

https://wiki.debian.org/Hardening/PIEByDefaultTransition

Reco

[toc] | [prev] | [next] | [standalone]


#180160 — Re: In Stretch, gcc producing position independent binaries by default?

FromNeoklis Kyriazis <nkcyham@yahoo.com>
Date2017-04-15 16:50 +0200
SubjectRe: In Stretch, gcc producing position independent binaries by default?
Message-ID<twxbr-7Ku-3@gated-at.bofh.it>
In reply to#180158
>They patched gcc to produce PIE by default - and that's one of Debian
>stretch release goals. See:
>
>https://wiki.debian.org/Hardening/PIEByDefaultTransition


Ah thanks! New to Debian so I was not aware of this. My problem though
is that filers like ROX and pcmanfm do not start PIE executables by
clicking on them because they are seen as shared objects. 


Anyhow, I expect there are now recommended CFLAGS for gcc when compiling
binaries for Debian, right?


--
Best Regards
Neoklis - Ham Radio Call:5B4AZ
http://www.5b4az.org/

[toc] | [prev] | [next] | [standalone]


#180168 — Re: In Stretch, gcc producing position independent binaries by default?

FromReco <recoverym4n@gmail.com>
Date2017-04-15 19:30 +0200
SubjectRe: In Stretch, gcc producing position independent binaries by default?
Message-ID<twzGi-YI-13@gated-at.bofh.it>
In reply to#180160
	Hi.

On Sat, 15 Apr 2017 14:39:49 +0000 (UTC)
Neoklis Kyriazis <nkcyham@yahoo.com> wrote:

> 
> >They patched gcc to produce PIE by default - and that's one of Debian
> >stretch release goals. See:
> >
> >https://wiki.debian.org/Hardening/PIEByDefaultTransition
> 
> 
> Ah thanks! New to Debian so I was not aware of this. My problem though
> is that filers like ROX and pcmanfm do not start PIE executables by
> clicking on them because they are seen as shared objects. 

Yes, that's known problem. I recall seeing some heated discussions
about it, but cannot find the links (was it PIE for Mozilla's built
Firefox? - my memory fails me).
The current consensus for graphical file managers on this seems to be
'yes, PIE executables are broken in this regard, but developer should
provide a .desktop file anyway'.

Not that I agree with such approach (on graphical file managers, PIE
is ok idea), but they took it.


> Anyhow, I expect there are now recommended CFLAGS for gcc when compiling
> binaries for Debian, right?

For 3 last major releases at least. Run 'dpkg-buildflags --get CFLAGS'
to see them. And don't forget 'dpkg-buildflags --get LDFLAGS' for the
linker.

Please note then one's using so called 'sane' build system (autotools,
cmake, etc) - the debhelper usually takes care of recommended CFLAGS
and LDFLAGS by itself.

Reco

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web