[ELF] symbol sets handling [2]
Ian Lance Taylor
ian@airs.com
Sat Feb 8 22:16:00 GMT 2003
More information about the Binutils mailing list
Sat Feb 8 22:16:00 GMT 2003
- Previous message (by thread): [ELF] symbol sets handling [2]
- Next message (by thread): [ELF] symbol sets handling [2]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Fabio Alemagna <falemagn@studenti.unina.it> writes: > > For that matter, what are > > you trying to sort? Do you want to sort a collection of symbol set > > sections? If so, why? > > Yes, I want to do that, and the reason is that I do it right now, but with > the help of a post processor which automatically builds a ld script and > feeds it to ld. The reason for I want to have sortable symbol sets is that > there are many occasions in which this is needed, basically all > sistuations in which one needs to have a collection os symbols which have > to be processed in a certain order. The AROS libc, for example, has > initialization routines which need to be called upon program startup in a > well defined order, and need to be called on program exiting in the > opposite order, and the same goes for the list of libraries to open, which > need to be opened in a well defined order. You say that you do want to sort a collection of symbol set sections, but your examples appear to be ones of sorting symbols within a single symbol set section. Consider: symbol set I symbol d symbol e symbol f symbol set II symbol x symbol y symbol z Do you want to control the order of symbol set I and symbol set II--e.g., arrange for symbol set II to appear before symbol set I? Or do you want to control the order of the symbols within the symbol sets--e.g., arrange for f to precede d and/or z to precede x? For the rest of this note I assume you want the latter sort of control. Have you considered not relying on the linker to do the sorting, but to have each symbol in the set be the address of a structure containing the priority and the function to call? Then you can sort the symbols in the correct order before you call them; inelegant but simple. If you must do it in the linker, then I suppose you are on the right track by putting the priority into the section name, but you will need to have some way for the linker to detect that it should emit the __start and __stop symbols. For example, you could invent some code to be embedded in the section name, e.g. .gnu_symbol_set.NAME.PRIORITY When the emulation sees a section of that names, it groups them, sorted by priority (simpler if this can be done lexically) and emits the __start and __stop symbols using NAME. Ian
- Previous message (by thread): [ELF] symbol sets handling [2]
- Next message (by thread): [ELF] symbol sets handling [2]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list