jluis has quit [Remote host closed the connection]
xiangfu_ has joined #qi-hardware
xiangfu_ has quit [Client Quit]
xiangfu_ has joined #qi-hardware
xiangfu has quit [Ping timeout: 260 seconds]
xiangfu_ is now known as xiangfu
BerryHalsak has quit [Ping timeout: 240 seconds]
jluis has joined #qi-hardware
xiangfu has quit [Ping timeout: 252 seconds]
pcercuei_ is now known as pcercuei
xiangfu has joined #qi-hardware
atommann has quit [Quit: Leaving]
kilae has joined #qi-hardware
xiangfu has quit [Ping timeout: 252 seconds]
xiangfu has joined #qi-hardware
jluis has quit [Remote host closed the connection]
xiangfu has quit [Remote host closed the connection]
<kyak>
fawk! i spent several hours trying to figure out why i get "undefined reference" from ld. It turns out that the order of objects to link does matter!
<wpwrak>
just objects, or also libraries ? :)
<pcercuei>
if you have cross-references, you can do that:
<wpwrak>
in the old days, we printed listings on paper. now they print them on pcbs. what's next, stone tablets ?
rz2k has quit []
atommann has joined #qi-hardware
atommann has quit [Quit: Leaving]
<wpwrak>
some people have strange ideas. e.g., freescale put a low-power wakeup function on a pin that's normally not interrupt-capable. ah, the logic in those parallel universes ...
rz2k has joined #qi-hardware
rz2k has quit []
pcercuei has quit [Ping timeout: 252 seconds]
zear has quit [Ping timeout: 240 seconds]
zear has joined #qi-hardware
<whitequark>
sometimes I think the people who assign functions to pins (and modules) are permanently high
<whitequark>
— *incomprehensible giggling* and this one would be a timer or USART RTS! — cool idea, bro *both giggle*
<larsc>
nobody needs rts anyaway
<DocScrutinizer05>
err huh? order matters on binding?
<DocScrutinizer05>
only when you have colliding references, i.e. of same name, no?
<DocScrutinizer05>
aiui that's the whole point of LD_PRELOAD
<whitequark>
DocScrutinizer05: there are some obscure corner cases where order matters when linking
<larsc>
I wouldn't call them obscure or corner cases
<DocScrutinizer05>
sorry that's beyond me
<larsc>
the dependent object needs to be listed before the dependency
<DocScrutinizer05>
ugh!
<whitequark>
larsc: hm, really? I bumped into it far too rare then
<DocScrutinizer05>
recursuive and even circular dependcy resolving been a key feature of my first commercial project, done in pascal(!) which only allowed a limited (one digit) number of fixed file handles to get listed at compile time, no open()
<DocScrutinizer05>
back in 1983 or sth
<whitequark>
ld is not exactly modern
<larsc>
it was changed for performance reasons, iirc
<larsc>
it doesn't matter if you compile your hello world
<DocScrutinizer05>
nasty
<larsc>
but for large programs like e.g. firefox it is supposed to make a difference
<whitequark>
llvm's linker, lld, works in a fascinating way
<larsc>
although whether this should be default is indeed a bit questionable
<whitequark>
it doesn't care about object files at all. instead, it has a graph of atoms (atom = symbol + content)
<whitequark>
so, no need for ordering, or ridiculous hacks such as -ffunction-sections
BerryHalsak has joined #qi-hardware
<DocScrutinizer05>
wait, did I get it right: ld knows how to resolve forward dependencies, but it's disabled by default for performance reasons?
<whitequark>
apparently
<DocScrutinizer05>
:-S
<DocScrutinizer05>
now that's what I call design of a lazy uninspired coder
<DocScrutinizer05>
wtf blocks ld to switch to a more smart way to resolve deps as soon as it runs into trouble with optimized method?
<DocScrutinizer05>
also I can't recall even seen a switch/option for that in ld's man page. Then otoh that manpage is a nighmare, right?
<DocScrutinizer05>
only 1344, not as bad as I thought
<larsc>
the switch is '-( ... )-'
<whitequark>
1344?
<DocScrutinizer05>
lines
<DocScrutinizer05>
but also not really self-explanatory
<DocScrutinizer05>
to understand what all the options *really* do you need ten times that anount of doc, at least
<DocScrutinizer05>
man ld|less -j2 +'/sort' ; sounds kinda related. But maybe not at all
<DocScrutinizer05>
larsc: '-( archives -)' ?
<DocScrutinizer05>
yup, manpage explanation sounds about right
<DocScrutinizer05>
>>Using this option has a significant performance cost. It is best to use it only when there are unavoidable circular references between two or more archives.<< LOL
<whitequark>
*circular* dependencies
<whitequark>
that's why I almost never had to use it
<DocScrutinizer05>
read the whole helptext, it suggests that usually you have an ordered list of archive files
<DocScrutinizer05>
and ld only switches to repeated circular search through all archives when -( -) is used
<wpwrak>
the most common cast where it hits people is when they put libraries before object files
<wpwrak>
the rest (dependencies between libraries and such) is less common
<DocScrutinizer05>
man ld|less -j2 +'2/--start-group'
<wpwrak>
well, you have two types of problem situations: getting the DAG wrong or having a cyclic graph (DCG). in the former case you have to reorder the libraries. in the latter case you have to repeat some of them.
<wpwrak>
--start-group is basically a work-around. can make sense in cases where you can't quite predict what the libraries will do, though
<DocScrutinizer05>
or in cases where you have a shitload of back&forth references
<DocScrutinizer05>
but honestly, I'd expect a linker to take care of that without me helping it out of valley of ignorance
BerryHalsak has quit [Ping timeout: 255 seconds]
<wpwrak>
yeah, it does seem a little odd. not sure how much more effort it would be
<DocScrutinizer05>
some heuristics could help a lot
<wpwrak>
actually, the best would be to print a warning of it finds a DAG problem. then one could simply reorder the libs.
<DocScrutinizer05>
the best would be a warning and rescan of all archives like in -(-)
<wpwrak>
yes, that's what i meant
<DocScrutinizer05>
then keep in minf which archive been able to satisfy the "stale" reference, and search this archive first next time a stale reference happens
<wpwrak>
but then, a fatal error can be seen as a warning you can't ignore ;-)
<DocScrutinizer05>
kinda, but silly
<wpwrak>
mafia-style programming ;-)
<DocScrutinizer05>
"sorry, I detected a problem and I can tell you which one, but my coder been too lazy to teach me how to solve it. HEEEELP!"
<DocScrutinizer05>
even s/(which one)/\1 and what's the supposed solution/
<wpwrak>
well, it's not a big deal. once you understand it, it's easy enough to solve such problems when you run into them
<DocScrutinizer05>
yes, but it's terribly annoying
<DocScrutinizer05>
it's basically like an arbitrary cmdline tool throwing error "-x not allowed after -y, please use -x -y instead of -y -x!"
<wpwrak>
i'd suggest you inform the UN security council. you've convinced me, something really has to be done about it ;-)
<whitequark>
DocScrutinizer05: you mean like find? :D
<whitequark>
$ find -name foo /
<whitequark>
find: paths must precede expression: /