[rb-general] SOURCE_PREFIX_MAP format specification proposals

Ximin Luo infinity0 at debian.org
Mon Jan 16 12:15:00 CET 2017

John Gilmore:
> I'm a bit confused by the SOURCE_PREFIX_MAP discussion.  Let me argue
> a moment for simplicity rather than complexity.
> It sounds like we're hoping to use it to map a bunch of path prefixes
> so that the altered ones get embedded into binaries.  What's the
> problem with fixing GCC to just remove those embedded path prefixes
> from the binaries?  In every case?  Not based on some super magic
> environment variable nor some special build option.  Just get rid of
> them, full stop.
> (I used to maintain GDB, and I also built the first reproducible
> cross-GCC builds back in the 1990s.  Back then, to make cross-builds
> produce identical binaries, we chose to eliminate a bunch of
> irreproducible things that the compiler and assembler and binutils
> were doing.  For example, we set the timestamps in the COFF object
> file format to zeroes, rather than try to fake them.  Nobody was using
> them anyway!)
> If GDB on a binary that you compiled locally can't immediately access
> the source code files via their embedded path value, it isn't a big
> deal; the programmer who's running GDB will know where the sources
> are, and GDB has a command for telling it what directories to look in
> for the source files.
> We already know that GDB on a binary that you installed from a build
> farm or an OS distribution CD is not going to know where the sources
> are locally available.  (Just getting 'debug symbols' packages is a
> major pain and is very poorly integrated.  Did I say very very very
> poorly integrated?)  So why do we need to store even a "mapped" path
> pointing to source files?
> [..]

AIUI, the prefix map is for the case where you need to debug (or do something else to) two files with the same basename but in different directories, for example "utils.c". If you just strip out everything in the path, the debugger or other tool that needs this information can get confused.

I also don't fancy trying to convince all build tools in existence to adopt the information-stripping approach. Once this SOURCE_PREFIX_MAP thing is done, it's done and everyone is happy. It was a similar situation with SOURCE_DATE_EPOCH, the "hardcode" "keep-it-simple" people didn't see the point but now it's all fine and people with opinions across the whole range of the spectrum can mostly agree to it.


GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE

More information about the rb-general mailing list