oeuf has quit [Read error: Connection reset by peer]
oeuf has joined ##openfpga
scrts has quit [Ping timeout: 240 seconds]
scrts has joined ##openfpga
Bike has joined ##openfpga
azonenberg_work has quit [Ping timeout: 260 seconds]
azonenberg_work has joined ##openfpga
eduardo__ has joined ##openfpga
eduardo_ has quit [Ping timeout: 255 seconds]
scrts has quit [Ping timeout: 260 seconds]
flaviusb has quit [Quit: Leaving.]
Bike has quit [Quit: leaving]
DocScrutinizer05 has quit [Disconnected by services]
DocScrutinizer05 has joined ##openfpga
wpwrak has quit [Ping timeout: 240 seconds]
wpwrak has joined ##openfpga
scrts has joined ##openfpga
Hootch has joined ##openfpga
UmbralRaptor has quit [Quit: *BAMF!*]
pie_ has joined ##openfpga
m_w has quit [Quit: leaving]
digshadow has joined ##openfpga
talsit has left ##openfpga [##openfpga]
m_t has joined ##openfpga
scrts has quit [Ping timeout: 268 seconds]
scrts has joined ##openfpga
scrts has quit [Ping timeout: 240 seconds]
scrts has joined ##openfpga
_whitelogger has joined ##openfpga
whitequark has joined ##openfpga
pie_ has quit [Changing host]
pie_ has joined ##openfpga
scrts has quit [Ping timeout: 240 seconds]
scrts has joined ##openfpga
<rqou>
whitequark: i'm currently playing around with dropping gcc for clang
<rqou>
for my particular test case it seems that replacing arm-none-eabi-gcc with "clang --target=arm-none-eabi -isystem <cross gcc includes dir>" works
<rqou>
at least for compiling individual source files
<rqou>
but i can't get clang to do the final link step
<rqou>
i currently use "arm-none-eabi-gcc -v $CFLAGS -B.. -specs=../linkspecs.specs -o poke-tool.elf -Wl,-Map=poke-tool.map *.o"
<rqou>
which seems to do some multilib magic
<rqou>
how do i make clang do the same thing?
<whitequark>
you can't. clang has no way to parse gcc's -specs files, thankfully
<whitequark>
multilib options are basically hardcoded per triple
<rqou>
ok, the contents of the specs file are the following:
<rqou>
%rename link old_link
<rqou>
*link:
<rqou>
%(old_link) ldscript.ld%T --gc-sections
<rqou>
*startfile:
<rqou>
crti%s crtbegin%s
<rqou>
is there a way to make clang perform an equivalent thing?
<whitequark>
just pass the equivalent -Wl, options?
<whitequark>
put crtio.o crtbegin.o -Wl,ldscript.ld -Wl,--gc-sections before $CFLAGS
<whitequark>
should suffice
<whitequark>
erm
<whitequark>
-Wl,-T,ldscript.ld
<rqou>
what about some stuff in the documentation about constructor functions?
<rqou>
"The program collect2 works by linking the program once and looking through the linker output file for symbols with particular names indicating they are constructor functions. If it finds any, it creates a new temporary ‘.c’ file containing a table of them, compiles it, and links the program a second time including that file. "
<whitequark>
no idea whatsoever
<whitequark>
wow, that is a horrible hack
<whitequark>
well...
<whitequark>
that explains one reason why clang shells out to gcc for linking
<rqou>
is this _required_?
<whitequark>
hm?
<whitequark>
collect2?
<whitequark>
hang on
<whitequark>
is that just assembling .init/.fini sections?
<rqou>
maybe?
<whitequark>
if that's just .init/.fini then you don't need collect2 or any such hacks, the linker script alone works
scrts has quit [Ping timeout: 240 seconds]
<whitequark>
and I'm vaguely certain that clang will emit constructors into .init
<whitequark>
so try ignoring the existence of collect2 and see
<rqou>
it seems to work, how do i make sure it works "for real?"
<rqou>
"The last variant uses neither arbitrary sections nor the GNU linker. This is preferable when you want to do dynamic linking and when using file formats which the GNU linker does not support, such as ‘ECOFF’. In this case, TARGET_HAVE_CTORS_DTORS is false, initialization and termination functions are recognized simply by their names. This requires an extra program in the linkage step,...
<rqou>
...called...
<rqou>
...collect2. "
<rqou>
does this imply that for ELF i never need collect2?
<whitequark>
one would think so
scrts has joined ##openfpga
<rqou>
whitequark: do you know how gcc obtains paths such as "<snip>/bin/../lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/lib/thumb/cortex-m0"?
<rqou>
is this part of the multilib magic?
<whitequark>
it's a part of the specs file I think
<whitequark>
again, provide the -L flags yourself
<rqou>
the built-in one right?
<whitequark>
yes
<rqou>
ah ok
<whitequark>
it's fairly generic
<rqou>
yes, providing the -L flags manually appears to work
<rqou>
anyways, tl;dr i've actually managed to replace arm-none-eabi-gcc with system clang and it works!
<whitequark>
*nod*
<rqou>
unfortunately i still need the gcc build system to get libraries built
<rqou>
in all the right permutations
<rqou>
i'm not sure how to even begin attacking this problem
<rqou>
gcc magically can build newlib by symlinking some stuff around
<rqou>
and it builds it for all the multilib permutations
<rqou>
same with libstdc++
<rqou>
how do i begin replacing this with a "doesn't need gcc?"
<whitequark>
what's the problem exactly?
<whitequark>
just give it the cflags and ldflags
<whitequark>
also, libstdc++? libc++
<rqou>
original problem: i'm trying to remove all traces of gcc
<whitequark>
I'm not sure if libstdc++ can exist separately from gcc
<rqou>
my current gcc is a giant clusterf*ck that also knows how to build newlib
<rqou>
i don't know how to untangle this
<whitequark>
newlib isn't a component of gcc
<rqou>
currently i do "ln -s ../newlib-2.5.0.20170323/newlib/ ." into the gcc directory
<rqou>
(this was a copypasta from somewhere)
<rqou>
and then gcc magically builds it
<whitequark>
have you tried reading the newlib README
<rqou>
gcc even has a "--with-newlib" option that does something???
<rqou>
right, running ./configure by itself didn't work when glued with gcc
<rqou>
gcc and newlib are somehow circularly dependent
<rqou>
or maybe they aren't and i'm just dumb
<whitequark>
that's an artifact of gcc's stupid build process
<rqou>
quite possibly
<rqou>
i'm trying to understand how to untangle it
<whitequark>
it's not tangled
<whitequark>
just use newlib's configure
<rqou>
so currently i build gcc like this: `CFLAGS_FOR_TARGET="-O2" CXXFLAGS_FOR_TARGET="-O2" ../gcc-6.3.0/configure --target=arm-none-eabi --prefix=/opt/rqou-fix-arm-stuff-again --enable-multilib --enable-languages="c,c++" --with-newlib --with-gnu-as --with-gnu-ld --disable-nls --enable-threads --with-headers=newlib/libc/include --disable-libssp --disable-libstdcxx-pch --disable-libmudflap...