public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: "bmuller@inf.ufpr.br" <brunomuller65@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: code that went to process segment now goes to shared segment
Date: Fri, 06 Dec 2019 13:18:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.20.13.1912061609420.7713@monopod.intra.ispras.ru> (raw)
In-Reply-To: <CA+KUi2cfnOFS5LsDTaSr_X0+K6QOLZX2DSR5yzZjDbk0QowDyA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]

On Fri, 6 Dec 2019, bmuller@inf.ufpr.br wrote:

> After compiling with gcc 5.4.0 (gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0
> 20160609),  the execution shows that the procedure "main" was at address
> 0x400776, that is, in the process segment (along the global variables).
> 
> After compiling with gcc 7.4.0 (gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0),
> the execution  shows that the procedure "main" went to address
> 0x55bbddb7e7fa, that is inside the dynamic segment área (along the global
> variables).
> 
> I guess that this "functional" change occurred along the GCC 6.0 changes,
> but I could not find the motivation for it in the wiki, faq or the 6.0
> change docs.
> 
> My question is if there is some documentation that presents the motivation
> for this changes: advantages, disadvantages and if some abnormal behavior
> was reported.

You're seeing that newer Ubuntu configures GCC to produce position-independent
executables by default (look for --enable-default-pie in output of 'gcc -v').

Each distribution decides for itself whether to enable PIE by default or not,
the motivation is security hardening; I think you can look for articles on
ASLR, address space layout randomization, for further info.

Upstream GCC did not change its defaults with regard to PIE-by-default, this
was and remains up to distributions.

Alexander

      reply	other threads:[~2019-12-06 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 13:03 bmuller@inf.ufpr.br
2019-12-06 13:18 ` Alexander Monakov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.20.13.1912061609420.7713@monopod.intra.ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=brunomuller65@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).