search for: defsym

Displaying 20 results from an estimated 51 matches for "defsym".

Did you mean: defs
2019 Dec 04
2
GC for defsym'd symbols in LLD
...Sòng <maskray at google.com> wrote: > > On Tue, Dec 3, 2019 at 7:02 PM Shoaib Meenai via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > LLD treats any symbol referenced from a linker script as a GC root, which makes sense. Unfortunately, it also processes --defsym as a linker script fragment internally, so all target symbols of a --defsym also get treated as GC roots (i.e., if you have something like --defsym SRC=TGT, TGT will become a GC root). I believe this to be unnecessary for defsym specifically, since you're just aliasing a symbol, and if the orig...
2019 Dec 05
2
GC for defsym'd symbols in LLD
I have made some further investigation. My conclusion is that GNU ld does not do better than lld. Making the --defsym behavior ideal is difficult in the current framework. GNU ld has some unintended behaviors. ld.bfd a.o --defsym 'd=foo' --gc-sections -o a => GNU ld retains .text_foo ld.bfd a.o --defsym 'd=foo+3' --gc-sections -o a => GNU ld drops .text_foo ld.bfd a.o --defsym 'd=bar-ba...
2019 Dec 04
2
GC for defsym'd symbols in LLD
LLD treats any symbol referenced from a linker script as a GC root, which makes sense. Unfortunately, it also processes --defsym as a linker script fragment internally, so all target symbols of a --defsym also get treated as GC roots (i.e., if you have something like --defsym SRC=TGT, TGT will become a GC root). I believe this to be unnecessary for defsym specifically, since you're just aliasing a symbol, and if the orig...
2020 Aug 03
2
LLD symbol types for defsym
I noticed that LLD doesn’t preserve the symbol type for a defsym directive. For example: $ cat f.c void f() {} $ clang -c f.c $ ld.lld -shared --defsym=g=f f.o $ objdump -T a.out DYNAMIC SYMBOL TABLE: 00000000000012a0 g DF .text 0000000000000006 f 00000000000012a0 g D .text 0000000000000000 g f is marked as a function symbol, but g is not. I recogni...
2020 Jul 14
2
Multiple documents in one test file
...vm-mc, if we go with an option, is there a better name than > --doc-id? David Blaikie proposed --asm-id >    (This is my personal preference, trading 30+ lines in a utility > for simpler syntax) FWIW, the way I've done this in llvm-mc so far is via a combination of "--defsym CASE<N>" command line argument and ".ifdef" asm directives. This has the advantage that individual "documents" don't need to be fully standalone (though they can be), so you can put the common parts of the tests into an unconditionally compiled block. That said,...
2017 Mar 20
2
Please dogfood LLD
Michael Johnson via llvm-dev <llvm-dev at lists.llvm.org> writes: > Hi Rui, > > Are there any plans to support the -defsym command line option? It doesn't look that hard, it was just never requested. What project is using it? Cheers, Rafael
2008 Oct 16
1
syslinux compile fails: undefined symbol `obj_kpxeprefix'
...ry `/home/lfs/src/pkgs/syslinux/syslinux-3.72/gpxe' make -C src EMBEDDED_IMAGE=../../core/pxelinux.0 bin/undionly.kpxe make[2]: Entering directory `/home/lfs/src/pkgs/syslinux/syslinux-3.72/gpxe/src' ld -m elf_i386 -N --no-check-sections -T arch/i386/scripts/i386.lds -u obj_kpxeprefix --defsym check_obj_kpxeprefix=obj_kpxeprefix -u obj_undionly --defsym check_obj_undionly=obj_undionly -u obj_config --defsym check_obj_config=obj_config --defsym pci_vendor_id=0 --defsym pci_device_id=0 bin/blib.a -o bin/undionly.kpxe.tmp \ -Map bin/undionly.kpxe.tmp.map arch/i386/sc...
2013 Aug 22
2
[LLVMdev] defining symbols with lld
Hi Nick, I am planning to work on adding support for definining expressions for the Gnu flavor. Currently Gnu ld supports an option --defsym symbol=expression. The expression may be composed of other symbols. Any symbol that appears in the expression, gets its value from the output symbol value (address of the symbol in the output file). In addition the symbol only gets defined if and only if there is a relocation, that refers to th...
2013 Aug 23
1
[LLVMdev] defining symbols with lld
...10”. >> What do you mean by functions set in expression? >> > Linker scripts can set expressions to be, some of the examples that I have > seen are :- > > foo=SIZEOF(.text) > foo=14+ADDR(.data) > foo=ALIGN(4096) > > However, the kinds of expressions allowed in --defsym is much more restricted. From the GNU ld manpage: --defsym=symbol=expression Create a global symbol in the output file, containing the absolute address given by expression. You may use this option as many times as necessary to define multiple symbols in the command li...
2013 Aug 22
0
[LLVMdev] defining symbols with lld
On Thu, Aug 22, 2013 at 12:54 PM, Shankar Easwaran <shankare at codeaurora.org>wrote: > Hi Nick, > > I am planning to work on adding support for definining expressions for the > Gnu flavor. > > Currently Gnu ld supports an option --defsym symbol=expression. The > expression may be composed of other symbols. > Any symbol that appears in the expression, gets its value from the output > symbol value (address of the symbol in the output file). > > In addition the symbol only gets defined if and only if there is a > rel...
2013 Jan 03
2
[LLVMdev] [lld] Linker script findings.
...linker scripts, it seems like it is more natural to treat them like commandline argument processing, which "calls into" the ELF Writer rather than being "called from" the ELF Writer (indeed, many linker script constructs are isomorphic to certain commandline options). Indeed, `--defsym` can be used to create symbols and it is probably best to share a common code path. -- Sean Silva
2017 Mar 20
3
Please dogfood LLD
Michael Johnson <mpj at rowley.co.uk> writes: > Hi Rafael, >> Michael Johnson via llvm-dev <llvm-dev at lists.llvm.org> writes: >> >>> Hi Rui, >>> >>> Are there any plans to support the -defsym command line option? >> It doesn't look that hard, it was just never requested. What project is >> using it? > Not sure I understand what the project set is. It's not an uncommon > feature for a linker in the embedded world. > > It's the first problem I discover...
2013 Jan 03
0
[LLVMdev] [lld] Linker script findings.
...eems like it is more > natural to treat them like commandline argument processing, which > "calls into" the ELF Writer rather than being "called from" the ELF > Writer (indeed, many linker script constructs are isomorphic to > certain commandline options). Indeed, `--defsym` can be used to create > symbols and it is probably best to share a common code path. Yes, the linker scripts and the command line arguments should all be parsed into one set of "options" to the ELF Writer. My point was that most of linker script options don't need to be handle...
2013 Sep 13
2
[LLVMdev] [lld] Implementing the aliasing feature
...m, aliasing will not work. I was thinking to model this for ELF for the below functionalities :- a) __wrap For example : --wrap fn What I plan to do here is, create a undefined function fn atom create a defined weak atom fn create a alias reference to __wrap_fn which is a undefined atom. b) --defsym option For example : --defsym A = B the defsym option is going to have a undefined atom for A create a defined weak atom "B" of size 0 create a alias reference to the expression atom, that defines the expression. Both (a), (b) would work if there is an actual function fn, and a symbol...
2019 Jan 28
4
lld write wrong symbol value in .data section if enable -pie
...64/MdeModulePkg/Application/HelloWorld/HelloWorld/DEBUG/HelloWorld.map --whole-archive -O0 -melf_x86_64 --oformat elf64-x86-64 --start-group @/home/jshi19/wksp_efi/lgao4/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/MdeModulePkg/Application/HelloWorld/HelloWorld/OUTPUT/static_library_files.lst --end-group --defsym=PECOFF_HEADER_SIZE=0x228 --script=/home/jshi19/wksp_efi/lgao4/edk2/BaseTools/Scripts/GccBase.lds 2. Then, I check the R_X86_64_64 relocation entries in .rela.data section, and find their target offsets $ readelf -r /home/jshi19/wksp_efi/lgao4/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/MdeModulePk...
2013 Jan 07
0
[LLVMdev] [lld] Linker script findings.
...es to link with INPUT, add groups of archives to be searched with GROUP, name the output file with OUTPUT, add new library path directories with SEARCH_DIR, etc… Also keep in mind that that linker scripts are usually "inlined" with other command line options. For example: ld foo.o --defsym=x=12 -Lbar -T beagle-ram.ld -lbaz bar.o As you said, it makes sense to parse it during command line argument parsing. -- Meador Inge CodeSourcery / Mentor Embedded http://www.mentor.com/embedded-software
2015 Jun 05
3
[LLVMdev] Modeling ELF linker with lld/Chunks.
...ll, I have a design question of how your linker would be suitable for modeling ELF semantics. The ELF linker needs the functionality of reading relocations ahead of symbol resolution for the following usecases :- - Add linker defined symbols if there is a relocation to the symbol (Examples are : defsym, PROVIDE) - Dont halt the linker operation if there are undefined symbols but they are not called from the root set (Do garbage collection and then report whether symbols are really undefined) - A reference to a symbol inside a group, from outside a group need to be through an undefined symbol - Fo...
2013 Sep 13
0
[LLVMdev] [lld] Implementing the aliasing feature
...add a Pass which get X and looks at the reference to finds what the two references now point to (malloc and __wrap_malloc). It then walks the whole graph and changes references that point to malloc to point to __wrap_malloc instead, and any references to __real_malloc to malloc. > > b) --defsym option > > For example : --defsym A = B > > the defsym option is going to have a undefined atom for A > create a defined weak atom "B" of size 0 > create a alias reference to the expression atom, that defines the expression. > > Both (a), (b) would work if there...
2013 Sep 13
0
[LLVMdev] [lld] Implementing the aliasing feature
Can an “alias” atom just be a zero sized atom with one reference of kindLayoutBefore to its target? The layout engine should then place the alias atom right before the real atom, so you wind up with two symbols at one address. -Nick On Sep 12, 2013, at 3:02 PM, Shankar Easwaran <shankare at codeaurora.org> wrote: > Hi Nick, > > In addition to what you mentioned, I think there
2013 Aug 23
0
[LLVMdev] defining symbols with lld
Hi Nick, Thanks for your reply. On 8/23/2013 3:40 PM, Nick Kledzik wrote: > > These are the changes I plan to make, and some questions that I have > > a) Define a new contentType for DefinedAtoms to say 'Expression' > b) Create a new class ExprnAtom derived from DefinedAtom > c) The expression could also contain various functions that could be set in the expression, how