public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Dhole <dhole@openmailbox.org>, gcc-patches@gcc.gnu.org
Cc: "Manuel López-Ibáñez" <lopezibanez@gmail.com>
Subject: Re: [PATCH] Allow embedded timestamps by C/C++ macros to be set externally
Date: Tue, 30 Jun 2015 17:41:00 -0000	[thread overview]
Message-ID: <5592D42C.2080503@gmail.com> (raw)
In-Reply-To: <5592B356.3080601@openmailbox.org>

> In the debian reproducible builds project we have considered several
> options to address this issue. We considered redefining the __DATE__ and
> __TIME__ defines by command line flags passed to gcc, but as you say,
> that triggers warnings, which could become errors when building with
> -Werror and thus may require manual intervention on many packages.

Would replacing the localtime function with one of your own
in a DSO and preloading the DSO when invoking GCC be a viable
solution? E.g., like so:

$ cat time.c && gcc -Wall -fpic -o libtime.so -shared time.c && echo 
"__DATE__ __TIME__" | LD_PRELOAD=./libtime.so gcc -E -xc -
#include <time.h>
static struct tm t;
struct tm *localtime (const time_t *timer) { return &t; }
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "<stdin>"
"Jan  0 1900" "00:00:00"

Martin

  parent reply	other threads:[~2015-06-30 17:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 13:19 Dhole
2015-06-30 14:48 ` Manuel López-Ibáñez
2015-06-30 14:49   ` Manuel López-Ibáñez
2015-06-30 15:42     ` Dhole
2015-06-30 16:32       ` Manuel López-Ibáñez
2015-07-03 14:00         ` Dhole
2015-06-30 17:41       ` Martin Sebor [this message]
2015-06-30 18:30         ` Mike Stump
2015-06-30 23:21 ` Joseph Myers

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=5592D42C.2080503@gmail.com \
    --to=msebor@gmail.com \
    --cc=dhole@openmailbox.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=lopezibanez@gmail.com \
    /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).