[lld] [ELF] Implement --force-group-allocation (PR #94704)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 02:07:02 PDT 2024


================
@@ -1384,6 +1384,9 @@ static void readConfigs(opt::InputArgList &args) {
   config->relaxGP = args.hasFlag(OPT_relax_gp, OPT_no_relax_gp, false);
   config->rpath = getRpath(args);
   config->relocatable = args.hasArg(OPT_relocatable);
+  config->resolveGroups = !args.hasArg(OPT_relocatable) ||
----------------
smithp35 wrote:

I'm not sure I've understood the benefit of `--inhibit-group-allocation`. 

* For a non relocatable link it is ignored. 
* For a relocatable link its behaviour is the default state, so there is no need to explicitly use it.

The only reason I can think to use it if there is an existing linker command-line that with `--force-group-allocation` that I want to disable. I don't think that is likely though.

Unless I've missed something, would it be better to keep the command-line interface simple with 
```
config->resolveGroups = !args.hasArg(OPT_relocatable) ||
args.hasFlag(OPT_force_group_allocation, false);

I couldn't find it in the GNU ld documentation.



https://github.com/llvm/llvm-project/pull/94704


More information about the llvm-commits mailing list