On Mittwoch, 1. August 2018 18:32:30 CEST Joseph Myers wrote: > On Wed, 1 Aug 2018, Allan Sandfeld Jensen wrote: > > gcc/ > > > > * gcc.c: Correct default specs for -r > > I don't follow why your changes (which would need describing for each > individual spec changed) are corrections. > > > /* config.h can define LIB_SPEC to override the default libraries. */ > > #ifndef LIB_SPEC > > > > -#define LIB_SPEC "%{!shared:%{g*:-lg} > > %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}" +#define LIB_SPEC > > "%{!shared|!r:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"> > > #endif > > '!' binds more closely than '|' in specs. That is, !shared|!r means the > following specs are used unless both -shared and -r are specified, which > seems nonsensical to me. I'd expect something more like "shared|r:;" to > expand to nothing if either -shared or -r is passed and to what follows if > neither is passed. > > And that ignores that this LIB_SPEC value in gcc.c is largely irrelevant, > as it's generally overridden by targets - and normally for targets using > ELF shared libraries, for example, -lc *does* have to be used when linking > with -shared. > > I think you're changing the wrong place for this. If you want -r to be > usable with GCC without using -nostdlib (which is an interesting > question), you actually need to change LINK_COMMAND_SPEC (also sometimes > overridden for targets) to handle -r more like -nostdlib -nostartfiles. > Ok, thanks for the information, I will investigate that.
> > -#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} " > > +#define LINK_PIE_SPEC "%{static|shared|r|ar:;" PIE_SPEC ":" LD_PIE_SPEC > > "} " > What's this "-ar" option you're handling here? Dead code from a previous more ambitious version of the patch. I will remove. `Allan